final class ClassContextLogger extends AbstractLogger (View source)

PSR-3 decorator that tags every log call with the owning class's short name in the classname context key.

Methods

static LoggerInterface
for(LoggerInterface $inner, string $class)

Wrap $inner so its lines carry the short name of $class (a FQCN or self::class).

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

No description

Details

static LoggerInterface for(LoggerInterface $inner, string $class)

Wrap $inner so its lines carry the short name of $class (a FQCN or self::class).

A NullLogger is returned as is, and an already wrapped logger is re-tagged rather than stacked, since the outer tag is the one that reaches the line anyway.

Parameters

LoggerInterface $inner
string $class

Return Value

LoggerInterface

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

No description

Parameters

$level
Stringable|string $message
array $context

Return Value

void