Constants

RFC3164

RFC3164 = 0

RFC5424

RFC5424 = 1

RFC5424e

RFC5424e = 2

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

$socket

$socket : \Monolog\Handler\SyslogUdp\UdpSocket

Type

UdpSocket

$ident

$ident : string

Type

string

$rfc

$rfc

$dateFormats

$dateFormats

Methods

__construct()

__construct(string  $host, int  $port = 514, string|int  $facility = LOG_USER, mixed  $level = Logger::DEBUG, bool  $bubble = true, string  $ident = 'php', int  $rfc = self::RFC5424) : mixed

Parameters

string $host

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

int $port

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

string|int $facility

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

mixed $level
bool $bubble

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

string $ident

Program name or tag for each log message.

int $rfc

RFC to format the message for.

Throws

\Monolog\Handler\MissingExtensionException

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

__destruct()

__destruct() : mixed

Returns

mixed —

__sleep()

__sleep() : mixed

Returns

mixed —

setSocket()

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

Inject your own socket, mainly used for testing

Parameters

\Monolog\Handler\SyslogUdp\UdpSocket $socket

Returns

self —

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

Parameters

array $record

processRecord()

processRecord(array  $record) : array

Processes a record.

Parameters

array $record

Returns

array —

resetProcessors()

resetProcessors() : void

makeCommonSyslogHeader()

makeCommonSyslogHeader(int  $severity, \DateTimeInterface  $datetime) : string

Make common syslog header (see rfc5424 or rfc3164)

Parameters

int $severity
\DateTimeInterface $datetime

Returns

string —

splitMessageIntoLines()

splitMessageIntoLines(string|string[]  $message) : string[]

Parameters

string|string[] $message

Returns

string[] —