Skip to content

Latest commit

 

History

History
50 lines (43 loc) · 2.06 KB

README.md

File metadata and controls

50 lines (43 loc) · 2.06 KB

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}}'
            ],
        ],
    ],
]