Class SS_Log
Wrapper class for a logging handler like Zend_Log which takes a message (or a map of context variables) and sends it to one or more Zend_Log_Writer_Abstract subclasses for output.
These priorities are currently supported: - SS_Log::ERR - SS_Log::WARN - SS_Log::NOTICE
You can add an error writer by calling SS_Log::add_writer()
Example usage of logging errors by email notification:
SS_Log::add_writer(new SS_LogEmailWriter('my@email.com'), SS_Log::ERR);
Example usage of logging errors by file:
SS_Log::add_writer(new SS_LogFileWriter('/var/log/silverstripe/errors.log'), SS_Log::ERR);
Example usage of logging at warnings and errors by setting the priority to '<=':
SS_Log::add_writer(new SS_LogEmailWriter('my@email.com'), SS_Log::WARN, '<=');
Each writer object can be assigned a formatter. The formatter is responsible
for formatting the message before giving it to the writer. SS_LogErrorEmailFormatter is such an example that formats errors into HTML for
human readability in an email client.
Formatters are added to writers like this:
$logEmailWriter = new SS_LogEmailWriter('my@email.com'); $myEmailFormatter = new MyLogEmailFormatter(); $logEmailWriter->setFormatter($myEmailFormatter);
Methods summary
public static
object
|
|
public static
array
|
|
public static
|
|
public static
|
|
public static
|
#
add_writer( object $writer, const $priority = null, mixed $comparison = '=' )
Add a writer instance to the logger. |
public static
|
Magic methods summary
Constants summary
string |
ERR
|
Zend_Log::ERR |
|
string |
WARN
|
Zend_Log::WARN |
|
string |
NOTICE
|
Zend_Log::NOTICE |
Properties summary
public static
string
|
$logger_class |
#
Logger class to use. |
protected static
object
|
$logger |