Log Class. More...
Public Member Functions | |
__construct (array $options=array()) | |
Constructor. | |
message ($msg, $priority) | |
Push a message onto the chain. | |
error ($msg) | |
Push an error message onto the chain. | |
notice ($msg) | |
Push a notice message onto the chain. | |
warning ($msg) | |
Push a warning message onto the chain. | |
debug ($msg, array $bt=array()) | |
Push a debug message onto the chain. | |
addLogger (axLogger $logger) | |
Attach a logger to the chain. | |
registerErrorHandler ($error_types=-1) | |
Register instance as PHP error handler. | |
restoreErrorHandler () | |
handleError ($errno, $errstr, $errfile, $errline) | |
registerExceptionHandler () | |
Register Log as PHP exception handler. | |
restoreExceptionHandler () | |
Unregister Log as PHP exception handler. | |
handleException (Exception $exception) | |
Handle an exception. | |
getHistory () | |
Get messages history. | |
Protected Attributes | |
$_options | |
Configuration. | |
$_first | |
First logger in the chain. | |
$_last | |
Last logger in the chain. | |
$_message_history = array() | |
Log messages history (per request) |
Log Class.
This class is capable of capturing PHP errors and exception. This class acts as a chain of responsibilities where commands are instance of axLogger.
Definition at line 20 of file axLog.class.php.
axLog::__construct | ( | array $ | options = array() | ) |
Constructor.
The $options
parameters is described as follow:
array( 'ignore_repeated_messages' => true, 'log_errors' => true, 'log_exception' => true, );
array | $options | [optional] [default array() ] The log options |
Definition at line 60 of file axLog.class.php.
axLog::addLogger | ( | axLogger $ | logger | ) |
Attach a logger to the chain.
axLogger | $logger | The logger instance to attach |
Definition at line 145 of file axLog.class.php.
axLog::debug | ( | $ | msg, |
array $ | bt = array() |
||
) |
Push a debug message onto the chain.
string | $msg | The message |
array | $bt | The backtrace (result of PHP's debug_backtrace()) |
Definition at line 133 of file axLog.class.php.
axLog::error | ( | $ | msg | ) |
Push an error message onto the chain.
string | $msg | The message |
Definition at line 101 of file axLog.class.php.
axLog::handleError | ( | $ | errno, |
$ | errstr, | ||
$ | errfile, | ||
$ | errline | ||
) |
Error handler
integer | $errno | Error number |
string | $errstr | Error message |
string | $errfile | Error file |
integer | $errline | Error line |
ErrorException | If the error is a E_RECOVERABLE_ERROR (so you can still catch it) |
Definition at line 179 of file axLog.class.php.
axLog::handleException | ( | Exception $ | exception | ) |
Handle an exception.
When called directly by PHP in case of uncatched error, the runtime will fall after this call.
Exception | $exception | The exception to be handled void |
Definition at line 229 of file axLog.class.php.
axLog::message | ( | $ | msg, |
$ | priority | ||
) |
Push a message onto the chain.
string | $msg | The message |
integer | $priority | The priority (see axLogger constants for priorities) |
Definition at line 84 of file axLog.class.php.
axLog::notice | ( | $ | msg | ) |
Push a notice message onto the chain.
string | $msg | The message |
Definition at line 111 of file axLog.class.php.
axLog::registerErrorHandler | ( | $ | error_types = -1 | ) |
Register instance as PHP error handler.
integer | $error_types | [optional] [default -1 ] The errors to catch (all errors by default) |
Definition at line 158 of file axLog.class.php.
Register Log as PHP exception handler.
Definition at line 208 of file axLog.class.php.
Unregister instance as PHP error handler
Definition at line 166 of file axLog.class.php.
Unregister Log as PHP exception handler.
Definition at line 216 of file axLog.class.php.
axLog::warning | ( | $ | msg | ) |
Push a warning message onto the chain.
string | $msg | The message |
Definition at line 121 of file axLog.class.php.
axLogger axLog::$_first [protected] |
First logger in the chain.
Definition at line 32 of file axLog.class.php.
axLogger axLog::$_last [protected] |
Last logger in the chain.
Definition at line 38 of file axLog.class.php.
array axLog::$_message_history = array() [protected] |
Log messages history (per request)
Definition at line 44 of file axLog.class.php.
array axLog::$_options [protected] |
Configuration.
Definition at line 26 of file axLog.class.php.