monsterhunter/yii2-log

0.1.4 2018-12-04 12:11 UTC

This package is auto-updated.

Last update: 2024-11-05 00:20:53 UTC


README

Latest Stable Version Total Downloads License StyleCI Build Status Scrutinizer Code Quality Code Coverage Build Status

Yii2 Log Module

Run migrations

  php yii migrate --migrationPath=@yii/log/migrations/

Config backend module

'modules'=> [
    'log' => [
        'class' => 'monsterhunter\yii2\log\Module',
        //'layout' =>'@app/views/layouts/main'  //custom layout  
    ]
]

Config log compoennt

'components' => [
    'log' => [
        'traceLevel' => YII_DEBUG ? 3 : 0,
        'targets' => [
            [
                'class' => 'yii\log\DbTarget',
                'levels' => ['error', 'warning'],
                'except' => ['yii\web\HttpException:404'],
                'prefix' => function () {
                    $url = !Yii::$app->request->isConsoleRequest ? Yii::$app->request->getUrl() : null;
                    return sprintf('[%s][%s]', Yii::$app->id, $url);
                },
                'logVars' => [],
                'logTable' => '{{%system_log}}'
            ],
        ],
    ],
]