From 9e7471f77e77ce69cfaba3e94e8f92ffb86ba5a2 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 25 Apr 2011 15:49:27 +0200 Subject: [PATCH] Aligned log level conversion with the one of syslog --- src/Monolog/Formatter/WildfireFormatter.php | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Monolog/Formatter/WildfireFormatter.php b/src/Monolog/Formatter/WildfireFormatter.php index 8fd2fc7d..97ca7333 100644 --- a/src/Monolog/Formatter/WildfireFormatter.php +++ b/src/Monolog/Formatter/WildfireFormatter.php @@ -25,11 +25,15 @@ class WildfireFormatter extends LineFormatter implements FormatterInterface */ const SIMPLE_FORMAT = "%channel%: %message% %extra%"; - // Convert Logger's error levels to Wildfire's - const DEBUG = 'LOG'; - const INFO = 'INFO'; - const WARNING = 'WARN'; - const ERROR = 'ERROR'; + /** + * Translates Monolog log levels to Wildfire levels. + */ + private $logLevels = array( + Logger::DEBUG => 'LOG', + Logger::INFO => 'INFO', + Logger::WARNING => 'WARN', + Logger::ERROR => 'ERROR', + ); /** * {@inheritdoc} @@ -51,7 +55,7 @@ class WildfireFormatter extends LineFormatter implements FormatterInterface // Create JSON object describing the appearance of the message in the console $json = json_encode(array( array( - 'Type' => constant('self::' . $record['level_name']), + 'Type' => $this->logLevels($record['level']), 'File' => '', 'Line' => '', ),