ConsoleLogger
extends AbstractLogger
in package
PSR-3 compliant console logger.
Tags
Table of Contents
Constants
Properties
- $errored : mixed
- $formatLevelMap : mixed
- $output : mixed
- $verbosityLevelMap : mixed
Methods
- __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
- Logs with an arbitrary level.
- 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
= [\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]
$output
private
mixed
$output
$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> = []
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> = []
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> = []
debug()
Detailed debug information.
public
debug(string|Stringable $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string|Stringable
- $context : array<string|int, mixed> = []
emergency()
System is unusable.
public
emergency(string|Stringable $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string|Stringable
- $context : array<string|int, mixed> = []
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> = []
hasErrored()
Returns true when any messages have been logged at error levels.
public
hasErrored() : bool
Return values
boolinfo()
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> = []
log()
Logs with an arbitrary level.
public
log(mixed $level, mixed $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $level : mixed
- $message : mixed
- $context : array<string|int, mixed> = []
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> = []
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> = []
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>