diff --git a/README.md b/README.md index e69de29..04b66db 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,81 @@ +# Monolog integration for Yii 1.x + +Inspired by [enlitepro/enlite-monolog](https://github.com/enlitepro/enlite-monolog) and [smartapps-fr/yii-monolog](https://github.com/smartapps-fr/yii-monolog) + +## Install + +The recommended way to install is through composer from command line. + +``` +composer require asuran/yii-monolog +``` + +## Usage + +1. Add the component to the preload list + +```php + [ + 'monolog', + ], +]; +``` + +2. Configure the component + +```php + [ + 'monolog' => [ + 'class' => 'YiiMonolog\MonologComponent', + 'name' => 'MyApplication', + 'handlers' => [ + 'file' => [ + 'class' => 'Monolog\Handler\StreamHandler', + 'stream' => '/runtime/app.log', + 'formatter' => 'Monolog\Formatter\LineFormatter', + ], + ], + 'processors' => [ + 'Monolog\Processor\ProcessIdProcessor', + ], + ], + ], +]; +``` + +3. Add log route + +```php + [ + 'log' => [ + 'class' => 'CLogRouter', + 'routes' => [ + 'monolog' => [ + 'class' => 'YiiMonolog\MonologLogRoute', + ], + ], + ], + ], +]; + +``` + +4. Add exception handler +```php + [ + 'errorHandler' => [ + 'class' => 'YiiMonolog\MonologErrorHandler', + 'errorAction' => 'site/error', + ], + ], +]; +``` \ No newline at end of file diff --git a/composer.json b/composer.json index d138351..05822ef 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,15 @@ { "name": "asuran/yii-monolog", "description": "Extension for using monolog with yii 1.x", - "type": "project", + "keywords": ["monolog", "yii", "log", "error", "exception", "debug", "monitoring"], + "type": "package", + "license": "GPL-3.0", + "authors": [ + { + "name": "Dmitriy Sergeev", + "email": "dm.s.s@yandex.ru" + } + ], "require": { "php": ">=5.4", "yiisoft/yii": "~1.1.14",