Properties

$level

$level : 

Type

$bubble

$bubble : 

Type

$processors

$processors : 

Type

$connectionString

$connectionString : 

Type

$connectionTimeout

$connectionTimeout : 

Type

$resource

$resource : 

Type

$timeout

$timeout : 

Type

$writingTimeout

$writingTimeout : 

Type

$lastSentBytes

$lastSentBytes : 

Type

$persistent

$persistent : 

Type

$errno

$errno : 

Type

$errstr

$errstr : 

Type

$lastWritingAt

$lastWritingAt : 

Type

Methods

handle()

handle(array  $record) 

{@inheritdoc}

Parameters

array $record

__construct()

__construct(string  $connectionString, integer  $level = \Monolog\Logger::DEBUG, Boolean  $bubble = true) 

Parameters

string $connectionString

Socket connection 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

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

We will not close a PersistentSocket instance so it can be reused in other requests.

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

closeSocket()

closeSocket() 

Close socket, if open

setPersistent()

setPersistent(boolean  $persistent) 

Set socket connection to nbe persistent. It only has effect before the connection is initiated.

Parameters

boolean $persistent

setConnectionTimeout()

setConnectionTimeout(float  $seconds) 

Set connection timeout. Only has effect before we connect.

Parameters

float $seconds

setTimeout()

setTimeout(float  $seconds) 

Set write timeout. Only has effect before we connect.

Parameters

float $seconds

setWritingTimeout()

setWritingTimeout(float  $seconds) 

Set writing timeout. Only has effect during connection in the writing cycle.

Parameters

float $seconds

0 for no timeout

getConnectionString()

getConnectionString() : string

Get current connection string

Returns

string

isPersistent()

isPersistent() : boolean

Get persistent setting

Returns

boolean

getConnectionTimeout()

getConnectionTimeout() : float

Get current connection timeout setting

Returns

float

getTimeout()

getTimeout() : float

Get current in-transfer timeout

Returns

float

getWritingTimeout()

getWritingTimeout() : float

Get current local writing timeout

Returns

float

isConnected()

isConnected() : boolean

Check to see if the socket is currently available.

UDP might appear to be connected but might fail when writing. See http://php.net/fsockopen for details.

Returns

boolean

write()

write(array  $record) : void

Connect (if necessary) and write to the socket

Parameters

array $record

Throws

\UnexpectedValueException
\RuntimeException

processRecord()

processRecord(array  $record) : array

Processes a record.

Parameters

array $record

Returns

array

pfsockopen()

pfsockopen() 

Wrapper to allow mocking

fsockopen()

fsockopen() 

Wrapper to allow mocking

streamSetTimeout()

streamSetTimeout() 

Wrapper to allow mocking

fwrite()

fwrite(  $data) 

Wrapper to allow mocking

Parameters

$data

streamGetMetadata()

streamGetMetadata() 

Wrapper to allow mocking

generateDataStream()

generateDataStream(  $record) 

Parameters

$record

getResource()

getResource() : resource|null

Returns

resource|null

validateTimeout()

validateTimeout(  $value) 

Parameters

$value

connectIfNotConnected()

connectIfNotConnected() 

connect()

connect() 

createSocketResource()

createSocketResource() 

setSocketTimeout()

setSocketTimeout() 

writeToSocket()

writeToSocket(  $data) 

Parameters

$data

writingIsTimedOut()

writingIsTimedOut(  $sent) 

Parameters

$sent