nfedoseev/yii2-external-target

External logs target for the Yii framework

This package's canonical repository appears to be gone and the package has been frozen as a result.

1.5.0 2016-07-17 20:41 UTC

This package is not auto-updated.

Last update: 2024-08-23 21:53:46 UTC


README

This extension provides the logging target for the Yii framework 2.0.

Latest Stable Version Total Downloads Yii2 License

Installation

The preferred way to install this extension is through composer.

Either run

php composer.phar require --prefer-dist nfedoseev/yii2-external-target

or add

"nfedoseev/yii2-external-target": "*"

to the require section of your composer.json.

Configuring application

After extension is installed you need to setup log target class:

    'components' => [
        'errorHandler' => [
            'errorAction' => 'site/error',
            'class' => 'nfedoseev\yii2\ExternalTarget\ErrorHandler',
        ],
        'logClient' => [
            'class' => 'nfedoseev\yii2\ExternalTarget\LogClient',
            'baseUrl' => 'your_logger_collector_url',
            'site' => 'your_site_identity',
            'user_id' => 'id',
            'ignore_statuses' => [200]
        ],
        'log' => [
            'traceLevel' => YII_DEBUG ? 3 : 0,
            'targets' => [
                [
                    'class' => 'nfedoseev\yii2\ExternalTarget\LogTarget',
                    'levels' => ['error'],
                    'categories' => ['yii\db\*', 'app\*'],
                ],
                ...
            ],
        ],
        ...
    ],
...