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

$apiToken

$apiToken : string

Type

string

$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

__construct()

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

Parameters

\Monolog\Handler\string $apiToken
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

Throws

\Monolog\Handler\MissingExtensionException

if OpenSSL is missing

close()

close() 

Closes the handler.

Ends a log cycle and frees all resources used by the handler.

Closing a Handler means flushing all buffers and freeing any open resources/handles.

Implementations have to be idempotent (i.e. it should be possible to call close several times without breakage) and ideally handlers should be able to reopen themselves on handle() after they have been closed.

This is useful at the end of a request and will be called automatically when the object is destroyed if you extend Monolog\Handler\Handler.

If you are thinking of calling this method yourself, most likely you should be calling ResettableInterface::reset instead. Have a look.

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.

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}

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)

__destruct()

__destruct() 

__sleep()

__sleep() 

write()

write(array  $record) 

Connect (if necessary) and write to the socket

Parameters

array $record

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

processRecord()

processRecord(array  $record) 

Processes a record.

Parameters

array $record

resetProcessors()

resetProcessors() 

getDefaultFormatter()

getDefaultFormatter() 

Gets the default formatter.

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

buildContent()

buildContent(array  $record) 

Builds the body of API call

Parameters

array $record

buildHeader()

buildHeader(\Monolog\Handler\string  $content) 

Builds the header of the API Call

Parameters

\Monolog\Handler\string $content