frmaxm/simple-event-logger

Component is a Yii 2 wrapper of Log

Installs: 16

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 1

Open Issues: 1

Type:yii2-extension

dev-master 2017-02-17 17:42 UTC

This package is not auto-updated.

Last update: 2024-03-16 17:31:25 UTC


README

This component is a Yii 2 wrapper of Log.

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist frmaxm/simple-event-log "dev-master"

or add

"frmaxm/simple-event-log": "dev-master"

to the require section of your composer.json file.

Configuration

Edit bootstrap section in your application config file:

'bootstrap' => [
    'model_log'=>[
        'class'=>'frmaxm\logger\bootstrap\ModelLogBootstrap',
        'category'=>'admin',
    ],
    'log'=>[
        'class'=>'yii\log\Logger',
        'flushInterval' => 50,
    ],
]

Edit log component in your application config file:

'log' => [
    'traceLevel' => YII_DEBUG ? 3 : 0,
    'targets' => [
        [
            'class' => 'yii\log\DbTarget',
            'categories' => ['model.*'],
        ],
    ],
]

Add new table EventLog to your database.

Usage

Run module migration:

php yii migrate --migrationPath=@frmaxm/simple-event-logger/migrations

Info

All events on the model will be recorded in the Event Log table. This will allow you to see all the user's actions.