Documentation

TestHandler extends AbstractProcessingHandler
in package

Used for testing purposes.

It records all records and gives you access to them for verification.

Tags
author

Jordi Boggiano j.boggiano@seld.be

Table of Contents

Properties

$bubble  : mixed
$formatter  : FormatterInterface
$level  : mixed
$processors  : mixed
$records  : mixed
$recordsByLevel  : mixed
$skipReset  : mixed

Methods

__call()  : mixed
__construct()  : mixed
__destruct()  : mixed
clear()  : mixed
close()  : mixed
Closes the handler.
getBubble()  : bool
Gets the bubbling behavior.
getFormatter()  : FormatterInterface
Gets the formatter.
getLevel()  : int
Gets minimum logging level at which this handler will be triggered.
getRecords()  : mixed
handle()  : bool
Handles a record.
handleBatch()  : mixed
Handles a set of records at once.
hasAlert()  : bool
hasAlertRecords()  : bool
hasAlertThatContains()  : bool
hasAlertThatMatches()  : bool
hasAlertThatPasses()  : bool
hasCritical()  : bool
hasCriticalRecords()  : bool
hasCriticalThatContains()  : bool
hasCriticalThatMatches()  : bool
hasCriticalThatPasses()  : bool
hasDebug()  : bool
hasDebugRecords()  : bool
hasDebugThatContains()  : bool
hasDebugThatMatches()  : bool
hasDebugThatPasses()  : bool
hasEmergency()  : bool
hasEmergencyRecords()  : bool
hasEmergencyThatContains()  : bool
hasEmergencyThatMatches()  : bool
hasEmergencyThatPasses()  : bool
hasError()  : bool
hasErrorRecords()  : bool
hasErrorThatContains()  : bool
hasErrorThatMatches()  : bool
hasErrorThatPasses()  : bool
hasInfo()  : bool
hasInfoRecords()  : bool
hasInfoThatContains()  : bool
hasInfoThatMatches()  : bool
hasInfoThatPasses()  : bool
hasNotice()  : bool
hasNoticeRecords()  : bool
hasNoticeThatContains()  : bool
hasNoticeThatMatches()  : bool
hasNoticeThatPasses()  : bool
hasRecord()  : mixed
hasRecords()  : mixed
hasRecordThatContains()  : mixed
hasRecordThatMatches()  : mixed
hasRecordThatPasses()  : mixed
hasWarning()  : bool
hasWarningRecords()  : bool
hasWarningThatContains()  : bool
hasWarningThatMatches()  : bool
hasWarningThatPasses()  : bool
isHandling()  : bool
Checks whether the given record will be handled by this handler.
popProcessor()  : callable
Removes the processor on top of the stack and returns it.
pushProcessor()  : self
Adds a processor in the stack.
reset()  : mixed
setBubble()  : self
Sets the bubbling behavior.
setFormatter()  : self
Sets the formatter.
setLevel()  : self
Sets minimum logging level at which this handler will be triggered.
setSkipReset()  : mixed
getDefaultFormatter()  : FormatterInterface
Gets the default formatter.
processRecord()  : array<string|int, mixed>
Processes a record.
write()  : void
Writes the record down to the log of the implementing handler

Properties

$recordsByLevel

protected mixed $recordsByLevel = array()

Methods

__call()

public __call(mixed $method, mixed $args) : mixed
Parameters
$method : mixed
$args : mixed

__construct()

public __construct([int|string $level = Logger::DEBUG ][, bool $bubble = true ]) : mixed
Parameters
$level : int|string = Logger::DEBUG

The minimum logging level at which this handler will be triggered

$bubble : bool = true

Whether the messages that are handled can bubble up the stack or not

close()

Closes the handler.

public close() : mixed

This will be called automatically when the object is destroyed

getBubble()

Gets the bubbling behavior.

public getBubble() : bool
Return values
bool

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

getLevel()

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

public getLevel() : int
Return values
int

handle()

Handles a record.

public handle(array<string|int, mixed> $record) : bool
Parameters
$record : array<string|int, mixed>

The record to handle

Return values
bool

true means that this handler handled the record, and that bubbling is not permitted. false means the record was either not processed or that this handler allows bubbling.

handleBatch()

Handles a set of records at once.

public handleBatch(array<string|int, mixed> $records) : mixed
Parameters
$records : array<string|int, mixed>

The records to handle (an array of record arrays)

hasAlert()

public hasAlert(mixed $record) : bool
Parameters
$record : mixed
Return values
bool

hasAlertRecords()

public hasAlertRecords() : bool
Return values
bool

hasAlertThatContains()

public hasAlertThatContains(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasAlertThatMatches()

public hasAlertThatMatches(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasAlertThatPasses()

public hasAlertThatPasses(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasCritical()

public hasCritical(mixed $record) : bool
Parameters
$record : mixed
Return values
bool

hasCriticalRecords()

public hasCriticalRecords() : bool
Return values
bool

hasCriticalThatContains()

public hasCriticalThatContains(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasCriticalThatMatches()

public hasCriticalThatMatches(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasCriticalThatPasses()

public hasCriticalThatPasses(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasDebug()

public hasDebug(mixed $record) : bool
Parameters
$record : mixed
Return values
bool

hasDebugRecords()

public hasDebugRecords() : bool
Return values
bool

hasDebugThatContains()

public hasDebugThatContains(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasDebugThatMatches()

public hasDebugThatMatches(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasDebugThatPasses()

public hasDebugThatPasses(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasEmergency()

public hasEmergency(mixed $record) : bool
Parameters
$record : mixed
Return values
bool

hasEmergencyRecords()

public hasEmergencyRecords() : bool
Return values
bool

hasEmergencyThatContains()

public hasEmergencyThatContains(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasEmergencyThatMatches()

public hasEmergencyThatMatches(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasEmergencyThatPasses()

public hasEmergencyThatPasses(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasError()

public hasError(mixed $record) : bool
Parameters
$record : mixed
Return values
bool

hasErrorRecords()

public hasErrorRecords() : bool
Return values
bool

hasErrorThatContains()

public hasErrorThatContains(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasErrorThatMatches()

public hasErrorThatMatches(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasErrorThatPasses()

public hasErrorThatPasses(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasInfo()

public hasInfo(mixed $record) : bool
Parameters
$record : mixed
Return values
bool

hasInfoRecords()

public hasInfoRecords() : bool
Return values
bool

hasInfoThatContains()

public hasInfoThatContains(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasInfoThatMatches()

public hasInfoThatMatches(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasInfoThatPasses()

public hasInfoThatPasses(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasNotice()

public hasNotice(mixed $record) : bool
Parameters
$record : mixed
Return values
bool

hasNoticeRecords()

public hasNoticeRecords() : bool
Return values
bool

hasNoticeThatContains()

public hasNoticeThatContains(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasNoticeThatMatches()

public hasNoticeThatMatches(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasNoticeThatPasses()

public hasNoticeThatPasses(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasRecord()

public hasRecord(string|array<string|int, mixed> $record, int $level) : mixed
Parameters
$record : string|array<string|int, mixed>

Either a message string or an array containing message and optionally context keys that will be checked against all records

$level : int

Logger::LEVEL constant value

hasRecords()

public hasRecords(mixed $level) : mixed
Parameters
$level : mixed

hasRecordThatContains()

public hasRecordThatContains(mixed $message, mixed $level) : mixed
Parameters
$message : mixed
$level : mixed

hasRecordThatMatches()

public hasRecordThatMatches(mixed $regex, mixed $level) : mixed
Parameters
$regex : mixed
$level : mixed

hasRecordThatPasses()

public hasRecordThatPasses(mixed $predicate, mixed $level) : mixed
Parameters
$predicate : mixed
$level : mixed

hasWarning()

public hasWarning(mixed $record) : bool
Parameters
$record : mixed
Return values
bool

hasWarningRecords()

public hasWarningRecords() : bool
Return values
bool

hasWarningThatContains()

public hasWarningThatContains(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasWarningThatMatches()

public hasWarningThatMatches(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

hasWarningThatPasses()

public hasWarningThatPasses(mixed $message) : bool
Parameters
$message : mixed
Return values
bool

isHandling()

Checks whether the given record will be handled by this handler.

public isHandling(array<string|int, mixed> $record) : bool
Parameters
$record : array<string|int, mixed>

Partial log record containing only a level key

Return values
bool

popProcessor()

Removes the processor on top of the stack and returns it.

public popProcessor() : callable
Return values
callable

pushProcessor()

Adds a processor in the stack.

public pushProcessor(mixed $callback) : self
Parameters
$callback : mixed
Return values
self

setBubble()

Sets the bubbling behavior.

public setBubble(bool $bubble) : self
Parameters
$bubble : bool

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

Return values
self

setLevel()

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

public setLevel(int|string $level) : self
Parameters
$level : int|string

Level or level name

Return values
self

setSkipReset()

public setSkipReset(mixed $skipReset) : mixed
Parameters
$skipReset : mixed

processRecord()

Processes a record.

protected processRecord(array<string|int, mixed> $record) : array<string|int, mixed>
Parameters
$record : array<string|int, mixed>
Return values
array<string|int, mixed>

write()

Writes the record down to the log of the implementing handler

protected write(array<string|int, mixed> $record) : void
Parameters
$record : array<string|int, mixed>

        
On this page

Search results