1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 04:37:38 +02:00

Aligned log level conversion with the one of syslog

This commit is contained in:
Jordi Boggiano
2011-04-25 15:49:27 +02:00
parent 2b1c68e0d0
commit 9e7471f77e

View File

@@ -25,11 +25,15 @@ class WildfireFormatter extends LineFormatter implements FormatterInterface
*/ */
const SIMPLE_FORMAT = "%channel%: %message% %extra%"; const SIMPLE_FORMAT = "%channel%: %message% %extra%";
// Convert Logger's error levels to Wildfire's /**
const DEBUG = 'LOG'; * Translates Monolog log levels to Wildfire levels.
const INFO = 'INFO'; */
const WARNING = 'WARN'; private $logLevels = array(
const ERROR = 'ERROR'; Logger::DEBUG => 'LOG',
Logger::INFO => 'INFO',
Logger::WARNING => 'WARN',
Logger::ERROR => 'ERROR',
);
/** /**
* {@inheritdoc} * {@inheritdoc}
@@ -51,7 +55,7 @@ class WildfireFormatter extends LineFormatter implements FormatterInterface
// Create JSON object describing the appearance of the message in the console // Create JSON object describing the appearance of the message in the console
$json = json_encode(array( $json = json_encode(array(
array( array(
'Type' => constant('self::' . $record['level_name']), 'Type' => $this->logLevels($record['level']),
'File' => '', 'File' => '',
'Line' => '', 'Line' => '',
), ),