lengnuan-v/yii2-log-reader

yii2,extension,log,reader

Installs: 3

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:yii2-extension

dev-master 2021-09-28 01:43 UTC

This package is auto-updated.

Last update: 2024-05-28 08:15:27 UTC


README

yii2,extension,log,reader

Installation

The preferred way to install this extension is through composer.

Either run

composer require --prefer-dist lengnuan-v/yii2-log-reader "dev-master"

or add

"lengnuan-v/yii2-log-reader": "*"

to the require section of your composer.json file.

Usage

Once the extension is installed, simply use it in your code by :

return [
    'log'         => [
        'class'   => 'lengnuan\logReader\Module',
        'layout'  => "@views/layouts/main",
        'aliases' => [
            'Backend'  => '@backend/runtime/logs/app.log',
            'Frontend' => '@frontend/runtime/logs/app.log',
            'Console'  => '@console/runtime/logs/app.log',
        ],
    ],
];

You can then access Log Reader using the following URL:

http://localhost/path/to/index.php?r=log-reader

or if you have enabled pretty URLs, you may use the following URL:

http://localhost/path/to/log-reader

History Usage

For every day log view, you can config yii log like this:

[
    'class'   => 'yii\log\FileTarget',
    'levels'  => ['error', 'warning'],
    'logFile' => '@runtime/logs/app.log',
]