Constants

SIMPLE_DATE

SIMPLE_DATE = "Y-m-d\\TH:i:sP"

SIMPLE_FORMAT

SIMPLE_FORMAT = "[%datetime%] %channel%.%level_name%: %message% %context% %extra%\n"

Properties

$dateFormat

$dateFormat : string

Type

string

$maxNormalizeDepth

$maxNormalizeDepth : int

Type

int

$maxNormalizeItemCount

$maxNormalizeItemCount : int

Type

int

$format

$format : string

Type

string

$allowInlineLineBreaks

$allowInlineLineBreaks : bool

Type

bool

$ignoreEmptyContextAndExtra

$ignoreEmptyContextAndExtra : bool

Type

bool

$includeStacktraces

$includeStacktraces : bool

Type

bool

$stacktracesParser

$stacktracesParser : ?callable

Type

?callable

$jsonEncodeOptions

$jsonEncodeOptions : int

Type

int

Methods

__construct()

__construct(string|null  $format = null, string|null  $dateFormat = null, bool  $allowInlineLineBreaks = false, bool  $ignoreEmptyContextAndExtra = false, bool  $includeStacktraces = false) : mixed

Parameters

string|null $format

The format of the message

string|null $dateFormat

The format of the timestamp: one supported by DateTime::format

bool $allowInlineLineBreaks

Whether to allow inline line breaks in log entries

bool $ignoreEmptyContextAndExtra
bool $includeStacktraces

Returns

mixed —

format()

format(array  $record) : mixed

Formats a log record.

Parameters

array $record

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

getDateFormat()

getDateFormat() : string

Returns

string —

setDateFormat()

setDateFormat(string  $dateFormat) : self

Parameters

string $dateFormat

Returns

self —

getMaxNormalizeDepth()

getMaxNormalizeDepth() : int

The maximum number of normalization levels to go through

Returns

int —

setMaxNormalizeDepth()

setMaxNormalizeDepth(int  $maxNormalizeDepth) : self

Parameters

int $maxNormalizeDepth

Returns

self —

getMaxNormalizeItemCount()

getMaxNormalizeItemCount() : int

The maximum number of items to normalize per level

Returns

int —

setMaxNormalizeItemCount()

setMaxNormalizeItemCount(int  $maxNormalizeItemCount) : self

Parameters

int $maxNormalizeItemCount

Returns

self —

setJsonPrettyPrint()

setJsonPrettyPrint(bool  $enable) : self

Enables `json_encode` pretty print.

Parameters

bool $enable

Returns

self —

addJsonEncodeOption()

addJsonEncodeOption(int  $option) : self

Parameters

int $option

Returns

self —

removeJsonEncodeOption()

removeJsonEncodeOption(int  $option) : self

Parameters

int $option

Returns

self —

includeStacktraces()

includeStacktraces(bool  $include = true, ?callable  $parser = null) : self

Parameters

bool $include
?callable $parser

Returns

self —

allowInlineLineBreaks()

allowInlineLineBreaks(bool  $allow = true) : self

Parameters

bool $allow

Returns

self —

ignoreEmptyContextAndExtra()

ignoreEmptyContextAndExtra(bool  $ignore = true) : self

Parameters

bool $ignore

Returns

self —

stringify()

stringify(mixed  $value) : string

Parameters

mixed $value

Returns

string —

normalize()

normalize(mixed  $data, int  $depth) : null|scalar|(array|scalar|null)[]

Parameters

mixed $data
int $depth

Returns

null|scalar|(array|scalar|null)[] —

normalizeException()

normalizeException(\Throwable  $e, int  $depth) : array

Parameters

\Throwable $e
int $depth

Returns

array —

toJson()

toJson(mixed  $data, bool  $ignoreErrors = false) : string

Return the JSON representation of a value

Parameters

mixed $data
bool $ignoreErrors

Throws

\RuntimeException

if encoding fails and errors are not ignored

Returns

string —

if encoding fails and ignoreErrors is true 'null' is returned

formatDate()

formatDate(\DateTimeInterface  $date) : string

Parameters

\DateTimeInterface $date

Returns

string —

convertToString()

convertToString(mixed  $data) : string

Parameters

mixed $data

Returns

string —

replaceNewlines()

replaceNewlines(string  $str) : string

Parameters

string $str

Returns

string —

formatException()

formatException(\Throwable  $e) : string

Parameters

\Throwable $e

Returns

string —

stacktracesParser()

stacktracesParser(\Throwable  $e) : string

Parameters

\Throwable $e

Returns

string —

stacktracesParserCustom()

stacktracesParserCustom(string  $trace) : string

Parameters

string $trace

Returns

string —