1 | <?php declare(strict_types=1); |
||
9 | final class LogglyBulkLogger extends AbstractLogglyLogger |
||
10 | { |
||
11 | const LF = "\r\n"; |
||
12 | const MAX_BODY_LENGTH = 5242880; |
||
13 | const MAX_LINE_LENGTH = 1048576; |
||
14 | |||
15 | /** |
||
16 | * @var LoopInterface |
||
17 | */ |
||
18 | private $loop; |
||
19 | |||
20 | /** |
||
21 | * @var Client |
||
22 | */ |
||
23 | private $httpClient; |
||
24 | |||
25 | /** |
||
26 | * @var string |
||
27 | */ |
||
28 | private $token; |
||
29 | |||
30 | /** |
||
31 | * @var float |
||
32 | */ |
||
33 | private $timeout; |
||
34 | |||
35 | /** |
||
36 | * @var string[] |
||
37 | */ |
||
38 | private $buffer = []; |
||
39 | |||
40 | /** |
||
41 | * @var int |
||
42 | */ |
||
43 | private $bufferSize = 0; |
||
44 | |||
45 | /** |
||
46 | * @var TimerInterface |
||
47 | */ |
||
48 | private $timer; |
||
49 | |||
50 | 12 | private function __construct(LoopInterface $loop, Client $httpClient, string $token, float $timeout) |
|
57 | |||
58 | public static function create(LoopInterface $loop, string $token, float $timeout = 5.3): self |
||
64 | |||
65 | 12 | public static function createFromHttpClient( |
|
73 | |||
74 | 12 | protected function send(string $data) |
|
89 | |||
90 | 12 | private function ensureTimer() |
|
101 | |||
102 | 12 | private function sendBulk() |
|
124 | } |
||
125 |