TestHandler
extends AbstractProcessingHandler
in package
Used for testing purposes.
It records all records and gives you access to them for verification.
Tags
Table of Contents
- $bubble : bool
- $formatter : FormatterInterface|null
- $level : int
- $processors : array<string|int, callable>
- $records : array<string|int, Record>
- $recordsByLevel : mixed
- $skipReset : bool
- __call() : bool
- __construct() : mixed
- __destruct() : mixed
- __sleep() : mixed
- clear() : void
- close() : void
- Closes the handler.
- getBubble() : bool
- Gets the bubbling behavior.
- getFormatter() : FormatterInterface
- {@inheritDoc}
- getLevel() : int
- Gets minimum logging level at which this handler will be triggered.
- getRecords() : array<string|int, mixed>
- handle() : bool
- {@inheritDoc}
- handleBatch() : void
- Handles a set of records at once.
- hasAlert() :
- hasAlertRecords() :
- hasAlertThatContains() :
- hasAlertThatMatches() :
- hasAlertThatPasses() :
- hasCritical() :
- hasCriticalRecords() :
- hasCriticalThatContains() :
- hasCriticalThatMatches() :
- hasCriticalThatPasses() :
- hasDebug() :
- hasDebugRecords() :
- hasDebugThatContains() :
- hasDebugThatMatches() :
- hasDebugThatPasses() :
- hasEmergency() :
- hasEmergencyRecords() :
- hasEmergencyThatContains() :
- hasEmergencyThatMatches() :
- hasEmergencyThatPasses() :
- hasError() :
- hasErrorRecords() :
- hasErrorThatContains() :
- hasErrorThatMatches() :
- hasErrorThatPasses() :
- hasInfo() :
- hasInfoRecords() :
- hasInfoThatContains() :
- hasInfoThatMatches() :
- hasInfoThatPasses() :
- hasNotice() :
- hasNoticeRecords() :
- hasNoticeThatContains() :
- hasNoticeThatMatches() :
- hasNoticeThatPasses() :
- hasRecord() : bool
- hasRecords() : bool
- hasRecordThatContains() : bool
- hasRecordThatMatches() : bool
- hasRecordThatPasses() : bool
- hasWarning() :
- hasWarningRecords() :
- hasWarningThatContains() :
- hasWarningThatMatches() :
- hasWarningThatPasses() :
- isHandling() : bool
- {@inheritDoc}
- popProcessor() : callable
- {@inheritDoc}
- pushProcessor() : HandlerInterface
- {@inheritDoc}
- reset() : void
- setBubble() : self
- Sets the bubbling behavior.
- setFormatter() : HandlerInterface
- {@inheritDoc}
- setLevel() : self
- Sets minimum logging level at which this handler will be triggered.
- setSkipReset() : void
- getDefaultFormatter() : FormatterInterface
- Gets the default formatter.
- processRecord() : array<string|int, mixed>
- Processes a record.
- resetProcessors() : void
- write() : void
- Writes the record down to the log of the implementing handler
Properties
$bubble
protected
bool
$bubble
= true
$formatter
protected
FormatterInterface|null
$formatter
$level
protected
int
$level
= MonologLogger::DEBUG
Tags
$processors
protected
array<string|int, callable>
$processors
= []
Tags
$records
protected
array<string|int, Record>
$records
= []
$recordsByLevel
protected
mixed
$recordsByLevel
= []
$skipReset
private
bool
$skipReset
= false
Methods
__call()
public
__call(string $method, array<string|int, mixed> $args) : bool
Parameters
- $method : string
- $args : array<string|int, mixed>
Return values
bool —__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
Tags
Return values
mixed —__destruct()
public
__destruct() : mixed
Return values
mixed —__sleep()
public
__sleep() : mixed
Return values
mixed —clear()
public
clear() : void
Return values
void —close()
Closes the handler.
public
close() : void
Return values
void —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.
getFormatter()
{@inheritDoc}
public
getFormatter() : FormatterInterface
Return values
FormatterInterface —getLevel()
Gets minimum logging level at which this handler will be triggered.
public
getLevel() : int
Tags
Return values
int —getRecords()
public
getRecords() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —handle()
{@inheritDoc}
public
handle(array<string|int, mixed> $record) : bool
Parameters
- $record : array<string|int, mixed>
Return values
bool —handleBatch()
Handles a set of records at once.
public
handleBatch(array<string|int, mixed> $records) : void
Parameters
- $records : array<string|int, mixed>
-
The records to handle (an array of record arrays)
Return values
void —hasAlert()
public
hasAlert(mixed $record) :
Parameters
- $record : mixed
Return values
—hasAlertRecords()
public
hasAlertRecords() :
Return values
—hasAlertThatContains()
public
hasAlertThatContains(mixed $message) :
Parameters
- $message : mixed
Return values
—hasAlertThatMatches()
public
hasAlertThatMatches(mixed $message) :
Parameters
- $message : mixed
Return values
—hasAlertThatPasses()
public
hasAlertThatPasses(mixed $message) :
Parameters
- $message : mixed
Return values
—hasCritical()
public
hasCritical(mixed $record) :
Parameters
- $record : mixed
Return values
—hasCriticalRecords()
public
hasCriticalRecords() :
Return values
—hasCriticalThatContains()
public
hasCriticalThatContains(mixed $message) :
Parameters
- $message : mixed
Return values
—hasCriticalThatMatches()
public
hasCriticalThatMatches(mixed $message) :
Parameters
- $message : mixed
Return values
—hasCriticalThatPasses()
public
hasCriticalThatPasses(mixed $message) :
Parameters
- $message : mixed
Return values
—hasDebug()
public
hasDebug(mixed $record) :
Parameters
- $record : mixed
Return values
—hasDebugRecords()
public
hasDebugRecords() :
Return values
—hasDebugThatContains()
public
hasDebugThatContains(mixed $message) :
Parameters
- $message : mixed
Return values
—hasDebugThatMatches()
public
hasDebugThatMatches(mixed $message) :
Parameters
- $message : mixed
Return values
—hasDebugThatPasses()
public
hasDebugThatPasses(mixed $message) :
Parameters
- $message : mixed
Return values
—hasEmergency()
public
hasEmergency(mixed $record) :
Parameters
- $record : mixed
Return values
—hasEmergencyRecords()
public
hasEmergencyRecords() :
Return values
—hasEmergencyThatContains()
public
hasEmergencyThatContains(mixed $message) :
Parameters
- $message : mixed
Return values
—hasEmergencyThatMatches()
public
hasEmergencyThatMatches(mixed $message) :
Parameters
- $message : mixed
Return values
—hasEmergencyThatPasses()
public
hasEmergencyThatPasses(mixed $message) :
Parameters
- $message : mixed
Return values
—hasError()
public
hasError(mixed $record) :
Parameters
- $record : mixed
Return values
—hasErrorRecords()
public
hasErrorRecords() :
Return values
—hasErrorThatContains()
public
hasErrorThatContains(mixed $message) :
Parameters
- $message : mixed
Return values
—hasErrorThatMatches()
public
hasErrorThatMatches(mixed $message) :
Parameters
- $message : mixed
Return values
—hasErrorThatPasses()
public
hasErrorThatPasses(mixed $message) :
Parameters
- $message : mixed
Return values
—hasInfo()
public
hasInfo(mixed $record) :
Parameters
- $record : mixed
Return values
—hasInfoRecords()
public
hasInfoRecords() :
Return values
—hasInfoThatContains()
public
hasInfoThatContains(mixed $message) :
Parameters
- $message : mixed
Return values
—hasInfoThatMatches()
public
hasInfoThatMatches(mixed $message) :
Parameters
- $message : mixed
Return values
—hasInfoThatPasses()
public
hasInfoThatPasses(mixed $message) :
Parameters
- $message : mixed
Return values
—hasNotice()
public
hasNotice(mixed $record) :
Parameters
- $record : mixed
Return values
—hasNoticeRecords()
public
hasNoticeRecords() :
Return values
—hasNoticeThatContains()
public
hasNoticeThatContains(mixed $message) :
Parameters
- $message : mixed
Return values
—hasNoticeThatMatches()
public
hasNoticeThatMatches(mixed $message) :
Parameters
- $message : mixed
Return values
—hasNoticeThatPasses()
public
hasNoticeThatPasses(mixed $message) :
Parameters
- $message : mixed
Return values
—hasRecord()
public
hasRecord(string|array<string|int, mixed> $record, string|int $level) : bool
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 : string|int
-
Logging level value or name
Tags
Return values
bool —hasRecords()
public
hasRecords(string|int $level) : bool
Parameters
- $level : string|int
-
Logging level value or name
Tags
Return values
bool —hasRecordThatContains()
public
hasRecordThatContains(string $message, string|int $level) : bool
Parameters
- $message : string
- $level : string|int
-
Logging level value or name
Tags
Return values
bool —hasRecordThatMatches()
public
hasRecordThatMatches(string $regex, string|int $level) : bool
Parameters
- $regex : string
- $level : string|int
-
Logging level value or name
Tags
Return values
bool —hasRecordThatPasses()
public
hasRecordThatPasses(callable $predicate, string|int $level) : bool
Parameters
- $predicate : callable
- $level : string|int
-
Logging level value or name
Tags
Return values
bool —hasWarning()
public
hasWarning(mixed $record) :
Parameters
- $record : mixed
Return values
—hasWarningRecords()
public
hasWarningRecords() :
Return values
—hasWarningThatContains()
public
hasWarningThatContains(mixed $message) :
Parameters
- $message : mixed
Return values
—hasWarningThatMatches()
public
hasWarningThatMatches(mixed $message) :
Parameters
- $message : mixed
Return values
—hasWarningThatPasses()
public
hasWarningThatPasses(mixed $message) :
Parameters
- $message : mixed
Return values
—isHandling()
{@inheritDoc}
public
isHandling(array<string|int, mixed> $record) : bool
Parameters
- $record : array<string|int, mixed>
Return values
bool —popProcessor()
{@inheritDoc}
public
popProcessor() : callable
Return values
callable —pushProcessor()
{@inheritDoc}
public
pushProcessor(callable $callback) : HandlerInterface
Parameters
- $callback : callable
Return values
HandlerInterface —reset()
public
reset() : void
Return values
void —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 —setFormatter()
{@inheritDoc}
public
setFormatter(FormatterInterface $formatter) : HandlerInterface
Parameters
- $formatter : FormatterInterface
Return values
HandlerInterface —setLevel()
Sets minimum logging level at which this handler will be triggered.
public
setLevel(Level|LevelName|\Psr\Log\LogLevel::* $level) : self
Parameters
- $level : Level|LevelName|\Psr\Log\LogLevel::*
-
Level or level name
Return values
self —setSkipReset()
public
setSkipReset(bool $skipReset) : void
Parameters
- $skipReset : bool
Return values
void —getDefaultFormatter()
Gets the default formatter.
protected
getDefaultFormatter() : FormatterInterface
Overwrite this if the LineFormatter is not a good default for your handler.
Return values
FormatterInterface —processRecord()
Processes a record.
protected
processRecord(array<string|int, mixed> $record) : array<string|int, mixed>
Parameters
- $record : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> —resetProcessors()
protected
resetProcessors() : void
Return values
void —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>