Configuration
Configuration options for WPZylos Logger.
Service Provider
The LoggerServiceProvider registers logging components.
Container Bindings
| Binding | Class | Description |
|---|---|---|
Logger::class | Logger | Main logger |
'logger' | Logger | Alias |
Log Path
Default log path is {plugin_dir}/logs/debug.log.
Configure custom path:
$logger = new Logger($context, [
'path' => WP_CONTENT_DIR . '/logs/my-plugin.log',
]);
Log Level Threshold
Set minimum log level:
$logger = new Logger($context, [
'level' => 'warning', // Only warning and above
]);
Date Format
$logger = new Logger($context, [
'date_format' => 'Y-m-d H:i:s.u',
]);
Channel Configuration
$logger = new Logger($context, [
'channel' => 'file', // 'file', 'error_log', 'null'
]);