ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
RedisHandler.php
Go to the documentation of this file.
1<?php
2
3/*
4 * This file is part of the Monolog package.
5 *
6 * (c) Jordi Boggiano <j.boggiano@seld.be>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Monolog\Handler;
13
16
29{
30 private $redisClient;
31 private $redisKey;
32
39 public function __construct($redis, $key, $level = Logger::DEBUG, $bubble = true)
40 {
41 if (!(($redis instanceof \Predis\Client) || ($redis instanceof \Redis))) {
42 throw new \InvalidArgumentException('Predis\Client or Redis instance required');
43 }
44
45 $this->redisClient = $redis;
46 $this->redisKey = $key;
47
48 parent::__construct($level, $bubble);
49 }
50
51 protected function write(array $record)
52 {
53 $this->redisClient->rpush($this->redisKey, $record["formatted"]);
54 }
55
59 protected function getDefaultFormatter()
60 {
61 return new LineFormatter();
62 }
63}
Formats incoming records into a one-line string.
Base Handler class providing the Handler structure.
Logs to a Redis key using rpush.
__construct($redis, $key, $level=Logger::DEBUG, $bubble=true)
write(array $record)
Writes the record down to the log of the implementing handler.
getDefaultFormatter()
Gets the default formatter.FormatterInterface
Monolog log channel.
Definition: Logger.php:28
const DEBUG
Detailed debug information.
Definition: Logger.php:32