Database
Less than 1 minute
Database
Database logger backend implementation.
class Database implements \Hazaar\Logger\Backend\BackendProvides 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 array $configfailed
Indicates if the backend has failed and should not attempt further writes.
private bool $faileddb
The database adapter instance used for logging.
private Adapter $dbMethods
__construct
Database backend constructor.
public __construct(array $config): voidParameters
| Parameter | Type | Description |
|---|---|---|
$config | array | configuration options for database connection and logging |
write
Write a log entry to the database backend.
public write(string $level, string $message, array $context): voidParameters
| 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(): voidThis method is a placeholder for future resource cleanup logic.
Generated by Hazaar API Doc Generator on Tue, 21 Apr 2026 04:00:23 +0000