Constants

SIMPLE_DATE

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

Properties

$dateFormat

$dateFormat : string

Type

string

$maxNormalizeDepth

$maxNormalizeDepth : int

Type

int

$maxNormalizeItemCount

$maxNormalizeItemCount : int

Type

int

$systemName

$systemName : string

Type

string — the name of the system for the Logstash log message, used to fill the @source field

$applicationName

$applicationName : string

Type

string — an application name for the Logstash log message, used to fill the @type field

$extraKey

$extraKey : string

Type

string — the key for 'extra' fields from the Monolog record

$contextKey

$contextKey : string

Type

string — the key for 'context' fields from the Monolog record

$jsonEncodeOptions

$jsonEncodeOptions : int

Type

int

Methods

__construct()

__construct(string  $applicationName, string|null  $systemName = null, string  $extraKey = 'extra', string  $contextKey = 'context') : mixed

Parameters

string $applicationName

The application that sends the data, used as the "type" field of logstash

string|null $systemName

The system/machine name, used as the "source" field of logstash, defaults to the hostname of the machine

string $extraKey

The key for extra keys inside logstash "fields", defaults to extra

string $contextKey

The key for context keys inside logstash "fields", defaults to context

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 —

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 —