abacaphiliac / doctrine-psr-sql-logger
PSR-3 Compliant Doctrine SQL Logger
Installs: 4 963
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 2
Forks: 2
Open Issues: 3
Requires
- php: ^7.2 || ^8.0
- doctrine/dbal: ^2.5.14
- psr/log: ^1.1
Requires (Dev)
- infection/infection: ^0.8 || ^0.18.2
- johnkary/phpunit-speedtrap: ^4.0
- php-parallel-lint/php-parallel-lint: ^1.3
- phpstan/phpstan: ^0.12
- phpunit/phpunit: ^6.5 || ^8.5.16
- roave/security-advisories: dev-master
- squizlabs/php_codesniffer: ^3.4
This package is auto-updated.
Last update: 2024-10-23 10:59:10 UTC
README
PSR-3 Compliant Doctrine SQL Logger
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