benycode / doctrine-psr-logger
Psr logger meets Doctrine
v1.0.1
2022-09-10 15:27 UTC
Requires
- php: >= 5.3.0
- doctrine/orm: >= 2.3.0
- psr/log: ^2.0 || ^3.0
This package is not auto-updated.
Last update: 2024-11-18 00:07:59 UTC
README
Log doctrine logs any where with PSR loggers.
Table of contents
Install
Via Composer
$ composer require benycode/doctrine-psr-logger
Usage
Then you are setting up Doctrine EntityManager setup logger (in an example i'm using DI):
EntityManager::class => static function (ContainerInterface $container): EntityManager { ... $logger = ..... ->addFileHandler('database.log') ->createLogger() ; $config ->setSQLLogger(new \BenyCode\DoctrinePsrLogger\PsrSqlLogger($logger)) ; return EntityManager::create($settings['db'], $config); },