Axiom (v1.2.0)

A lightweight PHP framework
axLog Class Reference

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)

Detailed Description

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.

Todo:
finish axLog long description
Author:
Delespierre
License:
http://www.gnu.org/licenses/lgpl.html Lesser General Public Licence version 3

Definition at line 20 of file axLog.class.php.


Constructor & Destructor Documentation

axLog::__construct ( array $  options = array())

Constructor.

The $options parameters is described as follow:

 array(
                                'ignore_repeated_messages' => true,
                                'log_errors' => true,
                                'log_exception' => true,
                );
Parameters:
array$options[optional] [default array()] The log options

Definition at line 60 of file axLog.class.php.


Member Function Documentation

axLog::addLogger ( axLogger logger)

Attach a logger to the chain.

Parameters:
axLogger$loggerThe logger instance to attach
Returns:
axLog

Definition at line 145 of file axLog.class.php.

axLog::debug ( msg,
array $  bt = array() 
)

Push a debug message onto the chain.

See also:
axLog::message()
Note:
You may additionnaly pass a backtrace infromation for debugging purposes.
Parameters:
string$msgThe message
array$btThe backtrace (result of PHP's debug_backtrace())
Returns:
axLog

Definition at line 133 of file axLog.class.php.

axLog::error ( msg)

Push an error message onto the chain.

See also:
axLog::message()
Parameters:
string$msgThe message
Returns:
axLog

Definition at line 101 of file axLog.class.php.

Get messages history.

Returns:
array

Definition at line 245 of file axLog.class.php.

axLog::handleError ( errno,
errstr,
errfile,
errline 
)

Error handler

Parameters:
integer$errnoError number
string$errstrError message
string$errfileError file
integer$errlineError line
Exceptions:
ErrorExceptionIf the error is a E_RECOVERABLE_ERROR (so you can still catch it)
Returns:
void

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.

Note:
You may use this method to log manually any exception.
If you're running PHP >= 5.3, the previous exceptions (if any) will be registered as well.
Parameters:
Exception$exceptionThe exception to be handled void

Definition at line 229 of file axLog.class.php.

axLog::message ( msg,
priority 
)

Push a message onto the chain.

Warning:
If no logger is attached to axLog, will silently return the current instance and no operation is performed
Parameters:
string$msgThe message
integer$priorityThe priority (see axLogger constants for priorities)
Returns:
axLog

Definition at line 84 of file axLog.class.php.

axLog::notice ( msg)

Push a notice message onto the chain.

See also:
axLog::message()
Parameters:
string$msgThe message
Returns:
axLog

Definition at line 111 of file axLog.class.php.

axLog::registerErrorHandler ( error_types = -1)

Register instance as PHP error handler.

Parameters:
integer$error_types[optional] [default -1] The errors to catch (all errors by default)
Returns:
string

Definition at line 158 of file axLog.class.php.

Register Log as PHP exception handler.

Returns:
boolean

Definition at line 208 of file axLog.class.php.

Unregister instance as PHP error handler

Returns:
boolean

Definition at line 166 of file axLog.class.php.

Unregister Log as PHP exception handler.

Returns:
boolean

Definition at line 216 of file axLog.class.php.

axLog::warning ( msg)

Push a warning message onto the chain.

See also:
axLog::message()
Parameters:
string$msgThe message
Returns:
axLog

Definition at line 121 of file axLog.class.php.


Field Documentation

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.


The documentation for this class was generated from the following file:
 All Data Structures Files Functions Variables