Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/peopleperhour/yiilogextension
https://github.com/peopleperhour/yiilogextension
Last synced: about 6 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/peopleperhour/yiilogextension
- Owner: PeoplePerHour
- Created: 2016-01-27T13:38:19.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2016-01-27T13:50:12.000Z (almost 9 years ago)
- Last Synced: 2024-03-26T19:28:45.311Z (8 months ago)
- Language: PHP
- Size: 7.81 KB
- Stars: 0
- Watchers: 5
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
PeoplePerHour/YiiLogExtension
=============================[![Build Status](https://travis-ci.org/travis-ci/travis-web.svg?branch=master)](https://travis-ci.org/travis-ci/travis-web)
YiiLogExtension is a component that extends Yii::log functionality to handle arrays and exceptions and output in files in JSON format. Finally handles log rotation.
## Usage Example
### Register JsonLogger in your log route configuration
```php
array(
'class' =>'JsonLogger',
'categories' =>'category_key',
'logFile' =>'output.json', // File to be parsed by logstash
'logPath' =>dirname(__FILE__).'/../../logs',
'maxFileSize' =>5120,
'maxLogFiles' =>50,
)
```Use LogWrapper, which extends Yii::log functionality
```php
LogWrapper::log('dummy message', 'error_level', 'category_key')
LogWrapper::logArray($array, 'error_level', 'category_key')
LogWrapper::logException($exc, 'error_level', 'category_key')
```## Test repository
```bash
docker-compose run phpunit tests
```