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));
59 protected function write(array $record)
61 $this->
send($record[
"formatted"], self::ENDPOINT_SINGLE);
69 return ($record[
'level'] >=
$level);
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);
getFormatter()
{Gets the formatter.FormatterInterface}
Base Handler class providing the Handler structure.
static execute($ch, $retries=5, $closeAfterDone=true)
Executes a CURL request with optional retries and exception on failure.
getDefaultFormatter()
Gets the default formatter.
__construct($token, $level=Logger::DEBUG, $bubble=true)
write(array $record)
Writes the record down to the log of the implementing handler.
handleBatch(array $records)
{{Handles a set of records at once.}}
const DEBUG
Detailed debug information.