Total Complexity | 4 |
Total Lines | 23 |
Duplicated Lines | 0 % |
Coverage | 0% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
13 | class TelegrafHandler extends AbstractProcessingHandler |
||
14 | { |
||
15 | private $measurement; |
||
16 | private $socket; |
||
17 | |||
18 | public function __construct($host, $port, ?string $measurement, $level = Logger::INFO, $bubble = true) |
||
19 | { |
||
20 | parent::__construct($level, $bubble); |
||
21 | |||
22 | $this->measurement = $measurement ?? InfluxDBHandler::POINT_MEASUREMENT; |
||
23 | $this->socket = new UDP($host, $port); |
||
24 | } |
||
25 | |||
26 | protected function write(array $record): void |
||
27 | { |
||
28 | foreach ($record['formatted'] as $record) { |
||
29 | $this->socket->write((string) $record); |
||
30 | } |
||
31 | } |
||
32 | |||
33 | protected function getDefaultFormatter(): FormatterInterface |
||
36 | } |
||
37 | } |
||
38 |