PHP code example of razonyang / yii2-log-target-db

1. Go to this page and download the library: Download razonyang/yii2-log-target-db 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/ */

    

razonyang / yii2-log-target-db example snippets


return [
    // console configuration
    'controllerMap' => [
        'migrate' => [
            'migrationPath' => [
                // ...
                '@yii/log/migrations/',
            ],
            'migrationNamespaces' => [
                // ...
                'RazonYang\Yii2\Log\Db\Migration',
            ],
        ],
    ],

    // common/web/console configuration
    'components' => [
        'log' => [
            'targets' => [
                'db' => [
                    'class' => \RazonYang\Yii2\Log\Db\Target::class,
                    'levels' => ['error', 'warning'],
                    'db' => 'db',
                    'logTable' => '{{%log}}',
                ],
            ],
        ],
    ],
];