Copied!

PSR-3 compliant console logger.

CloneableInstantiable
Constants
public Symfony\Component\Console\Logger\ConsoleLogger::ERROR = 'error'
public Symfony\Component\Console\Logger\ConsoleLogger::INFO = 'info'
Methods
public __construct(Symfony\Component\Console\Output\OutputInterface $output, array $verbosityLevelMap = [], array $formatLevelMap = [])
public Psr\Log\AbstractLogger::alert(Stringable|string $message, array $context = []) : void
 

Action must be taken immediately.

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

  • param string|\Stringable $message
  • param array $context
  • return void
public Psr\Log\AbstractLogger::critical(Stringable|string $message, array $context = []) : void
 

Critical conditions.

Example: Application component unavailable, unexpected exception.

  • param string|\Stringable $message
  • param array $context
  • return void
public Psr\Log\AbstractLogger::debug(Stringable|string $message, array $context = []) : void
 

Detailed debug information.

  • param string|\Stringable $message
  • param array $context
  • return void
public Psr\Log\AbstractLogger::emergency(Stringable|string $message, array $context = []) : void
 

System is unusable.

  • param string|\Stringable $message
  • param array $context
  • return void
public Psr\Log\AbstractLogger::error(Stringable|string $message, array $context = []) : void
 

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

  • param string|\Stringable $message
  • param array $context
  • return void
public hasErrored() : bool
 

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

public Psr\Log\AbstractLogger::info(Stringable|string $message, array $context = []) : void
 

Interesting events.

Example: User logs in, SQL logs.

  • param string|\Stringable $message
  • param array $context
  • return void
public log( $level, $message, array $context = []) : void
public Psr\Log\AbstractLogger::notice(Stringable|string $message, array $context = []) : void
 

Normal but significant events.

  • param string|\Stringable $message
  • param array $context
  • return void
public Psr\Log\AbstractLogger::warning(Stringable|string $message, array $context = []) : void
 

Exceptional occurrences that are not errors.

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

  • param string|\Stringable $message
  • param array $context
  • return void
Properties
private bool $errored = false
private array $formatLevelMap = ['emergency' => 'error', 'alert' => 'error', 'critical' => 'error', 'error' => 'error', 'warning' => 'info', 'notice' => 'info', 'info' => 'info', 'debug' => 'info']
private Symfony\Component\Console\Output\OutputInterface $output
private array $verbosityLevelMap = ['emergency' => 32, 'alert' => 32, 'critical' => 32, 'error' => 32, 'warning' => 32, 'notice' => 64, 'info' => 128, 'debug' => 256]
Methods
private interpolate(string $message, array $context) : string
 

Interpolates context values into the message placeholders.

© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration