\Monolog\HandlerSyslogUdpHandler

A Handler for logging to a remote syslogd server.

Classes extending it should (in most cases) only implement write($record)

Summary

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

Properties

$facility

$facility : 

Type

$logLevels

$logLevels : 

Translates Monolog log levels to syslog log priorities.

Type

$facilities

$facilities : 

List of valid log facility names.

Type

$level

$level : 

Type

$bubble

$bubble : 

Type

$processors

$processors : 

Type

$socket

$socket : 

Type

$ident

$ident : 

Type

Methods

__construct()

__construct(string  $host, integer  $port = 514, mixed  $facility = LOG_USER, integer  $level = \Monolog\Logger::DEBUG, Boolean  $bubble = true, string  $ident = 'php') 

Parameters

string $host
integer $port
mixed $facility
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.

handle()

handle(array  $record) 

{@inheritdoc}

Parameters

array $record

isHandling()

isHandling(array  $record) : Boolean

Checks whether the given record will be handled by this handler.

This is mostly done for performance reasons, to avoid calling processors for nothing.

Handlers should still check the record levels within handle(), returning false in isHandling() is no guarantee that handle() will not be called, and isHandling() might not be called for a given record.

Parameters

array $record

Partial log record containing only a level key

Returns

Boolean

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() 

pushProcessor()

pushProcessor(callable  $callback) : self

Adds a processor in the stack.

Parameters

callable $callback

Returns

self

popProcessor()

popProcessor() : callable

Removes the processor on top of the stack and returns it.

Returns

callable

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.

__destruct()

__destruct() 

setSocket()

setSocket(  $socket) 

Inject your own socket, mainly used for testing

Parameters

$socket

write()

write(array  $record) 

Parameters

array $record

processRecord()

processRecord(array  $record) : array

Processes a record.

Parameters

array $record

Returns

array

makeCommonSyslogHeader()

makeCommonSyslogHeader(  $severity) 

Make common syslog header (see rfc5424)

Parameters

$severity

getDateTime()

getDateTime() 

splitMessageIntoLines()

splitMessageIntoLines(  $message) 

Parameters

$message