ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
GelfHandler.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 
12 namespace Monolog\Handler;
13 
16 use Gelf\Publisher;
18 use Monolog\Logger;
20 
28 {
32  protected $publisher;
33 
39  public function __construct($publisher, $level = Logger::DEBUG, $bubble = true)
40  {
41  parent::__construct($level, $bubble);
42 
43  if (!$publisher instanceof Publisher && !$publisher instanceof IMessagePublisher && !$publisher instanceof PublisherInterface) {
44  throw new InvalidArgumentException('Invalid publisher, expected a Gelf\Publisher, Gelf\IMessagePublisher or Gelf\PublisherInterface instance');
45  }
46 
47  $this->publisher = $publisher;
48  }
49 
53  public function close()
54  {
55  $this->publisher = null;
56  }
57 
61  protected function write(array $record)
62  {
63  $this->publisher->publish($record['formatted']);
64  }
65 
69  protected function getDefaultFormatter()
70  {
71  return new GelfMessageFormatter();
72  }
73 }
write(array $record)
{}
Definition: GelfHandler.php:61
const DEBUG
Detailed debug information.
Definition: Logger.php:32
Serializes a log message to GELF.
Base Handler class providing the Handler structure.
Handler to send messages to a Graylog2 (http://www.graylog2.org) server.
Definition: GelfHandler.php:27
Create styles array
The data for the language used.
__construct($publisher, $level=Logger::DEBUG, $bubble=true)
Definition: GelfHandler.php:39