From 5bdba762dac6df5124e7195b8fa17ce85a21e718 Mon Sep 17 00:00:00 2001 From: barchard Date: Tue, 5 May 2015 13:24:47 -0400 Subject: [PATCH] Update LogglyHandler.php Updated to add an array_unique to ensure that tags are unique. For backwards compatibility, don't rename the protected property. --- src/Monolog/Handler/LogglyHandler.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Monolog/Handler/LogglyHandler.php b/src/Monolog/Handler/LogglyHandler.php index cac2b489..9785cec0 100644 --- a/src/Monolog/Handler/LogglyHandler.php +++ b/src/Monolog/Handler/LogglyHandler.php @@ -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();