itk-dev/monolog-db-bundle

Monolog handler for logging to a database table

Installs: 32

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 4

Forks: 0

Open Issues: 0

Type:symfony-bundle

1.0.1 2018-02-06 12:14 UTC

This package is auto-updated.

Last update: 2024-04-21 16:38:31 UTC


README

Write log entries to a database.

Installation:

composer require itk-dev/monolog-db-bundle "^1.0"

Add bundle in your AppKernel.php:

    public function registerBundles()
    {
        $bundles = [
            …,
            new ItkDev\MonologDbBundle\ItkDevMonologDbBundle(),
            …
        ];

        …
    }

Configuration:

monolog:
    channels: ['db']
    handlers:
        db:
            channels: ['db']
            type: service
            id: itk_dev.monolog.db_handler

Usage:

$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:

$logger->info($message, [
  'type' => 'my_log_entry',
]);

Command:

bin/console itk-dev:monolog-db:show --help