https://github.com/itk-dev/monolog-db-bundle
https://github.com/itk-dev/monolog-db-bundle
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/itk-dev/monolog-db-bundle
- Owner: itk-dev
- Created: 2018-02-06T11:46:40.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-02-06T12:14:50.000Z (about 8 years ago)
- Last Synced: 2025-02-13T08:16:55.706Z (about 1 year ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 0
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Monolog db bundle
Write log entries to a database.
Installation:
```sh
composer require itk-dev/monolog-db-bundle "^1.0"
```
Add bundle in your `AppKernel.php`:
```php
public function registerBundles()
{
$bundles = [
…,
new ItkDev\MonologDbBundle\ItkDevMonologDbBundle(),
…
];
…
}
```
Configuration:
```yml
monolog:
channels: ['db']
handlers:
db:
channels: ['db']
type: service
id: itk_dev.monolog.db_handler
```
Usage:
```php
…
$logger = $container->get('monolog.logger.db');
$logger->info($message);
…
```
Entries logged have a `type` property which can be used for filtering
entries. The type can be set by adding the `type` key to the logging
context:
```php
$logger->info($message, [
'type' => 'my_log_entry',
]);
```
Command:
```sh
bin/console itk-dev:monolog-db:show --help
```