ConsoleLogger
extends AbstractLogger
in package
PSR-3 compliant console logger.
Tags
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
ERROR
public
mixed
ERROR
= 'error'
INFO
public
mixed
INFO
= 'info'
Properties
$errored
private
mixed
$errored
= false
$formatLevelMap
private
mixed
$formatLevelMap
= [PsrLogLogLevel::EMERGENCY => self::ERROR, PsrLogLogLevel::ALERT => self::ERROR, PsrLogLogLevel::CRITICAL => self::ERROR, PsrLogLogLevel::ERROR => self::ERROR, PsrLogLogLevel::WARNING => self::INFO, PsrLogLogLevel::NOTICE => self::INFO, PsrLogLogLevel::INFO => self::INFO, PsrLogLogLevel::DEBUG => self::INFO]
$output
private
mixed
$output
$verbosityLevelMap
private
mixed
$verbosityLevelMap
= [PsrLogLogLevel::EMERGENCY => SymfonyComponentConsoleOutputOutputInterface::VERBOSITY_NORMAL, PsrLogLogLevel::ALERT => SymfonyComponentConsoleOutputOutputInterface::VERBOSITY_NORMAL, PsrLogLogLevel::CRITICAL => SymfonyComponentConsoleOutputOutputInterface::VERBOSITY_NORMAL, PsrLogLogLevel::ERROR => SymfonyComponentConsoleOutputOutputInterface::VERBOSITY_NORMAL, PsrLogLogLevel::WARNING => SymfonyComponentConsoleOutputOutputInterface::VERBOSITY_NORMAL, PsrLogLogLevel::NOTICE => SymfonyComponentConsoleOutputOutputInterface::VERBOSITY_VERBOSE, PsrLogLogLevel::INFO => SymfonyComponentConsoleOutputOutputInterface::VERBOSITY_VERY_VERBOSE, PsrLogLogLevel::DEBUG => SymfonyComponentConsoleOutputOutputInterface::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 $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 —hasErrored()
Returns true when any messages have been logged at error levels.
public
hasErrored() : bool
Return values
bool —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 —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>