ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
Monolog\Formatter\LogglyFormatter Class Reference

Encodes message information into JSON in a format compatible with Loggly. More...

+ Inheritance diagram for Monolog\Formatter\LogglyFormatter:
+ Collaboration diagram for Monolog\Formatter\LogglyFormatter:

Public Member Functions

 __construct ($batchMode=self::BATCH_MODE_NEWLINES, $appendNewline=false)
 Overrides the default batch mode to new lines for compatibility with the Loggly bulk API. More...
 
 format (array $record)
 Appends the 'timestamp' parameter for indexing by Loggly. More...
 
- Public Member Functions inherited from Monolog\Formatter\JsonFormatter
 __construct ($batchMode=self::BATCH_MODE_JSON, $appendNewline=true)
 
 getBatchMode ()
 The batch mode option configures the formatting style for multiple records. More...
 
 isAppendingNewlines ()
 True if newlines are appended to every formatted record. More...
 
 format (array $record)
 {Formats a log record.
Parameters
array$recordA record to format
Returns
mixed The formatted record
} More...
 
 formatBatch (array $records)
 {Formats a set of log records.
Parameters
array$recordsA set of records to format
Returns
mixed The formatted set of records
} More...
 
 includeStacktraces ($include=true)
 
- Public Member Functions inherited from Monolog\Formatter\NormalizerFormatter
 __construct ($dateFormat=null)
 
 format (array $record)
 {Formats a log record.
Parameters
array$recordA record to format
Returns
mixed The formatted record
} More...
 
 formatBatch (array $records)
 {Formats a set of log records.
Parameters
array$recordsA set of records to format
Returns
mixed The formatted set of records
} More...
 
 detectAndCleanUtf8 (&$data)
 Detect invalid UTF-8 string characters and convert to valid UTF-8. More...
 

Additional Inherited Members

- Data Fields inherited from Monolog\Formatter\JsonFormatter
const BATCH_MODE_JSON = 1
 
const BATCH_MODE_NEWLINES = 2
 
- Data Fields inherited from Monolog\Formatter\NormalizerFormatter
const SIMPLE_DATE = "Y-m-d H:i:s"
 
- Protected Member Functions inherited from Monolog\Formatter\JsonFormatter
 formatBatchJson (array $records)
 Return a JSON-encoded array of records. More...
 
 formatBatchNewlines (array $records)
 Use new lines to separate records instead of a JSON-encoded array. More...
 
 normalize ($data)
 Normalizes given $data. More...
 
 normalizeException ($e)
 Normalizes given exception with or without its own stack trace based on includeStacktraces property. More...
 
- Protected Member Functions inherited from Monolog\Formatter\NormalizerFormatter
 normalize ($data)
 
 normalizeException ($e)
 
 toJson ($data, $ignoreErrors=false)
 Return the JSON representation of a value. More...
 
- Protected Attributes inherited from Monolog\Formatter\JsonFormatter
 $batchMode
 
 $appendNewline
 
 $includeStacktraces = false
 
- Protected Attributes inherited from Monolog\Formatter\NormalizerFormatter
 $dateFormat
 

Detailed Description

Encodes message information into JSON in a format compatible with Loggly.

Author
Adam Pancutt adam@.nosp@m.panc.nosp@m.utt.c.nosp@m.om

Definition at line 19 of file LogglyFormatter.php.

Constructor & Destructor Documentation

◆ __construct()

Monolog\Formatter\LogglyFormatter::__construct (   $batchMode = self::BATCH_MODE_NEWLINES,
  $appendNewline = false 
)

Overrides the default batch mode to new lines for compatibility with the Loggly bulk API.

Parameters
int$batchMode

Definition at line 27 of file LogglyFormatter.php.

References Monolog\Formatter\JsonFormatter\$appendNewline, and Monolog\Formatter\JsonFormatter\$batchMode.

Member Function Documentation

◆ format()

Monolog\Formatter\LogglyFormatter::format ( array  $record)

Appends the 'timestamp' parameter for indexing by Loggly.

See also
https://www.loggly.com/docs/automated-parsing/#json
format()

Implements Monolog\Formatter\FormatterInterface.

Definition at line 38 of file LogglyFormatter.php.

References format.

39  {
40  if (isset($record["datetime"]) && ($record["datetime"] instanceof \DateTime)) {
41  $record["timestamp"] = $record["datetime"]->format("Y-m-d\TH:i:s.uO");
42  // TODO 2.0 unset the 'datetime' parameter, retained for BC
43  }
44 
45  return parent::format($record);
46  }
Write to Excel2007 format

The documentation for this class was generated from the following file: