Database
Less than 1 minute
Database
Database logger backend implementation.
class Database implements \Hazaar\Logger\Interface\BackendImplements: Hazaar\Logger\Interface\Backend
Provides logging functionality by writing log entries to a database table using a configurable DBI adapter. Supports configuration for table, columns, and additional log context.
Properties
config
private Database\Options $configType: Hazaar\Logger\Backend\Database\Options
failed
Indicates if the backend has failed and should not attempt further writes.
private bool $failedType: bool
db
The database adapter instance used for logging.
private Adapter $dbType: Hazaar\DBI\Adapter
Methods
__construct
Database backend constructor.
public __construct(array|Database\Options $config): voidParameters
| Parameter | Type | Description |
|---|---|---|
$config | array | Hazaar\Logger\Backend\Database\Options |
write
Write a log entry to the database backend.
public write(string $level, string $message, array $context): voidReturns: void
Parameters
| Parameter | Type | Description |
|---|---|---|
$level | string | Log level (e.g., 'error', 'info'). |
$message | string | log message to record |
$context | array | additional context for the log entry (currently unused) |
close
Closes the database backend connection.
public close(): voidReturns: void
This method is a placeholder for future resource cleanup logic.
Generated by Hazaar API Doc Generator on Fri, 04 Sep 2026 23:32:17 +0000