Class AbstractLogger - Stefanius67/XLogger GitHub Wiki

Full name:     \Psr\Log\AbstractLogger
Implements:    \Psr\Log\LoggerInterface
This is an abstract class that cannot be instantiated directly


This is a simple Logger implementation that other Loggers can inherit from.

It simply delegates all log-level-specific methods to the log method to reduce boilerplate code that a simple Logger that does the same thing with messages regardless of the error level has to implement.

Overview

Method Description
alert Action must be taken immediately.
critical Critical conditions.
debug Detailed debug information.
emergency System is unusable.
error Runtime errors that do not require immediate action but should typically be logged and monitored.
info Interesting events.
notice Normal but significant events.
warning Exceptional occurrences that are not errors.

Methods

alert

Action must be taken immediately.

public AbstractLogger::alert(string $message, array $context = array()) : void

Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.

Parameters:

Parameter Type Description
message string
context array

go to top(#abstractlogger)


critical

Critical conditions.

public AbstractLogger::critical(string $message, array $context = array()) : void

Example: Application component unavailable, unexpected exception.

Parameters:

Parameter Type Description
message string
context array

go to top(#abstractlogger)


debug

Detailed debug information.

public AbstractLogger::debug(string $message, array $context = array()) : void

Parameters:

Parameter Type Description
message string
context array

go to top(#abstractlogger)


emergency

System is unusable.

public AbstractLogger::emergency(string $message, array $context = array()) : void

Parameters:

Parameter Type Description
message string
context array

go to top(#abstractlogger)


error

Runtime errors that do not require immediate action but should typically be logged and monitored.

public AbstractLogger::error(string $message, array $context = array()) : void

Parameters:

Parameter Type Description
message string
context array

go to top(#abstractlogger)


info

Interesting events.

public AbstractLogger::info(string $message, array $context = array()) : void

Example: User logs in, SQL logs.

Parameters:

Parameter Type Description
message string
context array

go to top(#abstractlogger)


notice

Normal but significant events.

public AbstractLogger::notice(string $message, array $context = array()) : void

Parameters:

Parameter Type Description
message string
context array

go to top(#abstractlogger)


warning

Exceptional occurrences that are not errors.

public AbstractLogger::warning(string $message, array $context = array()) : void

Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.

Parameters:

Parameter Type Description
message string
context array

go to top(#abstractlogger)