Logger
in package
implements
LoggerInterface
Tags
Interfaces, Classes, Traits and Enums
- LoggerInterface
- Horde's Logger Interface includes PsrLoggerInterface but extends by horde-specific setup and manipulation methods.
Table of Contents
- VERSION = 1
- $filters : array<string|int, LogFilter>
- Horde_Log_Filter objects.
- $handlers : array<string|int, LogHandler>
- Handler objects.
- $levels : LogLevels
- Log levels where the keys are the level priorities and the values are the level names.
- __construct() : mixed
- Constructor.
- addFilter() : void
- Add a filter that will be applied before all log handlers.
- addHandler() : void
- Add a handler. A handler is responsible for taking a log message and writing it out to storage.
- alert() : void
- Action must be taken immediately.
- critical() : void
- Critical conditions.
- debug() : void
- Detailed debug information.
- emergency() : void
- System is unusable.
- error() : void
- Runtime errors that do not require immediate action but should typically be logged and monitored.
- info() : void
- Interesting events.
- log() : void
- Logs with an arbitrary level.
- notice() : void
- Normal but significant events.
- serialize() : string
- Serialize.
- unserialize() : void
- Unserialize.
- warning() : void
- Exceptional occurrences that are not errors.
Constants
VERSION
public
mixed
VERSION
= 1
Properties
$filters
Horde_Log_Filter objects.
protected
array<string|int, LogFilter>
$filters
= []
$handlers
Handler objects.
protected
array<string|int, LogHandler>
$handlers
= []
$levels
Log levels where the keys are the level priorities and the values are the level names.
protected
LogLevels
$levels
Methods
__construct()
Constructor.
public
__construct([array<string|int, LogHandler> $handlers = [] ][, LogLevels|null $levels = null ][, array<string|int, LogFilter> $filters = [] ]) : mixed
Parameters
- $handlers : array<string|int, LogHandler> = []
-
The list of handlers. TODO: Is defaulting to the null handler any better than defaulting to no handler?
- $levels : LogLevels|null = null
-
A list of log levels to operate on. Null initializes with the RFC loglevels
- $filters : array<string|int, LogFilter> = []
-
A list of global filters to apply before any log handler. Log handlers may have their own filters
Return values
mixed —addFilter()
Add a filter that will be applied before all log handlers.
public
addFilter(LogFilter $filter) : void
Before a message will be received by any of the handlers, it must be accepted by all filters added with this method.
Parameters
- $filter : LogFilter
-
Filter to add.
Return values
void —addHandler()
Add a handler. A handler is responsible for taking a log message and writing it out to storage.
public
addHandler(LogHandler $handler) : void
Parameters
- $handler : LogHandler
-
Handler to add.
Return values
void —alert()
Action must be taken immediately.
public
alert(string|Stringable|LogMessage $message[, array<string|int, mixed> $context = [] ]) : void
Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
Parameters
- $message : string|Stringable|LogMessage
- $context : array<string|int, mixed> = []
Return values
void —critical()
Critical conditions.
public
critical(string|Stringable|LogMessage $message[, array<string|int, mixed> $context = [] ]) : void
Example: Application component unavailable, unexpected exception.
Parameters
- $message : string|Stringable|LogMessage
- $context : array<string|int, mixed> = []
Return values
void —debug()
Detailed debug information.
public
debug(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
Return values
void —emergency()
System is unusable.
public
emergency(string|Stringable|LogMessage $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string|Stringable|LogMessage
- $context : array<string|int, mixed> = []
Return values
void —error()
Runtime errors that do not require immediate action but should typically be logged and monitored.
public
error(string|Stringable|LogMessage $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string|Stringable|LogMessage
-
The message to submit
- $context : array<string|int, mixed> = []
-
An array of context
Return values
void —info()
Interesting events.
public
info(string|Stringable|LogMessage $message[, array<string|int, mixed> $context = [] ]) : void
Example: User logs in, SQL logs.
Parameters
- $message : string|Stringable|LogMessage
- $context : array<string|int, mixed> = []
Return values
void —log()
Logs with an arbitrary level.
public
log(int|string|LogLevel $level, string|Stringable|LogMessage $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $level : int|string|LogLevel
- $message : string|Stringable|LogMessage
- $context : array<string|int, mixed> = []
-
User code supplied additional info
Tags
Return values
void —notice()
Normal but significant events.
public
notice(string|Stringable|LogMessage $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string|Stringable|LogMessage
- $context : array<string|int, mixed> = []
Return values
void —serialize()
Serialize.
public
serialize() : string
Return values
string —Serialized representation of this object.
unserialize()
Unserialize.
public
unserialize(string $data) : void
Parameters
- $data : string
-
Serialized data.
Tags
Return values
void —warning()
Exceptional occurrences that are not errors.
public
warning(string|Stringable|LogMessage $message[, array<string|int, mixed> $context = [] ]) : void
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
Parameters
- $message : string|Stringable|LogMessage
- $context : array<string|int, mixed> = []