26 const HOST =
'logs-01.loggly.com';
36 if (!extension_loaded(
'curl')) {
37 throw new \LogicException(
'The curl extension is needed to use the LogglyHandler');
55 $this->tag = array_unique(array_merge($this->tag,
$tag));
61 $this->
send($record[
"formatted"], self::ENDPOINT_SINGLE);
68 $records = array_filter($records,
function ($record) use (
$level) {
69 return ($record[
'level'] >=
$level);
73 $this->
send($this->
getFormatter()->formatBatch($records), self::ENDPOINT_BATCH);
79 $url = sprintf(
"https://%s/%s/%s/", self::HOST, $endpoint, $this->token);
81 $headers =
array(
'Content-Type: application/json');
83 if (!empty($this->tag)) {
84 $headers[] =
'X-LOGGLY-TAG: '.implode(
',', $this->tag);
89 curl_setopt($ch, CURLOPT_URL,
$url);
90 curl_setopt($ch, CURLOPT_POST,
true);
91 curl_setopt($ch, CURLOPT_POSTFIELDS,
$data);
92 curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
93 curl_setopt($ch, CURLOPT_RETURNTRANSFER,
true);
const DEBUG
Detailed debug information.
Base Handler class providing the Handler structure.
__construct($token, $level=Logger::DEBUG, $bubble=true)
static execute($ch, $retries=5, $closeAfterDone=true)
Executes a CURL request with optional retries and exception on failure.
handleBatch(array $records)
Handles a set of records at once.
getFormatter()
{Gets the formatter.FormatterInterface}
Create styles array
The data for the language used.