Some thoughts about error logging in expressive.
Looking at the docs for error handling and the section ‘Listening for errors’. I noticed two small things:
- Promoting the use of delegators is fine, but restricts usage to zend-service-manager. At least an option should be nice.
- Was a bit confused about where to register the
LoggingErrorListenerDelegatorFactory
… put it dependencies.php under ‘delegators’, but was not super intuitive (at least for me):
return [
'dependencies' => [
'factories' => [
// ...
Psr\Log\LoggerInterface::class => App\Infrastructure\Log\LoggerFactory::class,
],
'delegators' => [
Zend\Stratigility\Middleware\ErrorHandler::class => [
App\Infrastructure\Log\LoggingErrorListenerDelegatorFactory::class,
]
]
],
];
So everything is fine… but I found it a bit sad to have to spend an hour to just enable basic logging.
I think it could be good to have it in skeleton by default (with a NullLogger for example) and I would be happy to contribute a P/R, but would like to have some feedback first especially
- How to emulate the delegators with Pimple, Aura.DI ?
- What would be the ideal namespace (App\Infrastructure\Log) to choose to set the loggers ?
Any thoughts on this ? Or is there’s already something that could be easily provide global error logging ?