1
0
mirror of https://github.com/Seldaek/monolog.git synced 2025-08-06 13:16:39 +02:00

Update LogglyHandler.php

Updated to add an array_unique to ensure that tags are unique. For backwards compatibility, don't rename the protected property.
This commit is contained in:
barchard
2015-05-05 13:24:47 -04:00
parent 808d3bd86b
commit 5bdba762da

View File

@@ -29,7 +29,7 @@ class LogglyHandler extends AbstractProcessingHandler
protected $token;
protected $tags = array();
protected $tag = array();
public function __construct($token, $level = Logger::DEBUG, $bubble = true)
{
@@ -45,14 +45,14 @@ class LogglyHandler extends AbstractProcessingHandler
public function setTag($tag)
{
$tag = !empty($tag) ? $tag : array();
$this->tags = is_array($tag) ? $tag : array($tag);
$this->tag = is_array($tag) ? $tag : array($tag);
}
public function addTag($tag)
{
if (!empty($tag)) {
$tag = is_array($tag) ? $tag : array($tag);
$this->tags = array_merge($this->tags, $tag);
$this->tag = array_unique(array_merge($this->tag, $tag));
}
}
@@ -80,8 +80,8 @@ class LogglyHandler extends AbstractProcessingHandler
$headers = array('Content-Type: application/json');
if (!empty($this->tags)) {
$headers[] = 'X-LOGGLY-TAG: '.implode(',', $this->tags);
if (!empty($this->tag)) {
$headers[] = 'X-LOGGLY-TAG: '.implode(',', $this->tag);
}
$ch = curl_init();