class Logger extends AbstractLogger (View source)

PSR-3 logger that applies the logging.level threshold, fills {placeholders} and passes lines to a log handler.

Constants

private ISO8601_DATETIME_FORMAT

private LEVELS

private DEFAULT_LEVEL

Methods

static LoggerInterface
fromConfig(ConfigurationInterface $config)

The application logger as configured: PHP error_log when logging.type is "native", otherwise a logger that drops everything.

static array
levelNames()

Level names accepted by the logging.level setting, most severe first.

__construct(LogHandlerInterface $handler, string $logLevel)

No description

void
log($level, Stringable|string $message, array $context = [])

No description

static string
interpolatePlaceholders(string $message, array $context)

Substitute PSR-3 {key} placeholders in a log message with values from the context array.

Details

static LoggerInterface fromConfig(ConfigurationInterface $config)

The application logger as configured: PHP error_log when logging.type is "native", otherwise a logger that drops everything.

Parameters

ConfigurationInterface $config

Return Value

LoggerInterface

static array levelNames()

Level names accepted by the logging.level setting, most severe first.

Return Value

array

__construct(LogHandlerInterface $handler, string $logLevel)

No description

Parameters

LogHandlerInterface $handler
string $logLevel

void log($level, Stringable|string $message, array $context = [])

No description

Parameters

$level
Stringable|string $message
array $context

Return Value

void

static string interpolatePlaceholders(string $message, array $context)

Substitute PSR-3 {key} placeholders in a log message with values from the context array.

Shared with SyslogLogger so the substitution rules stay in one place.

Parameters

string $message
array $context

Return Value

string