4 Commits
1.0.1 ... 1.0.4

Author SHA1 Message Date
7ce988fbd9 improve line limit and add config for it 2024-08-10 14:58:57 -04:00
c81d20f018 bugfix 2024-08-10 14:15:17 -04:00
289f35cf6b add logs folder 2024-08-09 17:13:37 -04:00
8dff31b4ee bugfix 2024-08-09 02:18:45 -04:00
4 changed files with 10 additions and 3 deletions

View File

@ -226,8 +226,8 @@ class Canary {
if ( ! CANARY_ENABLED ) {
return;
}
if ( strlen( self::$debugLog ) > 50000 ) {
self::$tempusDebugger->log( 'Error log too large, possible loop.' );
if ( strlen( self::$debugLog ) > CANARY_DEBUG_LOG_LIMIT ) {
self::$tempusLogger->addLog( 'log', 'Error log too large, possible loop.' );
return;
}
if ( is_object( $data ) ) {

View File

@ -17,6 +17,7 @@ class Logger {
$this->file = fopen( $this->logFilePath, 'a' );
fwrite( $this->file, '===================------++++++++++------===================' . PHP_EOL );
}
public function setupLogFile() {
$this->logDirectory = rtrim( CANARY_DEBUG_DIRECTORY, DIRECTORY_SEPARATOR );
if ( ! is_dir( $this->logDirectory ) ) {
@ -31,12 +32,13 @@ class Logger {
chmod( $this->logFilePath, 0777 );
}
}
public function __destruct() {
fwrite( $this->file, '============================================================' . PHP_EOL );
fclose( $this->file );
}
public function addLog( $type = 'log', $log ) {
public function addLog( $type = 'log', $log = '' ) {
switch ( CANARY_DEBUG_TO_FILE_LEVEL ) {
case CANARY_DEBUG_LEVEL_ERROR:
$acceptableLoggingLevels = [

View File

@ -48,6 +48,9 @@ if ( ! defined( 'CANARY_SHOW_LINES' ) ) {
if ( ! defined('CANARY_DEBUG_TO_CONSOLE' ) ) {
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.
if ( ! defined('CANARY_CONSTANTS_LOADED' ) ) {

2
logs/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
*
!.gitignore