Frontend
Frontend
Logger frontend implementation.
class Frontend implements \Psr\Log\LoggerInterfaceImplements: Psr\Log\LoggerInterface
Provides logging functionality using a configurable backend, supporting log levels, context, message interpolation, and PSR-3 compatibility.
Properties
config
private Frontend\Options $configType: Hazaar\Logger\Frontend\Options
context
private array $contextType: array
level
The minimum log level for messages to be recorded.
private int $level = 'Backend'Type: int
backend
The backend instance used for logging.
private Backend $backendType: Hazaar\Logger\Interface\Backend
Methods
__construct
public __construct(Frontend\Options $config): voidParameters
| Parameter | Type | Description |
|---|---|---|
$config | Hazaar\Logger\Frontend\Options |
__destruct
Destructor closes the backend and releases resources.
public __destruct(): voidinitialise
Initialise the logger with the given configuration.
public initialise(array $config): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$config | array |
setContext
Set the context for the logger.
public setContext(array $context): voidReturns: void
Overwrites the existing context with the provided context array.
Parameters
| Parameter | Type | Description |
|---|---|---|
$context | array |
addContext
Adds additional context information to the logger.
public addContext(array $context): voidReturns: void
Merges the provided context array with the existing context.
Parameters
| Parameter | Type | Description |
|---|---|---|
$context | array | associative array of context data to add |
log
Write a log message to the backend.
public log(mixed $level, string|\Stringable $message, array $context): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$level | mixed | |
$message | string | Stringable |
$context | array | Additional context for the log entry |
emergency
public emergency(string|\Stringable $message, array $context): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$message | string | Stringable |
$context | array |
alert
public alert(string|\Stringable $message, array $context): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$message | string | Stringable |
$context | array |
critical
public critical(string|\Stringable $message, array $context): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$message | string | Stringable |
$context | array |
error
public error(string|\Stringable $message, array $context): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$message | string | Stringable |
$context | array |
warning
public warning(string|\Stringable $message, array $context): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$message | string | Stringable |
$context | array |
notice
public notice(string|\Stringable $message, array $context): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$message | string | Stringable |
$context | array |
info
public info(string|\Stringable $message, array $context): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$message | string | Stringable |
$context | array |
debug
public debug(string|\Stringable $message, array $context): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$message | string | Stringable |
$context | array |
interpolate
Interpolates context values into the message placeholders.
private interpolate(string $message, array $context): stringReturns: string
Parameters
| Parameter | Type | Description |
|---|---|---|
$message | string | |
$context | array |
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:17 +0000