ErrorlogHandler
extends BaseHandler
in package
Log handler that writes to PHP's `error_log()`
Tags
Table of Contents
Constants
- TYPE_OS = 0
- Message is sent to PHP's system logger, using the Operating System's system logging mechanism or a file, depending on what the error_log configuration directive is set to.
- TYPE_SAPI = 4
- Message is sent directly to the SAPI logging handler.
Properties
- $dateFormat : string
- Date format for logging
- $handles : array<string|int, mixed>
- Handles
- $messageType : int
- Says where the error should go. Currently supported are 0 (`TYPE_OS`) and 4 (`TYPE_SAPI`).
Methods
- __construct() : mixed
- Constructor.
- canHandle() : bool
- Checks whether the Handler will handle logging items of this log Level.
- handle() : bool
- Handles logging the message.
- setDateFormat() : HandlerInterface
- Stores the date format to use while logging messages.
- errorLog() : bool
- Extracted call to `error_log()` in order to be tested.
Constants
TYPE_OS
Message is sent to PHP's system logger, using the Operating System's system logging mechanism or a file, depending on what the error_log configuration directive is set to.
public
mixed
TYPE_OS
= 0
TYPE_SAPI
Message is sent directly to the SAPI logging handler.
public
mixed
TYPE_SAPI
= 4
Properties
$dateFormat
Date format for logging
protected
string
$dateFormat
= 'Y-m-d H:i:s'
$handles
Handles
protected
array<string|int, mixed>
$handles
$messageType
Says where the error should go. Currently supported are 0 (`TYPE_OS`) and 4 (`TYPE_SAPI`).
protected
int
$messageType
= 0
Methods
__construct()
Constructor.
public
__construct([array<int, mixed> $config = [] ]) : mixed
Parameters
- $config : array<int, mixed> = []
canHandle()
Checks whether the Handler will handle logging items of this log Level.
public
canHandle(string $level) : bool
Parameters
- $level : string
Return values
boolhandle()
Handles logging the message.
public
handle(string $level, string $message) : bool
If the handler returns false, then execution of handlers will stop. Any handlers that have not run, yet, will not be run.
Parameters
- $level : string
- $message : string
Return values
boolsetDateFormat()
Stores the date format to use while logging messages.
public
setDateFormat(string $format) : HandlerInterface
Parameters
- $format : string
Return values
HandlerInterfaceerrorLog()
Extracted call to `error_log()` in order to be tested.
protected
errorLog(string $message, int $messageType) : bool
Parameters
- $message : string
- $messageType : int