PHP code example of exbico / monolog-db-bundle

1. Go to this page and download the library: Download exbico/monolog-db-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

exbico / monolog-db-bundle example snippets


Exbico\MonologDbBundle\ExbicoMonologDbBundle::class => ['all' => true],



use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
    $containerConfigurator->extension(
        'exbico_monolog_db',
        [
            'connection'   => 'doctrine.dbal.connection',
            'levels'       => [
                /** The key-value array, where the key is the name of the level,
                 * and the value is the name of the table to save logs to.
                 * A Null value means that this level is not processed.
                 */
                'emergency' => 'log_emergency',
                'alert'     => 'log_alert',
                'critical'  => 'log_critical'
                'error'     => 'log_error',
                'warning'   => 'log_warning',
                'notice'    => 'log_notice',
                'info'      => 'log_info',
                'debug'     => 'log_debug',
            ],
            'rotation'   => [
                'history_size' => 2,
                'date_format'  => 'YmdHis',
            ],
        ],
    );
};



use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
    $containerConfigurator->extension(
        'monolog',
        [
            'handlers' => [
                'db'                => [
                    'type'     => 'service',
                    'id'       => 'exbico_monolog_db.handler',
                    'level'    => 'debug',
                ],
            ],
        ],
    );
};