\Monolog\HandlerSyslogHandler

Logs to syslog service.

usage example:

$log = new Logger('application'); $syslog = new SyslogHandler('myfacility', 'local6'); $formatter = new LineFormatter("%channel%.%level_name%: %message% %extra%"); $syslog->setFormatter($formatter); $log->pushHandler($syslog);

Summary

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

Properties

$facility

$facility : int

Type

int

$logLevels

$logLevels : array

Translates Monolog log levels to syslog log priorities.

Type

array

$facilities

$facilities : array<string,int>

List of valid log facility names.

Type

array

$processors

$processors : callable[]

Type

callable[]

$formatter

$formatter : ?\Monolog\Formatter\FormatterInterface

Type

FormatterInterface

$level

$level : int

Type

int

$bubble

$bubble : bool

Type

bool

$ident

$ident : string

Type

string

$logopts

$logopts : int

Type

int

Methods

__construct()

__construct(string  $ident, string|int  $facility = LOG_USER, mixed  $level = Logger::DEBUG, bool  $bubble = true, int  $logopts = LOG_PID) : mixed

Parameters

string $ident
string|int $facility

Either one of the names of the keys in $this->facilities, or a LOG_* facility constant

mixed $level
bool $bubble
int $logopts

Option flags for the openlog() call, defaults to LOG_PID

Returns

mixed —

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 —

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

Handles a set of records at once.

Parameters

array $records

The records to handle (an array of record arrays)

close()

close() : void

{@inheritDoc}

__destruct()

__destruct() : mixed

Returns

mixed —

__sleep()

__sleep() : mixed

Returns

mixed —

getDefaultFormatter()

getDefaultFormatter() : \Monolog\Formatter\FormatterInterface

Gets the default formatter.

Overwrite this if the LineFormatter is not a good default for your handler.

Returns

\Monolog\Formatter\FormatterInterface —

write()

write(array  $record) : void

{@inheritDoc}

Parameters

array $record

processRecord()

processRecord(array  $record) : array

Processes a record.

Parameters

array $record

Returns

array —

resetProcessors()

resetProcessors() : void