Constants

DESCRIPTOR_SPEC

DESCRIPTOR_SPEC = [
    0 => ['pipe', 'r'],
    // STDIN is a pipe that the child will read from
    1 => ['pipe', 'w'],
    // STDOUT is a pipe that the child will write to
    2 => ['pipe', 'w'],
] : array<int,string[]>

Properties

$processors

$processors : callable[]

Type

callable[]

$formatter

$formatter : ?\Monolog\Formatter\FormatterInterface

Type

FormatterInterface

$level

$level : int

Type

int

$bubble

$bubble : bool

Type

bool

$process

$process : resource|bool|null

Holds the process to receive data on its STDIN.

Type

resource|bool|null

$command

$command : string

Type

string

Methods

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 —

__construct()

__construct(string  $command, mixed  $level = Logger::DEBUG, bool  $bubble = true, string|null  $cwd = null) : mixed

Parameters

string $command

Command for the process to start. Absolute paths are recommended, especially if you do not use the $cwd parameter.

mixed $level
bool $bubble
string|null $cwd

"Current working directory" (CWD) for the process to be executed in.

Throws

\InvalidArgumentException

Returns

mixed —

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)

close()

close() : void

{@inheritDoc}

__destruct()

__destruct() : mixed

Returns

mixed —

__sleep()

__sleep() : mixed

Returns

mixed —

write()

write(array  $record) : void

Writes the record down to the log of the implementing handler

Parameters

array $record

Throws

\UnexpectedValueException

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.

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

Returns

\Monolog\Formatter\FormatterInterface —

selectErrorStream()

selectErrorStream() : int|bool

Selects the STDERR stream.

Returns

int|bool —

readProcessErrors()

readProcessErrors() : string

Reads the errors of the process, if there are any.

Returns

string —

Empty string if there are no errors.

writeProcessInput()

writeProcessInput(string  $string) : void

Writes to the input stream of the opened process.

Parameters

string $string

ensureProcessIsStarted()

ensureProcessIsStarted() : void

Makes sure that the process is actually started, and if not, starts it, assigns the stream pipes, and handles startup errors, if any.

startProcess()

startProcess() : void

Starts the actual process and sets all streams to non-blocking.

handleStartupErrors()

handleStartupErrors() : void

Selects the STDERR stream, handles upcoming startup errors, and throws an exception, if any.

Throws

\UnexpectedValueException