Analyzing class Alexya\Logger\AbstractLogger
Description
Alexya's Abstract Logger.
Base class for all PSR compatible loggers.
The constructor accepts as parameter a string being the format that each log message will have and an array with the log levels that the logger can log.
All classes that extends this must implement the _write
method that accepts as parameter
the string to log, this method will write the log message to whatever the child class wants.
The method log
performs the actual logging and accepts as parameter the log level
(see \Psr\Log\LogLevel
for a list of possible values) and the string to log.
There are also 8 methods for logging in a specific category:
emergency
alert
critical
error
warning
notice
info
debug
All of them accepts as parameter the last 2 parameters of the log
method.
Example:
class Logger extends AbstractLogger
{
private function _write(string $message)
{
echo $message;
}
}
$logger = new Logger();
$logger->debug("test"); // test
$logger->debug("{LEVEL}: {MESSAGE}", [
"MESSAGE" => "test"
]); // debug: test
Type hierarchy
-
alexya-framework/logger dev-master 3.0.5
-
alexya-framework/logger dev-master 3.0.5
-
alexya-framework/logger dev-master 3.0.5
-