Configuration

Configuration options for WPZylos Logger.

Service Provider

The LoggerServiceProvider registers logging components.

Container Bindings

BindingClassDescription
Logger::classLoggerMain logger
'logger'LoggerAlias

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'
]);