Documentation

ConsoleLogger extends AbstractLogger
in package

PSR-3 compliant console logger.

Tags
author

Kévin Dunglas dunglas@gmail.com

see
https://www.php-fig.org/psr/psr-3/

Table of Contents

ERROR  = 'error'
INFO  = 'info'
$errored  : mixed
$formatLevelMap  : mixed
$output  : mixed
$verbosityLevelMap  : 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.
hasErrored()  : bool
Returns true when any messages have been logged at error levels.
info()  : void
Interesting events.
log()  : void
{@inheritdoc}
notice()  : void
Normal but significant events.
warning()  : void
Exceptional occurrences that are not errors.
interpolate()  : string
Interpolates context values into the message placeholders.

Constants

Properties

$formatLevelMap

private mixed $formatLevelMap = [\Psr\Log\LogLevel::EMERGENCY => self::ERROR, \Psr\Log\LogLevel::ALERT => self::ERROR, \Psr\Log\LogLevel::CRITICAL => self::ERROR, \Psr\Log\LogLevel::ERROR => self::ERROR, \Psr\Log\LogLevel::WARNING => self::INFO, \Psr\Log\LogLevel::NOTICE => self::INFO, \Psr\Log\LogLevel::INFO => self::INFO, \Psr\Log\LogLevel::DEBUG => self::INFO]

$verbosityLevelMap

private mixed $verbosityLevelMap = [\Psr\Log\LogLevel::EMERGENCY => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL, \Psr\Log\LogLevel::ALERT => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL, \Psr\Log\LogLevel::CRITICAL => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL, \Psr\Log\LogLevel::ERROR => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL, \Psr\Log\LogLevel::WARNING => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_NORMAL, \Psr\Log\LogLevel::NOTICE => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERBOSE, \Psr\Log\LogLevel::INFO => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_VERY_VERBOSE, \Psr\Log\LogLevel::DEBUG => \Symfony\Component\Console\Output\OutputInterface::VERBOSITY_DEBUG]

Methods

__construct()

public __construct(OutputInterface $output[, array<string|int, mixed> $verbosityLevelMap = [] ][, array<string|int, mixed> $formatLevelMap = [] ]) : mixed
Parameters
$output : OutputInterface
$verbosityLevelMap : array<string|int, mixed> = []
$formatLevelMap : array<string|int, mixed> = []
Return values
mixed

alert()

Action must be taken immediately.

public alert(string|Stringable $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
$context : array<string|int, mixed> = []
Return values
void

critical()

Critical conditions.

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

Example: Application component unavailable, unexpected exception.

Parameters
$message : string|Stringable
$context : array<string|int, mixed> = []
Return values
void

debug()

Detailed debug information.

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

emergency()

System is unusable.

public emergency(string|Stringable $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$message : string|Stringable
$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 $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$message : string|Stringable
$context : array<string|int, mixed> = []
Return values
void

hasErrored()

Returns true when any messages have been logged at error levels.

public hasErrored() : bool
Return values
bool

info()

Interesting events.

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

Example: User logs in, SQL logs.

Parameters
$message : string|Stringable
$context : array<string|int, mixed> = []
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|Stringable $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$message : string|Stringable
$context : array<string|int, mixed> = []
Return values
void

warning()

Exceptional occurrences that are not errors.

public warning(string|Stringable $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
$context : array<string|int, mixed> = []
Return values
void

interpolate()

Interpolates context values into the message placeholders.

private interpolate(string $message, array<string|int, mixed> $context) : string
Parameters
$message : string
$context : array<string|int, mixed>
Tags
author

PHP Framework Interoperability Group

Return values
string

Search results