Properties

$processors

$processors : array<mixed,callable>

Type

array<mixed,callable>

$formatter

$formatter : \Monolog\Handler\?FormatterInterface

Type

\Monolog\Handler\?FormatterInterface

$level

$level : 

Type

$bubble

$bubble : 

Type

$connectionString

$connectionString : 

Type

$connectionTimeout

$connectionTimeout : 

Type

$resource

$resource : resource|null

Type

resource|null

$timeout

$timeout : float

Type

float

$writingTimeout

$writingTimeout : float

Type

float

$lastSentBytes

$lastSentBytes : 

Type

$chunkSize

$chunkSize : integer

Type

integer

$persistent

$persistent : 

Type

$errno

$errno : 

Type

$errstr

$errstr : 

Type

$lastWritingAt

$lastWritingAt : \Monolog\Handler\?float

Type

\Monolog\Handler\?float

Methods

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}

__construct()

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

Parameters

string $connectionString

Socket connection string

integer|string $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) 

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

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

__destruct()

__destruct() 

__sleep()

__sleep() 

closeSocket()

closeSocket() 

Close socket, if open

setPersistent()

setPersistent(\Monolog\Handler\bool  $persistent) 

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

Parameters

\Monolog\Handler\bool $persistent

setConnectionTimeout()

setConnectionTimeout(\Monolog\Handler\float  $seconds) 

Set connection timeout. Only has effect before we connect.

Parameters

\Monolog\Handler\float $seconds

setTimeout()

setTimeout(\Monolog\Handler\float  $seconds) 

Set write timeout. Only has effect before we connect.

Parameters

\Monolog\Handler\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

setChunkSize()

setChunkSize(\Monolog\Handler\int  $bytes) 

Set chunk size. Only has effect during connection in the writing cycle.

Parameters

\Monolog\Handler\int $bytes

getConnectionString()

getConnectionString() 

Get current connection string

isPersistent()

isPersistent() 

Get persistent setting

getConnectionTimeout()

getConnectionTimeout() 

Get current connection timeout setting

getTimeout()

getTimeout() 

Get current in-transfer timeout

getWritingTimeout()

getWritingTimeout() : float

Get current local writing timeout

Returns

float

getChunkSize()

getChunkSize() 

Get current chunk size

isConnected()

isConnected() 

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.

write()

write(array  $record) 

Connect (if necessary) and write to the socket

Parameters

array $record

Throws

\UnexpectedValueException
\RuntimeException

processRecord()

processRecord(array  $record) 

Processes a record.

Parameters

array $record

resetProcessors()

resetProcessors() 

getDefaultFormatter()

getDefaultFormatter() 

Gets the default formatter.

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

pfsockopen()

pfsockopen() 

Wrapper to allow mocking

fsockopen()

fsockopen() 

Wrapper to allow mocking

streamSetTimeout()

streamSetTimeout() 

Wrapper to allow mocking

streamSetChunkSize()

streamSetChunkSize() 

Wrapper to allow mocking

fwrite()

fwrite(  $data) 

Wrapper to allow mocking

Parameters

$data

streamGetMetadata()

streamGetMetadata() 

Wrapper to allow mocking

generateDataStream()

generateDataStream(array  $record) 

Parameters

array $record

getResource()

getResource() : resource|null

Returns

resource|null

validateTimeout()

validateTimeout(  $value) 

Parameters

$value

connectIfNotConnected()

connectIfNotConnected() 

connect()

connect() 

createSocketResource()

createSocketResource() 

setSocketTimeout()

setSocketTimeout() 

setStreamChunkSize()

setStreamChunkSize() 

writeToSocket()

writeToSocket(\Monolog\Handler\string  $data) 

Parameters

\Monolog\Handler\string $data

writingIsTimedOut()

writingIsTimedOut(\Monolog\Handler\int  $sent) 

Parameters

\Monolog\Handler\int $sent