benycode/doctrine-psr-logger

Psr logger meets Doctrine

v1.0.1 2022-09-10 15:27 UTC

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);
},