protected function flush()
{
if (headers_sent($file, $line) && $this->options['triggerError']) {
trigger_error("Cannot send FireLogger headers after output has been sent" . ($file ? " (output started at {$file}:{$line})." : "."), \E_USER_WARNING);
return;
}
$logs = $this->logs;
// final encoding
$id = dechex(mt_rand(0, 0xffff)) . dechex(mt_rand(0, 0xffff));
// mt_rand is not working with 0xFFFFFFFF
$json = json_encode(['logs' => $logs]);
$res = str_split(base64_encode($json), 76);
// RFC 2045
foreach ($res as $k => $v) {
header("FireLogger-{$id}-{$k}:{$v}");
}
$this->logs = [];
}