bariew/yii2-module-abstract-log

来自Web视图的日志管理

安装: 15

依赖项: 0

建议者: 0

安全性: 0

星标: 0

关注者: 2

分支: 0

开放问题: 0

类型:yii2-extension

dev-master 2016-07-05 14:43 UTC

This package is auto-updated.

Last update: 2024-09-16 15:31:03 UTC


README

Yii2 log module.
===================

Description
-----------
Manages system logs from web views.


Installation
------------

The preferred way to install this extension is through [composer](https://getcomposer.org.cn/download/).

Either run

```
php composer.phar require --prefer-dist bariew/yii2-module-abstract-log "*"
```

or add

```
"bariew/yii2-module-abstract-log": "*"
```

to the require section of your `composer.json` file.


Usage
-----

* Add log component target and module in the main config components section:
```
    'components' => [
    ...
        'log' => [
            'targets' => [
                [
                    'class' => 'yii\log\DbTarget',
                    'levels' => ['error', 'warning'],
                    'logTable' => '{{%log_error}}',
                    'except' => [
                        'yii\web\HttpException:404',
                        'yii\web\HttpException:403',
                        'yii\web\HttpException:400',
                        'yii\i18n\PhpMessageSource::loadMessages'
                    ],
                ],
            ]
        ]
    ],
    'modules' => [
        ...
        'log' => [
            'class' => 'bariew\logAbstractModule\Module'
        ]
    ],
```

* Apply migrations from the module migrations folder.

* Go to log/error/index URL