class Logger implements LoggerInterface (View source)

Properties

protected LoggerInterface $logger The underlying logger implementation.
protected Dispatcher|null $dispatcher The event dispatcher instance.

Methods

void
__construct(LoggerInterface $logger, Dispatcher $dispatcher = null)

Create a new log writer instance.

void
emergency(string $message, array $context = [])

Log an emergency message to the logs.

void
alert(string $message, array $context = [])

Log an alert message to the logs.

void
critical(string $message, array $context = [])

Log a critical message to the logs.

void
error(string $message, array $context = [])

Log an error message to the logs.

void
warning(string $message, array $context = [])

Log a warning message to the logs.

void
notice(string $message, array $context = [])

Log a notice to the logs.

void
info(string $message, array $context = [])

Log an informational message to the logs.

void
debug(string $message, array $context = [])

Log a debug message to the logs.

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

Log a message to the logs.

void
write(string $level, string $message, array $context = [])

Dynamically pass log calls into the writer.

void
writeLog(string $level, string $message, array $context)

Write a message to the log.

void
listen(Closure $callback)

Register a new callback handler for when a log event is triggered.

void
fireLogEvent(string $level, string $message, array $context = [])

Fires a log event.

mixed
formatMessage(mixed $message)

Format the parameters for the logger.

LoggerInterface
getLogger()

Get the underlying logger implementation.

getEventDispatcher()

Get the event dispatcher instance.

void
setEventDispatcher(Dispatcher $dispatcher)

Set the event dispatcher instance.

mixed
__call(string $method, array $parameters)

Dynamically proxy method calls to the underlying logger.

Details

void __construct(LoggerInterface $logger, Dispatcher $dispatcher = null)

Create a new log writer instance.

Parameters

LoggerInterface $logger
Dispatcher $dispatcher

Return Value

void

void emergency(string $message, array $context = [])

Log an emergency message to the logs.

Parameters

string $message
array $context

Return Value

void

void alert(string $message, array $context = [])

Log an alert message to the logs.

Parameters

string $message
array $context

Return Value

void

void critical(string $message, array $context = [])

Log a critical message to the logs.

Parameters

string $message
array $context

Return Value

void

void error(string $message, array $context = [])

Log an error message to the logs.

Parameters

string $message
array $context

Return Value

void

void warning(string $message, array $context = [])

Log a warning message to the logs.

Parameters

string $message
array $context

Return Value

void

void notice(string $message, array $context = [])

Log a notice to the logs.

Parameters

string $message
array $context

Return Value

void

void info(string $message, array $context = [])

Log an informational message to the logs.

Parameters

string $message
array $context

Return Value

void

void debug(string $message, array $context = [])

Log a debug message to the logs.

Parameters

string $message
array $context

Return Value

void

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

Log a message to the logs.

Parameters

string $level
string $message
array $context

Return Value

void

void write(string $level, string $message, array $context = [])

Dynamically pass log calls into the writer.

Parameters

string $level
string $message
array $context

Return Value

void

protected void writeLog(string $level, string $message, array $context)

Write a message to the log.

Parameters

string $level
string $message
array $context

Return Value

void

void listen(Closure $callback)

Register a new callback handler for when a log event is triggered.

Parameters

Closure $callback

Return Value

void

Exceptions

RuntimeException

protected void fireLogEvent(string $level, string $message, array $context = [])

Fires a log event.

Parameters

string $level
string $message
array $context

Return Value

void

protected mixed formatMessage(mixed $message)

Format the parameters for the logger.

Parameters

mixed $message

Return Value

mixed

LoggerInterface getLogger()

Get the underlying logger implementation.

Return Value

LoggerInterface

Dispatcher getEventDispatcher()

Get the event dispatcher instance.

Return Value

Dispatcher

void setEventDispatcher(Dispatcher $dispatcher)

Set the event dispatcher instance.

Parameters

Dispatcher $dispatcher

Return Value

void

mixed __call(string $method, array $parameters)

Dynamically proxy method calls to the underlying logger.

Parameters

string $method
array $parameters

Return Value

mixed