PluginProbe
ManageWP Worker / 4.9.25
ManageWP Worker v4.9.25
4.9.38 4.9.37 4.9.36 4.9.35 4.9.34 3.8.7 3.8.8 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.18 3.9.19 3.9.2 3.9.20 3.9.21 3.9.22 3.9.23 3.9.24 All 73 releases
worker / src / Monolog / Handler / LegacyGelfHandler.php

LegacyGelfHandler.php in ManageWP Worker 4.9.25, at src/Monolog/Handler/LegacyGelfHandler.php

60 lines 1.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 /**
13 * Handler to send messages to a Graylog2 (http://www.graylog2.org) server
14 *
15 * @author Matt Lehner <mlehner@gmail.com>
16 */
17 class Monolog_Handler_LegacyGelfHandler extends Monolog_Handler_AbstractProcessingHandler
18 {
19 /**
20 * @var Gelf_Publisher the publisher object that sends the message to the server
21 */
22 protected $publisher;
23
24 /**
25 * @param Gelf_Publisher $publisher a publisher object
26 * @param integer $level The minimum logging level at which this handler will be triggered
27 * @param Boolean $bubble Whether the messages that are handled can bubble up the stack or not
28 */
29 public function __construct(Gelf_Publisher $publisher, $level = Monolog_Logger::DEBUG, $bubble = true)
30 {
31 parent::__construct($level, $bubble);
32
33 $this->publisher = $publisher;
34 }
35
36 /**
37 * {@inheritdoc}
38 */
39 public function close()
40 {
41 $this->publisher = null;
42 }
43
44 /**
45 * {@inheritdoc}
46 */
47 protected function write(array $record)
48 {
49 $this->publisher->publish($record['formatted']);
50 }
51
52 /**
53 * {@inheritDoc}
54 */
55 protected function getDefaultFormatter()
56 {
57 return new Monolog_Formatter_LegacyGelfMessageFormatter();
58 }
59 }
60