Properties

$level

$level : 

Type

$bubble

$bubble : 

Type

$processors

$processors : 

Type

$logToken

$logToken : string

Type

string

$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

__construct()

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

Parameters

string $token

Log token supplied by LogEntries

boolean $useSSL

Whether or not SSL encryption should be used.

integer $level

The minimum logging level to trigger this handler

boolean $bubble

Whether or not messages that are handled should bubble up the stack.

Throws

\Monolog\Handler\MissingExtensionException

If SSL encryption is set to true and OpenSSL is missing

close()

close() 

Closes the handler.

This will be called automatically when the object is destroyed

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

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)

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

write()

write(array  $record) : void

Writes the record down to the log of the implementing handler

Parameters

array $record

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(array  $record) : string

Parameters

array $record

Returns

string

getResource()

getResource() : resource|null

Returns

resource|null

processRecord()

processRecord(array  $record) : array

Processes a record.

Parameters

array $record

Returns

array

validateTimeout()

validateTimeout(  $value) 

Parameters

$value

connectIfNotConnected()

connectIfNotConnected() 

connect()

connect() 

createSocketResource()

createSocketResource() 

setSocketTimeout()

setSocketTimeout() 

writeToSocket()

writeToSocket(  $data) 

Parameters

$data

writingIsTimedOut()

writingIsTimedOut(  $sent) 

Parameters

$sent