Compare commits
6 Commits
Author | SHA1 | Date | |
---|---|---|---|
7ce988fbd9 | |||
c81d20f018 | |||
289f35cf6b | |||
8dff31b4ee | |||
7746eb4af7 | |||
f5a35a1aba |
@ -17,6 +17,7 @@ namespace TheTempusProject\Canary\Bin;
|
|||||||
use TheTempusProject\Canary\Classes\TempusDebugger;
|
use TheTempusProject\Canary\Classes\TempusDebugger;
|
||||||
use TheTempusProject\Canary\Classes\Logger;
|
use TheTempusProject\Canary\Classes\Logger;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
class Canary {
|
class Canary {
|
||||||
|
|
||||||
private static $lastCall = '';
|
private static $lastCall = '';
|
||||||
@ -225,8 +226,8 @@ class Canary {
|
|||||||
if ( ! CANARY_ENABLED ) {
|
if ( ! CANARY_ENABLED ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( strlen( self::$debugLog ) > 50000 ) {
|
if ( strlen( self::$debugLog ) > CANARY_DEBUG_LOG_LIMIT ) {
|
||||||
self::$tempusDebugger->log( 'Error log too large, possible loop.' );
|
self::$tempusLogger->addLog( 'log', 'Error log too large, possible loop.' );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ( is_object( $data ) ) {
|
if ( is_object( $data ) ) {
|
||||||
|
@ -17,6 +17,7 @@ class Logger {
|
|||||||
$this->file = fopen( $this->logFilePath, 'a' );
|
$this->file = fopen( $this->logFilePath, 'a' );
|
||||||
fwrite( $this->file, '===================------++++++++++------===================' . PHP_EOL );
|
fwrite( $this->file, '===================------++++++++++------===================' . PHP_EOL );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function setupLogFile() {
|
public function setupLogFile() {
|
||||||
$this->logDirectory = rtrim( CANARY_DEBUG_DIRECTORY, DIRECTORY_SEPARATOR );
|
$this->logDirectory = rtrim( CANARY_DEBUG_DIRECTORY, DIRECTORY_SEPARATOR );
|
||||||
if ( ! is_dir( $this->logDirectory ) ) {
|
if ( ! is_dir( $this->logDirectory ) ) {
|
||||||
@ -31,12 +32,13 @@ class Logger {
|
|||||||
chmod( $this->logFilePath, 0777 );
|
chmod( $this->logFilePath, 0777 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function __destruct() {
|
public function __destruct() {
|
||||||
fwrite( $this->file, '============================================================' . PHP_EOL );
|
fwrite( $this->file, '============================================================' . PHP_EOL );
|
||||||
fclose( $this->file );
|
fclose( $this->file );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function addLog( $type = 'log', $log ) {
|
public function addLog( $type = 'log', $log = '' ) {
|
||||||
switch ( CANARY_DEBUG_TO_FILE_LEVEL ) {
|
switch ( CANARY_DEBUG_TO_FILE_LEVEL ) {
|
||||||
case CANARY_DEBUG_LEVEL_ERROR:
|
case CANARY_DEBUG_LEVEL_ERROR:
|
||||||
$acceptableLoggingLevels = [
|
$acceptableLoggingLevels = [
|
||||||
|
@ -48,6 +48,9 @@ if ( ! defined( 'CANARY_SHOW_LINES' ) ) {
|
|||||||
if ( ! defined('CANARY_DEBUG_TO_CONSOLE' ) ) {
|
if ( ! defined('CANARY_DEBUG_TO_CONSOLE' ) ) {
|
||||||
define( 'CANARY_DEBUG_TO_CONSOLE', false );
|
define( 'CANARY_DEBUG_TO_CONSOLE', false );
|
||||||
}
|
}
|
||||||
|
if ( ! defined('CANARY_DEBUG_LOG_LIMIT' ) ) {
|
||||||
|
define( 'CANARY_DEBUG_LOG_LIMIT', 500000 );
|
||||||
|
}
|
||||||
|
|
||||||
# Tell the app all constants have been loaded.
|
# Tell the app all constants have been loaded.
|
||||||
if ( ! defined('CANARY_CONSTANTS_LOADED' ) ) {
|
if ( ! defined('CANARY_CONSTANTS_LOADED' ) ) {
|
||||||
|
20
composer.lock
generated
Normal file
20
composer.lock
generated
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
{
|
||||||
|
"_readme": [
|
||||||
|
"This file locks the dependencies of your project to a known state",
|
||||||
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
|
"This file is @generated automatically"
|
||||||
|
],
|
||||||
|
"content-hash": "2766960a50e2f2f76a8ec41e644bc0de",
|
||||||
|
"packages": [],
|
||||||
|
"packages-dev": [],
|
||||||
|
"aliases": [],
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"stability-flags": [],
|
||||||
|
"prefer-stable": false,
|
||||||
|
"prefer-lowest": false,
|
||||||
|
"platform": {
|
||||||
|
"php": ">=8.1.0"
|
||||||
|
},
|
||||||
|
"platform-dev": [],
|
||||||
|
"plugin-api-version": "2.3.0"
|
||||||
|
}
|
2
logs/.gitignore
vendored
Normal file
2
logs/.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
*
|
||||||
|
!.gitignore
|
Reference in New Issue
Block a user