Interface LoggerInterface - Stefanius67/XLogger GitHub Wiki

Full name:     \Psr\Log\LoggerInterface


Describes a logger instance.

The message MUST be a string or object implementing __toString().

The message MAY contain placeholders in the form: {foo} where foo will be replaced by the context data in key "foo".

The context array can contain arbitrary data. The only assumption that can be made by implementors is that if an Exception instance is given to produce a stack trace, it MUST be in a key named "exception".

See https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md for the full interface specification.

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.
log Logs with an arbitrary level.
notice Normal but significant events.
warning Exceptional occurrences that are not errors.

Methods

alert

Action must be taken immediately.

public LoggerInterface::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(#loggerinterface)


critical

Critical conditions.

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

Example: Application component unavailable, unexpected exception.

Parameters:

Parameter Type Description
message string
context array

go to top(#loggerinterface)


debug

Detailed debug information.

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

Parameters:

Parameter Type Description
message string
context array

go to top(#loggerinterface)


emergency

System is unusable.

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

Parameters:

Parameter Type Description
message string
context array

go to top(#loggerinterface)


error

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

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

Parameters:

Parameter Type Description
message string
context array

go to top(#loggerinterface)


info

Interesting events.

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

Example: User logs in, SQL logs.

Parameters:

Parameter Type Description
message string
context array

go to top(#loggerinterface)


log

Logs with an arbitrary level.

public LoggerInterface::log(mixed $level, string $message, array $context = array()) : void

Parameters:

Parameter Type Description
level mixed
message string
context array

go to top(#loggerinterface)


notice

Normal but significant events.

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

Parameters:

Parameter Type Description
message string
context array

go to top(#loggerinterface)


warning

Exceptional occurrences that are not errors.

public LoggerInterface::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(#loggerinterface)