MongoDBFormatter
in package
implements
FormatterInterface
Formats a record for use with the MongoDBHandler.
Tags
Table of Contents
Interfaces
- FormatterInterface
- Interface for formatters
Properties
- $exceptionTraceAsString : bool
- $maxNestingLevel : int
Methods
- __construct() : mixed
- format() : array<string|int, mixed>
- Formats a log record.
- formatBatch() : array<string|int, array<string|int, mixed>>
- Formats a set of log records.
- formatArray() : array<string|int, mixed>|string
- formatDate() : UTCDateTime
- formatException() : array<string|int, mixed>|string
- formatObject() : array<string|int, mixed>|string
Properties
$exceptionTraceAsString
private
bool
$exceptionTraceAsString
$maxNestingLevel
private
int
$maxNestingLevel
Methods
__construct()
public
__construct([int $maxNestingLevel = 3 ][, bool $exceptionTraceAsString = true ]) : mixed
Parameters
- $maxNestingLevel : int = 3
-
0 means infinite nesting, the $record itself is level 1, $record['context'] is 2
- $exceptionTraceAsString : bool = true
-
set to false to log exception traces as a sub documents instead of strings
format()
Formats a log record.
public
format(array<string|int, mixed> $record) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
-
A record to format
Return values
array<string|int, mixed>formatBatch()
Formats a set of log records.
public
formatBatch(array<string|int, mixed> $records) : array<string|int, array<string|int, mixed>>
Parameters
- $records : array<string|int, mixed>
-
A set of records to format
Return values
array<string|int, array<string|int, mixed>>formatArray()
protected
formatArray(array<string|int, mixed> $array[, int $nestingLevel = 0 ]) : array<string|int, mixed>|string
Parameters
- $array : array<string|int, mixed>
- $nestingLevel : int = 0
Return values
array<string|int, mixed>|string —Array except when max nesting level is reached then a string "[...]"
formatDate()
protected
formatDate(DateTimeInterface $value, int $nestingLevel) : UTCDateTime
Parameters
- $value : DateTimeInterface
- $nestingLevel : int
Return values
UTCDateTimeformatException()
protected
formatException(Throwable $exception, int $nestingLevel) : array<string|int, mixed>|string
Parameters
- $exception : Throwable
- $nestingLevel : int
Return values
array<string|int, mixed>|stringformatObject()
protected
formatObject(mixed $value, int $nestingLevel) : array<string|int, mixed>|string
Parameters
- $value : mixed
- $nestingLevel : int