\Monolog\FormatterMongoDBFormatter

Formats a record for use with the MongoDBHandler.

Summary

Methods
Properties
Constants
__construct()
format()
formatBatch()
No public properties found
No constants found
formatArray()
formatObject()
formatException()
formatDate()
No protected properties found
N/A
getMongoDbDateTime()
legacyGetMongoDbDateTime()
$exceptionTraceAsString
$maxNestingLevel
$isLegacyMongoExt
N/A

Properties

$exceptionTraceAsString

$exceptionTraceAsString : 

Type

$maxNestingLevel

$maxNestingLevel : 

Type

$isLegacyMongoExt

$isLegacyMongoExt : 

Type

Methods

__construct()

__construct(integer  $maxNestingLevel = 3, boolean  $exceptionTraceAsString = true) 

Parameters

integer $maxNestingLevel

0 means infinite nesting, the $record itself is level 1, $record['context'] is 2

boolean $exceptionTraceAsString

set to false to log exception traces as a sub documents instead of strings

format()

format(array  $record) : mixed

Formats a log record.

Parameters

array $record

A record to format

Returns

mixed —

The formatted record

formatBatch()

formatBatch(array  $records) : mixed

Formats a set of log records.

Parameters

array $records

A set of records to format

Returns

mixed —

The formatted set of records

formatArray()

formatArray(array  $record, \Monolog\Formatter\int  $nestingLevel) : array|string

Parameters

array $record
\Monolog\Formatter\int $nestingLevel

Returns

array|string —

Array except when max nesting level is reached then a string "[...]"

formatObject()

formatObject(  $value, \Monolog\Formatter\int  $nestingLevel) 

Parameters

$value
\Monolog\Formatter\int $nestingLevel

formatException()

formatException(\Throwable  $exception, \Monolog\Formatter\int  $nestingLevel) 

Parameters

\Throwable $exception
\Monolog\Formatter\int $nestingLevel

formatDate()

formatDate(\DateTimeInterface  $value, \Monolog\Formatter\int  $nestingLevel) 

Parameters

\DateTimeInterface $value
\Monolog\Formatter\int $nestingLevel

getMongoDbDateTime()

getMongoDbDateTime(\DateTimeInterface  $value) 

Parameters

\DateTimeInterface $value

legacyGetMongoDbDateTime()

legacyGetMongoDbDateTime(\DateTimeInterface  $value) 

This is needed to support MongoDB Driver v1.19 and below

See https://github.com/mongodb/mongo-php-driver/issues/426

It can probably be removed in 2.1 or later once MongoDB's 1.2 is released and widely adopted

Parameters

\DateTimeInterface $value