Constants

RFC3164

RFC3164 = 0

RFC5424

RFC5424 = 1

RFC5424e

RFC5424e = 2

Properties

$facility

$facility : 

Type

$logLevels

$logLevels : 

Translates Monolog log levels to syslog log priorities.

Type

$facilities

$facilities : 

List of valid log facility names.

Type

$processors

$processors : array<mixed,callable>

Type

array<mixed,callable>

$formatter

$formatter : \Monolog\Handler\?FormatterInterface

Type

\Monolog\Handler\?FormatterInterface

$level

$level : 

Type

$bubble

$bubble : 

Type

$socket

$socket : 

Type

$ident

$ident : 

Type

$rfc

$rfc : 

Type

$dateFormats

$dateFormats : 

Type

Methods

__construct()

__construct(string  $host, integer  $port = 514, string|integer  $facility = LOG_USER, string|integer  $level = \Monolog\Logger::DEBUG, boolean  $bubble = true, string  $ident = 'php', integer  $rfc = self::RFC5424) 

Parameters

string $host

Either IP/hostname or a path to a unix socket (port must be 0 then)

integer $port

Port number, or 0 if $host is a unix socket

string|integer $facility

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

string|integer $level

The minimum logging level at which this handler will be triggered

boolean $bubble

Whether the messages that are handled can bubble up the stack or not

string $ident

Program name or tag for each log message.

integer $rfc

RFC to format the message for.

handle()

handle(array  $record) 

{@inheritdoc}

Parameters

array $record

reset()

reset() : void

pushProcessor()

pushProcessor(callable  $callback) 

{@inheritdoc}

Parameters

callable $callback

popProcessor()

popProcessor() 

{@inheritdoc}

getFormatter()

getFormatter() 

{@inheritdoc}

isHandling()

isHandling(array  $record) 

{@inheritdoc}

Parameters

array $record

setLevel()

setLevel(integer|string  $level) : self

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

Parameters

integer|string $level

Level or level name

Returns

self

getLevel()

getLevel() : integer

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

Returns

integer

setBubble()

setBubble(boolean  $bubble) : self

Sets the bubbling behavior.

Parameters

boolean $bubble

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

Returns

self

getBubble()

getBubble() : boolean

Gets the bubbling behavior.

Returns

boolean —

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

handleBatch()

handleBatch(array  $records) 

Handles a set of records at once.

Parameters

array $records

The records to handle (an array of record arrays)

close()

close() 

__destruct()

__destruct() 

__sleep()

__sleep() 

setSocket()

setSocket(\Monolog\Handler\SyslogUdp\UdpSocket  $socket) 

Inject your own socket, mainly used for testing

Parameters

\Monolog\Handler\SyslogUdp\UdpSocket $socket

getDefaultFormatter()

getDefaultFormatter() 

Gets the default formatter.

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

write()

write(array  $record) 

Parameters

array $record

processRecord()

processRecord(array  $record) 

Processes a record.

Parameters

array $record

resetProcessors()

resetProcessors() 

makeCommonSyslogHeader()

makeCommonSyslogHeader(\Monolog\Handler\int  $severity, \DateTimeInterface  $datetime) 

Make common syslog header (see rfc5424 or rfc3164)

Parameters

\Monolog\Handler\int $severity
\DateTimeInterface $datetime

splitMessageIntoLines()

splitMessageIntoLines(  $message) 

Parameters

$message