Changeset View
Changeset View
Standalone View
Standalone View
branches/5.2.x/core/kernel/utility/logger.php
Show All 18 Lines | |||||
*/ | */ | ||||
class kLogger extends kBase { | class kLogger extends kBase { | ||||
/** | /** | ||||
* Prefix of all database related errors | * Prefix of all database related errors | ||||
*/ | */ | ||||
const DB_ERROR_PREFIX = 'SQL Error:'; | const DB_ERROR_PREFIX = 'SQL Error:'; | ||||
/** | /** | ||||
* Logger state: logging of errors and user-defined messages | * Logger state: logging of errors and user-defined messages | ||||
*/ | */ | ||||
const STATE_ENABLED = 1; | const STATE_ENABLED = 1; | ||||
/** | /** | ||||
* Logger state: logging of user-defined messages only | * Logger state: logging of user-defined messages only | ||||
*/ | */ | ||||
const STATE_USER_ONLY = 2; | const STATE_USER_ONLY = 2; | ||||
/** | /** | ||||
* Logger state: don't log anything | * Logger state: don't log anything | ||||
*/ | */ | ||||
const STATE_DISABLED = 0; | const STATE_DISABLED = 0; | ||||
/** | /** | ||||
* Log store: automatically determine where log should be written | * Log store: automatically determine where log should be written | ||||
*/ | */ | ||||
const LS_AUTOMATIC = 1; | const LS_AUTOMATIC = 1; | ||||
/** | /** | ||||
* Log store: always write log to database | * Log store: always write log to database | ||||
*/ | */ | ||||
const LS_DATABASE = 2; | const LS_DATABASE = 2; | ||||
/** | /** | ||||
* Log store: always write log to disk | * Log store: always write log to disk | ||||
*/ | */ | ||||
const LS_DISK = 3; | const LS_DISK = 3; | ||||
/** | /** | ||||
* Log level: system is unusable | * Log level: system is unusable | ||||
*/ | */ | ||||
const LL_EMERGENCY = 0; | const LL_EMERGENCY = 0; | ||||
/** | /** | ||||
* Log level: action must be taken immediately | * Log level: action must be taken immediately | ||||
*/ | */ | ||||
Show All 24 Lines | |||||
*/ | */ | ||||
const LL_INFO = 6; | const LL_INFO = 6; | ||||
/** | /** | ||||
* Log level: messages generated to debug the application | * Log level: messages generated to debug the application | ||||
*/ | */ | ||||
const LL_DEBUG = 7; | const LL_DEBUG = 7; | ||||
/** | /** | ||||
* Log type: PHP related activity | * Log type: PHP related activity | ||||
*/ | */ | ||||
const LT_PHP = 1; | const LT_PHP = 1; | ||||
/** | /** | ||||
* Log type: database related activity | * Log type: database related activity | ||||
*/ | */ | ||||
const LT_DATABASE = 2; | const LT_DATABASE = 2; | ||||
/** | /** | ||||
* Log type: custom activity | * Log type: custom activity | ||||
*/ | */ | ||||
const LT_OTHER = 3; | const LT_OTHER = 3; | ||||
/** | /** | ||||
* Log interface: Front | * Log interface: Front | ||||
*/ | */ | ||||
const LI_FRONT = 1; | const LI_FRONT = 1; | ||||
/** | /** | ||||
* Log interface: Admin | * Log interface: Admin | ||||
*/ | */ | ||||
Show All 9 Lines | |||||
*/ | */ | ||||
const LI_CRON_ADMIN = 4; | const LI_CRON_ADMIN = 4; | ||||
/** | /** | ||||
* Log interface: API | * Log interface: API | ||||
*/ | */ | ||||
const LI_API = 5; | const LI_API = 5; | ||||
/** | /** | ||||
* Log notification status: disabled | * Log notification status: disabled | ||||
*/ | */ | ||||
const LNS_DISABLED = 0; | const LNS_DISABLED = 0; | ||||
/** | /** | ||||
* Log notification status: pending | * Log notification status: pending | ||||
*/ | */ | ||||
▲ Show 20 Lines • Show All 1092 Lines • ▼ Show 20 Line(s) | |||||
$log->write(); | $log->write(); | ||||
return true; | return true; | ||||
} | } | ||||
$log->write(); | $log->write(); | ||||
$res = false; | $res = false; | ||||
/* @var $handler Closure */ | |||||
foreach ($this->_handlers as $handler) { | foreach ($this->_handlers as $handler) { | ||||
if ( is_array($handler) ) { | $res = call_user_func($handler, $errno, $errstr, $errfile, $errline, $errcontext); | ||||
$object =& $handler[0]; | |||||
$method = $handler[1]; | |||||
$res = $object->$method($errno, $errstr, $errfile, $errline, $errcontext); | |||||
} | |||||
else { | |||||
$res = $handler($errno, $errstr, $errfile, $errline, $errcontext); | |||||
} | |||||
} | } | ||||
return $res; | return $res; | ||||
} | } | ||||
} | } | ||||
/** | /** | ||||
▲ Show 20 Lines • Show All 72 Lines • ▼ Show 20 Line(s) | |||||
$log->write(); | $log->write(); | ||||
return true; | return true; | ||||
} | } | ||||
$log->write(); | $log->write(); | ||||
$res = false; | $res = false; | ||||
/* @var $handler Closure */ | |||||
foreach ($this->_handlers as $handler) { | foreach ($this->_handlers as $handler) { | ||||
if ( is_array($handler) ) { | $res = call_user_func($handler, $exception); | ||||
$object =& $handler[0]; | |||||
$method = $handler[1]; | |||||
$res = $object->$method($exception); | |||||
} | |||||
else { | |||||
$res = $handler($exception); | |||||
} | |||||
} | } | ||||
return $res; | return $res; | ||||
} | } | ||||
} | } | ||||
No newline at end of file |