2017 © Pedro Peláez
 

yii2-extension yii2-redis-log

Yii2 log redisTarget

image

kriss/yii2-redis-log

Yii2 log redisTarget

  • Sunday, February 11, 2018
  • by kriss
  • Repository
  • 1 Watchers
  • 0 Stars
  • 43 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 6 Versions
  • 5 % Grown

The README.md

Yii2 log redisTarget

Yii2 log for redisTarget and dump redisLog to FileTarget., (*1)

Installation

The preferred way to install this extension is through composer., (*2)

Either run, (*3)

php composer.phar require --prefer-dist kriss/yii2-redis-log -vvv

or add, (*4)

"kriss/yii2-redis-log": "*"

to the require section of your composer.json file., (*5)

Simple Usage

  1. config config file
'log' => [
    'targets' => [
        [
            'class' => 'kriss\log\RedisTarget',
            'redis' => [
                'hostname' => 'localhost',
                'port' => 6379,                        
            ],
            // If you have configured the redis yii\redis\Connection as an application component,use bwlow
            //'redis' => 'redis',
            'key' => 'yii.log',
            'levels' => ['error', 'warning'],
        ],
    ]
]
  1. use Yii common Logger component like :
Yii::error('this is en error');
  1. now you see log in your redis

Dump Redis Log to File

  1. config
'log' => [
    'targets' => [
        [
            'class' => 'kriss\log\RedisTarget',
            'redis' => 'redis',
            'key' => 'yii.log',
            'dumpFileTarget' => [
                'logFile' => '@common/runtime/logs/error.log',
            ],
            'levels' => ['error', 'warning'],
        ],
    ]
]

2.1. Dump One, (*6)

$dumper = new Dump2File([
  'redisTargetKey' => 'yii.log',
]);
$dumper->dump();

2.2. Dump From Yii Log Target, (*7)

$targets = Yii::$app->log->targets;
foreach ($targets as $target) {
    if ($target instanceof RedisTarget) {
        $dumper = new Dump2File([
            'redisTarget' => $target,
            'count' => 1000
        ]);
        $dumper->dump();
    }
}

The Versions

11/02 2018

dev-analysis-XZPoPP

dev-analysis-XZPoPP

Yii2 log redisTarget

  Sources   Download

MIT

The Requires

 

by Avatar kriss

log extension yii2 redistarget

21/12 2017

dev-master

9999999-dev

Yii2 log redisTarget

  Sources   Download

MIT

The Requires

 

by Avatar kriss

log extension yii2 redistarget

19/09 2017

v1.3

1.3.0.0

Yii2 log redisTarget

  Sources   Download

MIT

The Requires

 

by Avatar kriss

log extension yii2 redistarget

04/08 2017

v1.2

1.2.0.0

Yii2 log redisTarget

  Sources   Download

MIT

The Requires

 

by Avatar kriss

log extension yii2 redistarget

03/08 2017

v1.1

1.1.0.0

Yii2 log redisTarget

  Sources   Download

MIT

The Requires

 

by Avatar kriss

log extension yii2 redistarget

03/08 2017

v1.0

1.0.0.0

Yii2 log redisTarget

  Sources   Download

MIT

The Requires

 

by Avatar kriss

log extension yii2 redistarget