]> scripts.mit.edu Git - autoinstallsdev/mediawiki.git/blob - vendor/liuggio/statsd-php-client/src/Liuggio/StatsdClient/Sender/SysLogSender.php
MediaWiki 1.30.2
[autoinstallsdev/mediawiki.git] / vendor / liuggio / statsd-php-client / src / Liuggio / StatsdClient / Sender / SysLogSender.php
1 <?php
2
3 namespace Liuggio\StatsdClient\Sender;
4
5
6 Class SysLogSender implements SenderInterface
7 {
8     private $priority;
9
10     public function __construct($priority = LOG_INFO)
11     {
12         $this->priority = $priority;
13     }
14
15     /**
16      * {@inheritDoc}
17      */
18     public function open()
19     {
20         syslog($this->priority, "statsd-client-open");
21
22         return true;
23     }
24
25     /**
26      * {@inheritDoc}
27      */
28     function write($handle, $message, $length = null)
29     {
30         syslog($this->priority, sprintf("statsd-client-write \"%s\" %d Bytes", $message, strlen($message)));
31
32         return strlen($message);
33     }
34
35     /**
36      * {@inheritDoc}
37      */
38     function close($handle)
39     {
40         syslog($this->priority, "statsd-client-close");
41     }
42 }