\Monolog\HandlerElasticaHandler

Elastic Search handler

Usage example:

$client = new \Elastica\Client(); $options = array( 'index' => 'elastic_index_name', 'type' => 'elastic_doc_type', Types have been removed in Elastica 7 ); $handler = new ElasticaHandler($client, $options); $log = new Logger('application'); $log->pushHandler($handler);

Summary

Methods
Properties
Constants
handle()
reset()
pushProcessor()
popProcessor()
setFormatter()
getFormatter()
__construct()
isHandling()
setLevel()
getLevel()
setBubble()
getBubble()
handleBatch()
close()
__destruct()
__sleep()
getOptions()
No public properties found
No constants found
write()
processRecord()
resetProcessors()
getDefaultFormatter()
bulkSend()
$processors
$formatter
$level
$bubble
$client
$options
N/A
No private methods found
No private properties found
N/A

Properties

$processors

$processors : callable[]

Type

callable[]

$formatter

$formatter : ?\Monolog\Formatter\FormatterInterface

Type

FormatterInterface

$level

$level : int

Type

int

$bubble

$bubble : bool

Type

bool

$client

$client : \Elastica\Client

Type

\Elastica\Client —

$options

$options : array

Type

array — Handler config options

Methods

handle()

handle(array  $record) : bool

{@inheritDoc}

Parameters

array $record

Returns

bool —

reset()

reset() : void

pushProcessor()

pushProcessor(callable  $callback) : \Monolog\Handler\HandlerInterface

{@inheritDoc}

Parameters

callable $callback

Returns

\Monolog\Handler\HandlerInterface —

popProcessor()

popProcessor() : callable

{@inheritDoc}

Returns

callable —

setFormatter()

setFormatter(\Monolog\Formatter\FormatterInterface  $formatter) : \Monolog\Handler\HandlerInterface

{@inheritDoc}

Parameters

\Monolog\Formatter\FormatterInterface $formatter

Returns

\Monolog\Handler\HandlerInterface —

getFormatter()

getFormatter() : \Monolog\Formatter\FormatterInterface

{@inheritDoc}

Returns

\Monolog\Formatter\FormatterInterface —

__construct()

__construct(\Elastica\Client  $client, array  $options = [], mixed  $level = Logger::DEBUG, bool  $bubble = true) : mixed

Parameters

\Elastica\Client $client

Elastica Client object

array $options

Handler configuration

mixed $level
bool $bubble

Returns

mixed —

isHandling()

isHandling(array  $record) : bool

{@inheritDoc}

Parameters

array $record

Returns

bool —

setLevel()

setLevel(mixed  $level) : self

Sets minimum logging level at which this handler will be triggered.

Parameters

mixed $level

Returns

self —

getLevel()

getLevel() : int

Gets minimum logging level at which this handler will be triggered.

Returns

int —

setBubble()

setBubble(bool  $bubble) : self

Sets the bubbling behavior.

Parameters

bool $bubble

true means that this handler allows bubbling. false means that bubbling is not permitted.

Returns

self —

getBubble()

getBubble() : bool

Gets the bubbling behavior.

Returns

bool —

true means that this handler allows bubbling. false means that bubbling is not permitted.

handleBatch()

handleBatch(array  $records) : void

{@inheritDoc}

Parameters

array $records

close()

close() : void

Closes the handler.

__destruct()

__destruct() : mixed

Returns

mixed —

__sleep()

__sleep() : mixed

Returns

mixed —

getOptions()

getOptions() : array

Returns

array —

write()

write(array  $record) : void

Writes the record down to the log of the implementing handler

Parameters

array $record

processRecord()

processRecord(array  $record) : array

Processes a record.

Parameters

array $record

Returns

array —

resetProcessors()

resetProcessors() : void

getDefaultFormatter()

getDefaultFormatter() : \Monolog\Formatter\FormatterInterface

{@inheritDoc}

Returns

\Monolog\Formatter\FormatterInterface —

bulkSend()

bulkSend(\Elastica\Document[]  $documents) : void

Use Elasticsearch bulk API to send list of documents

Parameters

\Elastica\Document[] $documents

Throws

\RuntimeException