ConsoleBackend
class ConsoleBackend extends AbstractBackend (View source)
A log backend which writes log entries to the console (STDOUT or STDERR)
Properties
protected int | $severityThreshold | One of the LOG_* constants. Anything below that will be filtered out. |
from AbstractBackend |
protected bool | $logIpAddress | Flag telling if the IP address of the current client (if available) should be logged. |
from AbstractBackend |
protected array | $severityLabels | An array of severity labels, indexed by their integer constant |
|
protected string | $streamName | Stream name to use (stdout, stderr) |
|
protected resource | $streamHandle |
Methods
The maximum severity to log, anything less severe will not be logged.
Enables or disables logging of IP addresses.
Carries out all actions necessary to prepare the logging backend, such as opening the log file or opening a database connection.
Appends the given message along with the additional information into the log.
Carries out all actions necessary to cleanly close the logging backend, such as closing the log file or disconnecting from a database.
Details
__construct(mixed $options = [])
Constructs this log backend
void
setSeverityThreshold(int $severityThreshold)
The maximum severity to log, anything less severe will not be logged.
void
setLogIpAddress(bool $logIpAddress)
Enables or disables logging of IP addresses.
void
open()
Carries out all actions necessary to prepare the logging backend, such as opening the log file or opening a database connection.
void
append(string $message, int $severity = LOG_INFO, mixed $additionalData = null, string $packageKey = null, string $className = null, string $methodName = null)
Appends the given message along with the additional information into the log.
void
close()
Carries out all actions necessary to cleanly close the logging backend, such as closing the log file or disconnecting from a database.
Note: for this backend we do nothing here and rely on PHP to close the stream handle when the request ends. This is to allow full logging until request end.