Documentation

Logger extends AbstractLogger
in package

Minimalist PSR-3 logger designed to write in stderr or any other stream.

Tags
author

Kévin Dunglas dunglas@gmail.com

Table of Contents

LEVELS  = [PsrLogLogLevel::DEBUG => 0, PsrLogLogLevel::INFO => 1, PsrLogLogLevel::NOTICE => 2, PsrLogLogLevel::WARNING => 3, PsrLogLogLevel::ERROR => 4, PsrLogLogLevel::CRITICAL => 5, PsrLogLogLevel::ALERT => 6, PsrLogLogLevel::EMERGENCY => 7]
$formatter  : mixed
$handle  : resource|null
$minLevelIndex  : mixed
__construct()  : mixed
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
{@inheritdoc}
notice()  : void
Normal but significant events.
warning()  : void
Exceptional occurrences that are not errors.
format()  : string

Constants

LEVELS

private mixed LEVELS = [PsrLogLogLevel::DEBUG => 0, PsrLogLogLevel::INFO => 1, PsrLogLogLevel::NOTICE => 2, PsrLogLogLevel::WARNING => 3, PsrLogLogLevel::ERROR => 4, PsrLogLogLevel::CRITICAL => 5, PsrLogLogLevel::ALERT => 6, PsrLogLogLevel::EMERGENCY => 7]

Properties

$formatter

private mixed $formatter

$handle

private resource|null $handle

$minLevelIndex

private mixed $minLevelIndex

Methods

__construct()

public __construct([string|null $minLevel = null ][, string|resource|null $output = null ][, callable|null $formatter = null ]) : mixed
Parameters
$minLevel : string|null = null
$output : string|resource|null = null
$formatter : callable|null = null
Return values
mixed

alert()

Action must be taken immediately.

public alert(string $message[, array<string|int, mixed> $context = array() ]) : void

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

Parameters
$message : string
$context : array<string|int, mixed> = array()
Return values
void

critical()

Critical conditions.

public critical(string $message[, array<string|int, mixed> $context = array() ]) : void

Example: Application component unavailable, unexpected exception.

Parameters
$message : string
$context : array<string|int, mixed> = array()
Return values
void

debug()

Detailed debug information.

public debug(string $message[, array<string|int, mixed> $context = array() ]) : void
Parameters
$message : string
$context : array<string|int, mixed> = array()
Return values
void

emergency()

System is unusable.

public emergency(string $message[, array<string|int, mixed> $context = array() ]) : void
Parameters
$message : string
$context : array<string|int, mixed> = array()
Return values
void

error()

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

public error(string $message[, array<string|int, mixed> $context = array() ]) : void
Parameters
$message : string
$context : array<string|int, mixed> = array()
Return values
void

info()

Interesting events.

public info(string $message[, array<string|int, mixed> $context = array() ]) : void

Example: User logs in, SQL logs.

Parameters
$message : string
$context : array<string|int, mixed> = array()
Return values
void

log()

{@inheritdoc}

public log(mixed $level, mixed $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$level : mixed
$message : mixed
$context : array<string|int, mixed> = []
Return values
void

notice()

Normal but significant events.

public notice(string $message[, array<string|int, mixed> $context = array() ]) : void
Parameters
$message : string
$context : array<string|int, mixed> = array()
Return values
void

warning()

Exceptional occurrences that are not errors.

public warning(string $message[, array<string|int, mixed> $context = array() ]) : void

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

Parameters
$message : string
$context : array<string|int, mixed> = array()
Return values
void

format()

private format(string $level, string $message, array<string|int, mixed> $context[, bool $prefixDate = true ]) : string
Parameters
$level : string
$message : string
$context : array<string|int, mixed>
$prefixDate : bool = true
Return values
string

Search results