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
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
$bubble
protected
mixed
$bubble
= true
$formatter
protected
FormatterInterface
$formatter
$level
protected
mixed
$level
= \Monolog\Logger::DEBUG
$processors
protected
mixed
$processors
= array()
$records
protected
mixed
$records
= array()
$recordsByLevel
protected
mixed
$recordsByLevel
= array()
$skipReset
private
mixed
$skipReset
= false
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
__destruct()
public
__destruct() : mixed
clear()
public
clear() : mixed
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.
getFormatter()
Gets the formatter.
public
getFormatter() : FormatterInterface
Return values
FormatterInterfacegetLevel()
Gets minimum logging level at which this handler will be triggered.
public
getLevel() : int
Return values
intgetRecords()
public
getRecords() : mixed
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
boolhasAlertRecords()
public
hasAlertRecords() : bool
Return values
boolhasAlertThatContains()
public
hasAlertThatContains(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasAlertThatMatches()
public
hasAlertThatMatches(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasAlertThatPasses()
public
hasAlertThatPasses(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasCritical()
public
hasCritical(mixed $record) : bool
Parameters
- $record : mixed
Return values
boolhasCriticalRecords()
public
hasCriticalRecords() : bool
Return values
boolhasCriticalThatContains()
public
hasCriticalThatContains(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasCriticalThatMatches()
public
hasCriticalThatMatches(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasCriticalThatPasses()
public
hasCriticalThatPasses(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasDebug()
public
hasDebug(mixed $record) : bool
Parameters
- $record : mixed
Return values
boolhasDebugRecords()
public
hasDebugRecords() : bool
Return values
boolhasDebugThatContains()
public
hasDebugThatContains(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasDebugThatMatches()
public
hasDebugThatMatches(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasDebugThatPasses()
public
hasDebugThatPasses(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasEmergency()
public
hasEmergency(mixed $record) : bool
Parameters
- $record : mixed
Return values
boolhasEmergencyRecords()
public
hasEmergencyRecords() : bool
Return values
boolhasEmergencyThatContains()
public
hasEmergencyThatContains(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasEmergencyThatMatches()
public
hasEmergencyThatMatches(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasEmergencyThatPasses()
public
hasEmergencyThatPasses(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasError()
public
hasError(mixed $record) : bool
Parameters
- $record : mixed
Return values
boolhasErrorRecords()
public
hasErrorRecords() : bool
Return values
boolhasErrorThatContains()
public
hasErrorThatContains(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasErrorThatMatches()
public
hasErrorThatMatches(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasErrorThatPasses()
public
hasErrorThatPasses(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasInfo()
public
hasInfo(mixed $record) : bool
Parameters
- $record : mixed
Return values
boolhasInfoRecords()
public
hasInfoRecords() : bool
Return values
boolhasInfoThatContains()
public
hasInfoThatContains(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasInfoThatMatches()
public
hasInfoThatMatches(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasInfoThatPasses()
public
hasInfoThatPasses(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasNotice()
public
hasNotice(mixed $record) : bool
Parameters
- $record : mixed
Return values
boolhasNoticeRecords()
public
hasNoticeRecords() : bool
Return values
boolhasNoticeThatContains()
public
hasNoticeThatContains(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasNoticeThatMatches()
public
hasNoticeThatMatches(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasNoticeThatPasses()
public
hasNoticeThatPasses(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasRecord()
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
boolhasWarningRecords()
public
hasWarningRecords() : bool
Return values
boolhasWarningThatContains()
public
hasWarningThatContains(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasWarningThatMatches()
public
hasWarningThatMatches(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolhasWarningThatPasses()
public
hasWarningThatPasses(mixed $message) : bool
Parameters
- $message : mixed
Return values
boolisHandling()
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
boolpopProcessor()
Removes the processor on top of the stack and returns it.
public
popProcessor() : callable
Return values
callablepushProcessor()
Adds a processor in the stack.
public
pushProcessor(mixed $callback) : self
Parameters
- $callback : mixed
Return values
selfreset()
public
reset() : mixed
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
selfsetFormatter()
Sets the formatter.
public
setFormatter(FormatterInterface $formatter) : self
Parameters
- $formatter : FormatterInterface
Return values
selfsetLevel()
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
selfsetSkipReset()
public
setSkipReset(mixed $skipReset) : mixed
Parameters
- $skipReset : mixed
getDefaultFormatter()
Gets the default formatter.
protected
getDefaultFormatter() : FormatterInterface
Return values
FormatterInterfaceprocessRecord()
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>