Logging (PSR-5)¶
Default logging library is Koded Logging.
Logging
Demand an instance of PSR-5 Psr\Log\LoggerInterface
in your methods, DI container will inject the configured log instance.
<?php
...
public function something(LoggerInterface $log) {
// ...
}
...
Setup logging¶
Logger library is configured in the \ application configuration for the App
instance.
<?php
return [
'logging' => [
'timezone' => 'UTC',
'dateformat' => 'Y-m-d H:i:s.u'
'loggers' => [
[
'class' => \Koded\Logging\Processors\Cli::class,
'format' => '[levelname] message',
'levels' => -1
]
]
],
];
The conf key loggers
is a list of Koded\Logging\Log
log processor implementations. By default only one log processor is registered that processes all log levels.