1 | <?php declare(strict_types = 1); |
||
7 | class LogDNAFormatter extends JsonFormatter |
||
8 | { |
||
9 | private $carbon; |
||
10 | private $environment; |
||
11 | |||
12 | /** |
||
13 | * LogDNAFormatter constructor. |
||
14 | * @param null $environment |
||
15 | * @param bool|int $batchMode |
||
16 | * @param bool $appendNewlines |
||
17 | */ |
||
18 | |||
19 | public function __construct($environment = null, $batchMode = self::BATCH_MODE_NEWLINES, $appendNewlines = false) |
||
25 | |||
26 | /** |
||
27 | * Format a single record |
||
28 | * |
||
29 | * @param array $record |
||
30 | * @return string |
||
31 | */ |
||
32 | |||
33 | public function format(array $record) :string |
||
40 | |||
41 | |||
42 | /** |
||
43 | * Batch a group of records, returning |
||
44 | * a json string |
||
45 | * |
||
46 | * @param array $records |
||
47 | * @return string |
||
48 | */ |
||
49 | |||
50 | public function formatBatch(array $records) |
||
60 | |||
61 | /** |
||
62 | * Helper function to format an individual log line for LogDNA |
||
63 | * |
||
64 | * @param array $record |
||
65 | * @return array |
||
66 | */ |
||
67 | |||
68 | private function formatLine(array $record) :array |
||
79 | } |
||
80 |