Properties

$processors

$processors : callable[]

Type

callable[]

$formatter

$formatter : ?\Monolog\Formatter\FormatterInterface

Type

FormatterInterface

$level

$level : int

Type

int

$bubble

$bubble : bool

Type

bool

$apiToken

$apiToken : string

Type

string

$connectionString

$connectionString : string

Type

string

$connectionTimeout

$connectionTimeout : float

Type

float

$timeout

$timeout : float

Type

float

$writingTimeout

$writingTimeout : float

Type

float

$lastSentBytes

$lastSentBytes : ?int

Type

?int

$chunkSize

$chunkSize : ?int

Type

?int

$persistent

$persistent : bool

Type

bool

$errno

$errno : ?int

Type

?int

$errstr

$errstr : ?string

Type

?string

$lastWritingAt

$lastWritingAt : ?float

Type

?float

Methods

__construct()

__construct(string  $apiToken, mixed  $level = Logger::DEBUG, bool  $bubble = true, bool  $persistent = false, float  $timeout = 0.0, float  $writingTimeout = 10.0, ?float  $connectionTimeout = null, ?int  $chunkSize = null) : mixed

Parameters

string $apiToken
mixed $level
bool $bubble
bool $persistent

Flag to enable/disable persistent connections

float $timeout

Socket timeout to wait until the request is being aborted

float $writingTimeout

Socket timeout to wait until the request should've been sent/written

?float $connectionTimeout

Socket connect timeout to wait until the connection should've been established

?int $chunkSize

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

Throws

\Monolog\Handler\MissingExtensionException

if OpenSSL is missing

Returns

mixed —

close()

close() : void

Closes the handler.

closeSocket()

closeSocket() : void

Close socket, if open

setPersistent()

setPersistent(bool  $persistent) : self

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

Parameters

bool $persistent

Returns

self —

setConnectionTimeout()

setConnectionTimeout(float  $seconds) : self

Set connection timeout. Only has effect before we connect.

Parameters

float $seconds

Returns

self —

setTimeout()

setTimeout(float  $seconds) : self

Set write timeout. Only has effect before we connect.

Parameters

float $seconds

Returns

self —

setWritingTimeout()

setWritingTimeout(float  $seconds) : self

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

Parameters

float $seconds

0 for no timeout

Returns

self —

setChunkSize()

setChunkSize(int  $bytes) : self

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

Parameters

int $bytes

Returns

self —

getConnectionString()

getConnectionString() : string

Get current connection string

Returns

string —

isPersistent()

isPersistent() : bool

Get persistent setting

Returns

bool —

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 —

getChunkSize()

getChunkSize() : ?int

Get current chunk size

Returns

?int —

isConnected()

isConnected() : bool

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

bool —

handle()

handle(array  $record) : bool

{@inheritDoc}

Parameters

array $record

Returns

bool —

reset()

reset() : void

pushProcessor()

pushProcessor(callable  $callback) : \Monolog\Handler\HandlerInterface

{@inheritDoc}

Parameters

callable $callback

Returns

\Monolog\Handler\HandlerInterface —

popProcessor()

popProcessor() : callable

{@inheritDoc}

Returns

callable —

setFormatter()

setFormatter(\Monolog\Formatter\FormatterInterface  $formatter) : \Monolog\Handler\HandlerInterface

{@inheritDoc}

Parameters

\Monolog\Formatter\FormatterInterface $formatter

Returns

\Monolog\Handler\HandlerInterface —

getFormatter()

getFormatter() : \Monolog\Formatter\FormatterInterface

{@inheritDoc}

Returns

\Monolog\Formatter\FormatterInterface —

isHandling()

isHandling(array  $record) : bool

{@inheritDoc}

Parameters

array $record

Returns

bool —

setLevel()

setLevel(mixed  $level) : self

Sets minimum logging level at which this handler will be triggered.

Parameters

mixed $level

Returns

self —

getLevel()

getLevel() : int

Gets minimum logging level at which this handler will be triggered.

Returns

int —

setBubble()

setBubble(bool  $bubble) : self

Sets the bubbling behavior.

Parameters

bool $bubble

true means that this handler allows bubbling. false means that bubbling is not permitted.

Returns

self —

getBubble()

getBubble() : bool

Gets the bubbling behavior.

Returns

bool —

true means that this handler allows bubbling. false means that bubbling is not permitted.

handleBatch()

handleBatch(array  $records) : void

Handles a set of records at once.

Parameters

array $records

The records to handle (an array of record arrays)

__destruct()

__destruct() : mixed

Returns

mixed —

__sleep()

__sleep() : mixed

Returns

mixed —

write()

write(array  $record) : void

Connect (if necessary) and write to the socket

Parameters

array $record

pfsockopen()

pfsockopen() : resource|false

Wrapper to allow mocking

Returns

resource|false —

fsockopen()

fsockopen() : resource|false

Wrapper to allow mocking

Returns

resource|false —

streamSetTimeout()

streamSetTimeout() : bool

Wrapper to allow mocking

Returns

bool —

streamSetChunkSize()

streamSetChunkSize() : int|bool

Wrapper to allow mocking

Returns

int|bool —

fwrite()

fwrite(string  $data) : int|bool

Wrapper to allow mocking

Parameters

string $data

Returns

int|bool —

streamGetMetadata()

streamGetMetadata() : array|bool

Wrapper to allow mocking

Returns

array|bool —

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 —

resetProcessors()

resetProcessors() : void

getDefaultFormatter()

getDefaultFormatter() : \Monolog\Formatter\FormatterInterface

Gets the default formatter.

Returns

\Monolog\Formatter\FormatterInterface —

validateTimeout()

validateTimeout(float  $value) : void

Parameters

float $value

connectIfNotConnected()

connectIfNotConnected() : void

connect()

connect() : void

createSocketResource()

createSocketResource() : void

setSocketTimeout()

setSocketTimeout() : void

setStreamChunkSize()

setStreamChunkSize() : void

writeToSocket()

writeToSocket(string  $data) : void

Parameters

string $data

writingIsTimedOut()

writingIsTimedOut(int  $sent) : bool

Parameters

int $sent

Returns

bool —

buildContent()

buildContent(array  $record) : string

Builds the body of API call

Parameters

array $record

Returns

string —

buildHeader()

buildHeader(string  $content) : string

Builds the header of the API Call

Parameters

string $content

Returns

string —