mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-25 18:46:14 +02:00
Added $appendNewline flag to the JsonFormatter to enable using it when logging to files, fixes #344
This commit is contained in:
@@ -18,16 +18,15 @@ namespace Monolog\Formatter;
|
||||
*/
|
||||
class LogglyFormatter extends JsonFormatter
|
||||
{
|
||||
|
||||
/**
|
||||
* Overrides the default batch mode to new lines for compatibility with the
|
||||
* Loggly bulk API.
|
||||
*
|
||||
* @param integer $batch_mode
|
||||
* @param integer $batchMode
|
||||
*/
|
||||
public function __construct($batch_mode = self::BATCH_MODE_NEWLINES)
|
||||
public function __construct($batchMode = self::BATCH_MODE_NEWLINES, $appendNewline = false)
|
||||
{
|
||||
parent::__construct($batch_mode);
|
||||
parent::__construct($batchMode, $appendNewline);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -40,10 +39,9 @@ class LogglyFormatter extends JsonFormatter
|
||||
{
|
||||
if (isset($record["datetime"]) && ($record["datetime"] instanceof \DateTime)) {
|
||||
$record["timestamp"] = $record["datetime"]->format("c");
|
||||
// @todo unset the 'datetime' parameter, retained for BC
|
||||
// TODO 2.0 unset the 'datetime' parameter, retained for BC
|
||||
}
|
||||
|
||||
return parent::format($record);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user