1
0
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:
Jordi Boggiano
2014-04-20 18:38:47 +02:00
parent 53d0df17bb
commit 5e8bb7556b
5 changed files with 36 additions and 20 deletions

View File

@@ -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);
}
}