marcuspi/doctrine-log-bridge

Allows you to pass a PSR-3 compliant logger to Doctrine

1.0.0 2019-02-03 23:16 UTC

This package is auto-updated.

Last update: 2024-12-04 22:18:05 UTC


README

PSR-3 log bridge for Doctrine's SQLLogger

Getting Started

Prerequisites

You need a PSR-3 logger and Doctrine's DBAL for this to make sense.

Installing

Download using composer

composer require marcuspi/doctrine-log-bridge

Then pass your favorite logger and the log level to the constructor

<?php

use Marcuspi\DoctrineLogBridge\LogBridge;
use \Psr\Log\LogLevel;

// set up your logger, or get it from you dependency container or whatever
/** @var \Psr\Log\LoggerInterface $logger */

$logBridge = new LogBridge($logger, LogLevel::INFO);

// ...
// Then, when setting up the DBAL:
/** @var \Doctrine\DBAL\Configuration $config */

$config->setSQLLogger($logBridge);

Versioning

SemVer is used for versioning. For the versions available, see the tags on this repository.

Authors

License

This project is licensed under the MIT License - see the LICENSE file for details