1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-07-30 09:50:26 +02:00

map loglevel (int-value) to log-message, as well

This commit is contained in:
Benjamin Pentzold
2017-03-28 16:04:50 +02:00
parent 59355d5ce3
commit 26c7de1e51
2 changed files with 4 additions and 0 deletions

View File

@@ -83,6 +83,9 @@ class LogstashFormatter extends NormalizerFormatter
if (isset($record['level_name'])) {
$message['level'] = $record['level_name'];
}
if (isset($record['level'])) {
$message['level_num'] = $record['level'];
}
if ($this->applicationName) {
$message['type'] = $this->applicationName;
}

View File

@@ -45,6 +45,7 @@ class LogstashFormatterTest extends \PHPUnit_Framework_TestCase
$this->assertEquals('log', $message['message']);
$this->assertEquals('meh', $message['channel']);
$this->assertEquals('ERROR', $message['level']);
$this->assertEquals(Logger::ERROR, $message['level_num']);
$this->assertEquals('test', $message['type']);
$this->assertEquals('hostname', $message['host']);