1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-05 12:47:39 +02:00

Table constant

This commit is contained in:
snapshotpl
2014-04-03 22:26:45 +02:00
parent 180313742e
commit 4a6f9cabb0
2 changed files with 5 additions and 3 deletions

View File

@@ -22,6 +22,8 @@ use Monolog\Logger;
*/
class WildfireFormatter extends NormalizerFormatter
{
const TABLE = 'table';
/**
* Translates Monolog log levels to Wildfire levels.
*/
@@ -67,10 +69,10 @@ class WildfireFormatter extends NormalizerFormatter
$message = reset($message);
}
if(isset($record['context']['table'])){
if(isset($record['context'][self::TABLE])){
$type = 'TYPE';
$label = $record['channel'] .': '. $record['message'];
$message = $record['context']['table'];
$message = $record['context'][self::TABLE];
} else {
$type = $this->logLevels[$record['level']];
$label = $record['channel'];

View File

@@ -120,7 +120,7 @@ class WildfireFormatterTest extends \PHPUnit_Framework_TestCase
'level_name' => 'ERROR',
'channel' => 'table-channel',
'context' => array(
'table' => array(
WildfireFormatter::TABLE => array(
array('col1', 'col2', 'col3'),
array('val1', 'val2', 'val3'),
array('foo1', 'foo2', 'foo3'),