PHP Class Webiny\Component\Logger\Driver\Webiny\Handler\AbstractHandler

Inheritance: use trait Webiny\Component\StdLib\StdLibTrait
Show file Open project: Webiny/Framework Class Usage Examples

Protected Properties

Property Type Description
$bubble
$buffer
$formatter Webiny\Component\Logger\Driver\Webiny\Formatter\FormatterInterface
$levels
$processors
$records

Public Methods

Method Description
__construct ( array | ArrayObject $levels = [], boolean $bubble = true, boolean $buffer = false ) : AbstractHandler
__destruct ( ) Destructor
addProcessor ( mixed $callback, boolean $processBufferRecord = false ) Add processor to this handler
canHandle ( Record $record ) : boolean Check if this handler can handle the given Record
process ( Record $record ) : boolean Process given record This will pass given record to ProcessorInterface instance, then format the record and output it according to current AbstractHandler instance
setFormatter ( Webiny\Component\Logger\Driver\Webiny\Formatter\FormatterInterface $formatter )
stopHandling ( ) : void Stop handling
This will be called automatically when the object is destroyed

Protected Methods

Method Description
getDefaultFormatter ( ) : FormatterAbstract Get default formatter for this handler
processRecord ( Record $record ) : Record Processes a record.
processRecords ( array $records ) : boolean Process batch of records
write ( Record $record ) : void Writes the record down to the log of the implementing handler

Private Methods

Method Description
getFormatter ( ) : Webiny\Component\Logger\Driver\Webiny\Formatter\FormatterInterface

Method Details

__construct() public method

public __construct ( array | ArrayObject $levels = [], boolean $bubble = true, boolean $buffer = false ) : AbstractHandler
$levels array | ArrayObject The minimum logging level at which this handler will be triggered
$bubble boolean Whether the messages that are handled can bubble up the stack or not
$buffer boolean
return AbstractHandler Instance of AbstractHandler

__destruct() public method

Destructor
public __destruct ( )

addProcessor() public method

Add processor to this handler
public addProcessor ( mixed $callback, boolean $processBufferRecord = false )
$callback mixed Callable or instance of ProcessorInterface
$processBufferRecord boolean

canHandle() public method

Check if this handler can handle the given Record
public canHandle ( Record $record ) : boolean
$record Webiny\Component\Logger\Driver\Webiny\Record
return boolean Boolean telling whether this handler can handle the given Record

getDefaultFormatter() abstract protected method

Get default formatter for this handler
abstract protected getDefaultFormatter ( ) : FormatterAbstract
return FormatterAbstract

process() public method

Process given record This will pass given record to ProcessorInterface instance, then format the record and output it according to current AbstractHandler instance
public process ( Record $record ) : boolean
$record Webiny\Component\Logger\Driver\Webiny\Record
return boolean Bubble flag (this either continues propagation of the Record to other handlers, or stops the logger from processing this record any further)

processRecord() protected method

Processes a record.
protected processRecord ( Record $record ) : Record
$record Webiny\Component\Logger\Driver\Webiny\Record
return Webiny\Component\Logger\Driver\Webiny\Record Processed Record object

processRecords() protected method

Process batch of records
protected processRecords ( array $records ) : boolean
$records array Batch of records to process
return boolean Bubble flag (this either continues propagation of the Record to other handlers, or stops the logger from processing this record any further)

setFormatter() public method

public setFormatter ( Webiny\Component\Logger\Driver\Webiny\Formatter\FormatterInterface $formatter )
$formatter Webiny\Component\Logger\Driver\Webiny\Formatter\FormatterInterface

stopHandling() public method

Stop handling
This will be called automatically when the object is destroyed
public stopHandling ( ) : void
return void

write() abstract protected method

Writes the record down to the log of the implementing handler
abstract protected write ( Record $record ) : void
$record Webiny\Component\Logger\Driver\Webiny\Record
return void

Property Details

$bubble protected property

protected $bubble

$buffer protected property

protected $buffer

$formatter protected property

protected FormatterInterface,Webiny\Component\Logger\Driver\Webiny\Formatter $formatter
return Webiny\Component\Logger\Driver\Webiny\Formatter\FormatterInterface

$levels protected property

protected $levels

$processors protected property

protected $processors

$records protected property

protected $records