bariew/yii2-log-module

从Web视图进行日志管理

1.0.2 2022-11-25 07:17 UTC

This package is auto-updated.

Last update: 2024-08-25 11:09:31 UTC


README

描述

管理来自Web视图的系统日志。

安装

安装此扩展的首选方法是通过 Composer

运行以下命令之一

php composer.phar require --prefer-dist bariew/yii2-log-module "1.0.1"

或添加

"bariew/yii2-log-module": "1.0.1"

到你的 composer.json 文件的require部分。

用法

  • 在主配置文件中的components部分添加日志组件的目标和模块
    '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\logModule\Module'
        ]
    ],
  • 从模块迁移文件夹应用迁移

  • 访问log/error/index URL