\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 : bool

Type

bool

$maxNestingLevel

$maxNestingLevel : int

Type

int

$isLegacyMongoExt

$isLegacyMongoExt : bool

Type

bool

Methods

__construct()

__construct(int  $maxNestingLevel = 3, bool  $exceptionTraceAsString = true) : mixed

Parameters

int $maxNestingLevel

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

bool $exceptionTraceAsString

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

Returns

mixed —

format()

format(array  $record) : array

Formats a log record.

Parameters

array $record

A record to format

Returns

array —

formatBatch()

formatBatch(array  $records) : array[]

Formats a set of log records.

Parameters

array $records

A set of records to format

Returns

array[] —

formatArray()

formatArray(array  $array, int  $nestingLevel) : array|string

Parameters

array $array
int $nestingLevel

Returns

array|string —

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

formatObject()

formatObject(mixed  $value, int  $nestingLevel) : array|string

Parameters

mixed $value
int $nestingLevel

Returns

array|string —

formatException()

formatException(\Throwable  $exception, int  $nestingLevel) : array|string

Parameters

\Throwable $exception
int $nestingLevel

Returns

array|string —

formatDate()

formatDate(\DateTimeInterface  $value, int  $nestingLevel) : \MongoDB\BSON\UTCDateTime

Parameters

\DateTimeInterface $value
int $nestingLevel

Returns

\MongoDB\BSON\UTCDateTime —

getMongoDbDateTime()

getMongoDbDateTime(\DateTimeInterface  $value) : \MongoDB\BSON\UTCDateTime

Parameters

\DateTimeInterface $value

Returns

\MongoDB\BSON\UTCDateTime —

legacyGetMongoDbDateTime()

legacyGetMongoDbDateTime(\DateTimeInterface  $value) : \MongoDB\BSON\UTCDateTime

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

Returns

\MongoDB\BSON\UTCDateTime —