API CHANGE: Added comparison argument to SSLog::add_writer()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@85028 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sam Minnee 2009-08-24 03:21:12 +00:00
parent 1e83a8b51e
commit d34963df8a

View File

@ -101,9 +101,13 @@ class SSLog {
* Add a writer instance to the logger. * Add a writer instance to the logger.
* @param object $writer Zend_Log_Writer_Abstract instance * @param object $writer Zend_Log_Writer_Abstract instance
* @param const $priority Priority. Possible values: SSLog::ERR or SSLog::WARN * @param const $priority Priority. Possible values: SSLog::ERR or SSLog::WARN
* @param $comparison Priority comparison operator. Acts on the integer values of the error
* levels, where more serious errors are lower numbers. By default this is "=", which means only
* the given priority will be logged. Set to "<=" if you want to track errors of *at least*
* the given priority.
*/ */
public static function add_writer($writer, $priority = null) { public static function add_writer($writer, $priority = null, $comparison = '=') {
if($priority) $writer->addFilter(new Zend_Log_Filter_Priority($priority, '=')); if($priority) $writer->addFilter(new Zend_Log_Filter_Priority($priority, $comparison));
self::get_logger()->addWriter($writer); self::get_logger()->addWriter($writer);
} }