Skip to content

Latest commit

 

History

History
33 lines (27 loc) · 1.54 KB

README.md

File metadata and controls

33 lines (27 loc) · 1.54 KB

doctrine-psr-sql-logger

PSR-3 Compliant Doctrine SQL Logger

Scrutinizer Code Quality Code Coverage Build Status

Installation

composer require abacaphiliac/doctrine-psr-sql-logger

Usage

The following configuration snippet will log the query with its parameter types and execution duration. In general, this will be safe to use with parameterized queries, since values will not be printed to the log stream.

$logger = new \Psr\Log\NullLogger(); // Get your real logger(s) from a container.
$configuration = new \Doctrine\DBAL\Configuration();
$configuration->setSQLLogger(new \Abacaphiliac\Doctrine\PsrSqlLogger($logger));

The following snippet will additionally log parameter values. Be careful to handle sensitive data appropriately.

$logger = new \Psr\Log\NullLogger(); // Get your real logger(s) from a container.
$configuration = new \Doctrine\DBAL\Configuration();
$configuration->setSQLLogger(new \Abacaphiliac\Doctrine\PsrSqlParamsLogger($logger));

Contributing

composer update && composer build