Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/peopleperhour/yiilogextension


https://github.com/peopleperhour/yiilogextension

Last synced: about 6 hours ago
JSON representation

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
```