\Omega\Logging LoggerInterface

Logger interface.

The LoggerInterface defines a standard contract for logging functionality in the Omega Logging Package. It includes methods for logging messages at various severity levels, based on the PSR-3 logging specification:

  • emergency(): Logs messages when the system is unusable.
  • alert(): Logs messages requiring immediate attention.
  • critical(): Logs messages for critical conditions.
  • error(): Logs runtime errors that need monitoring but not immediate action.
  • warning(): Logs messages for exceptional occurrences that are not errors.
  • notice(): Logs significant but normal events.
  • info(): Logs general operational information.
  • debug(): Logs detailed debugging information for developers.

Each method accepts a string or Stringable message, along with an optional context array for additional details.

The log() method is abstract and must be implemented by concrete classes, allowing them to handle logging at any arbitrary level. It accepts a level, a message, and an optional context array. The method throws a LogArgumentException if invalid arguments are provided.

This interface ensures that any logger class implementing it will conform to a common structure, allowing consistent logging behavior across the application.

Summary

Methods
Constants
emergency()
alert()
critical()
error()
warning()
notice()
info()
debug()
log()
No public constants found

Methods

emergency()

emergency(string|\Stringable  $message, array  $context = []) : void

System is unusable.

Parameters

string|\Stringable $message

Holds the message for system is unusable.

array $context

Holds the context of message.

Returns

void —

alert()

alert(string|\Stringable  $message, array  $context = []) : void

Action must be taken immediately.

Parameters

string|\Stringable $message

Holds the message for action must be taken immediately.

array $context

Holds the context of message.

Returns

void —

critical()

critical(string|\Stringable  $message, array  $context = []) : void

Critical condition.

Parameters

string|\Stringable $message

Holds the message for critical condition.

array $context

Holds the context of message.

Returns

void —

error()

error(string|\Stringable  $message, array  $context = []) : void

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

Parameters

string|\Stringable $message

Holds the message for runtime errors.

array $context

Holds the context of message.

Returns

void —

warning()

warning(string|\Stringable  $message, array  $context = []) : void

Exceptional occurrences that are not errors.

Parameters

string|\Stringable $message

Holds the message for exceptional errors.

array $context

Holds the context of message.

Returns

void —

notice()

notice(string|\Stringable  $message, array  $context = []) : void

Normal but significant events.

Parameters

string|\Stringable $message

Holds the message for normal but significant events.

array $context

Holds the context of message.

Returns

void —

info()

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

Interesting events.

Parameters

string|\Stringable $message

Holds the message for interesting events.

array $context

Holds the context of message.

Returns

void —

debug()

debug(string|\Stringable  $message, array  $context = []) : void

Detailed debug information.

Parameters

string|\Stringable $message

Holds the message for detailed debug information.

array $context

Holds the context of message.

Returns

void —

log()

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

Logs with an arbitrary level.

Parameters

mixed $level

Holds the log level.

string|\Stringable $message

Holds the log message.

array $context

Holds the context of message.

Throws

\Omega\Logging\Exception\LogArgumentException

Returns

void —