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

$index

$index : string

Type

string — Elastic search index name

$type

$type : ?string

Type

?string — Elastic search document type

$jsonEncodeOptions

$jsonEncodeOptions : int

Type

int

Methods

__construct()

__construct(string  $index, ?string  $type) : mixed

Parameters

string $index

Elastic Search index name

?string $type

Elastic Search document type, deprecated as of Elastica 7

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 —

getIndex()

getIndex() : string

Returns

string —

getType()

getType() : string

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 —

getDocument()

getDocument(array  $record) : \Elastica\Document

Convert a log message into an Elastica Document

Parameters

array $record

Returns

\Elastica\Document —