From 40c336bc0544fdbc2c93ff7ceb51c5e01b81241b Mon Sep 17 00:00:00 2001 From: Jan De Coster Date: Sat, 24 Oct 2015 13:12:45 +0200 Subject: [PATCH 1/7] Updated Monolog/Slackhandler Implemented support for attachment in the Slack monolog handler --- Monolog/Handler/SlackHandler.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Monolog/Handler/SlackHandler.php b/Monolog/Handler/SlackHandler.php index 3758a8f..9ab098d 100644 --- a/Monolog/Handler/SlackHandler.php +++ b/Monolog/Handler/SlackHandler.php @@ -3,6 +3,7 @@ namespace DZunke\SlackBundle\Monolog\Handler; use DZunke\SlackBundle\Slack\Messaging; +use DZunke\SlackBundle\Slack\Entity\MessageAttachment; use Monolog\Formatter\LineFormatter; use Monolog\Handler\AbstractProcessingHandler; use Monolog\Logger; @@ -47,7 +48,11 @@ public function __construct(Messaging $messaging, $channel, $username, $level = protected function write(array $record) { - $this->messagingClient->message($this->channel, $record["formatted"], $this->username); + $attachment = new MessageAttachment(); + $attachment->setColor('danger'); + $attachment->addField('Error', $record['formatted']); + + $this->messagingClient->message($this->channel, '', $this->username, [$attachment]); } /** From ef550bba8dd40450b7acda0d4a9d29fd3eaafc37 Mon Sep 17 00:00:00 2001 From: Jan De Coster Date: Sat, 28 Nov 2015 11:12:57 +0100 Subject: [PATCH 2/7] Update SlackHandler.php --- Monolog/Handler/SlackHandler.php | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/Monolog/Handler/SlackHandler.php b/Monolog/Handler/SlackHandler.php index 9ab098d..cbb8217 100644 --- a/Monolog/Handler/SlackHandler.php +++ b/Monolog/Handler/SlackHandler.php @@ -2,8 +2,8 @@ namespace DZunke\SlackBundle\Monolog\Handler; -use DZunke\SlackBundle\Slack\Messaging; use DZunke\SlackBundle\Slack\Entity\MessageAttachment; +use DZunke\SlackBundle\Slack\Messaging; use Monolog\Formatter\LineFormatter; use Monolog\Handler\AbstractProcessingHandler; use Monolog\Logger; @@ -49,8 +49,25 @@ public function __construct(Messaging $messaging, $channel, $username, $level = protected function write(array $record) { $attachment = new MessageAttachment(); - $attachment->setColor('danger'); - $attachment->addField('Error', $record['formatted']); + + switch($record['level']) { + case Logger::DEBUG: + case Logger::INFO: + $attachment->setColor('good'); + break; + case Logger::NOTICE: + case Logger::WARNING: + $attachment->setColor('warning'); + break; + case Logger::ERROR: + case Logger::CRITICAL: + case Logger::ALERT: + case Logger::EMERGENCY: + $attachment->setColor('danger'); + break; + } + + $attachment->addField($record['level_name'], $record['formatted']); $this->messagingClient->message($this->channel, '', $this->username, [$attachment]); } From 1b4171495e1c33bd52a626b0914612edd372b2fb Mon Sep 17 00:00:00 2001 From: Denis Zunke Date: Thu, 10 Dec 2015 09:38:32 +0100 Subject: [PATCH 3/7] Update changelog with merged PR #5 --- CHANGELOG | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 4490db5..68d31aa 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +SlackBundle Dev-Pending +================== +- Feature: Monolog-Logger uses colored attachments based on the log level (by @jdecoster) + SlackBundle v1.3.0 ================== - Feature: File upload service now accepts an array of channels, string usage is deprecated From c6885b132ecc5e60810097803c94760d99c0e070 Mon Sep 17 00:00:00 2001 From: carlosmasip Date: Mon, 28 Dec 2015 12:49:19 +0100 Subject: [PATCH 4/7] Quoting service arguments to avoid a warning in Symfony>=2.8 --- Resources/config/services.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Resources/config/services.yml b/Resources/config/services.yml index 85a0e42..b984113 100644 --- a/Resources/config/services.yml +++ b/Resources/config/services.yml @@ -8,16 +8,16 @@ services: dz.slack.client: class: DZunke\SlackBundle\Slack\Client - arguments: [@dz.slack.connection] + arguments: ["@dz.slack.connection"] dz.slack.messaging: class: DZunke\SlackBundle\Slack\Messaging - arguments: [@dz.slack.client, @dz.slack.identity_bag] + arguments: ["@dz.slack.client", "@dz.slack.identity_bag"] dz.slack.channels: class: DZunke\SlackBundle\Slack\Channels - arguments: [@dz.slack.client] + arguments: ["@dz.slack.client"] dz.slack.users: class: DZunke\SlackBundle\Slack\Users - arguments: [@dz.slack.client] + arguments: ["@dz.slack.client"] From ba1f251a47dbe2e9fdd26f49bfcc7edfb2fc9833 Mon Sep 17 00:00:00 2001 From: Denis Zunke Date: Wed, 6 Jan 2016 20:44:30 +0100 Subject: [PATCH 5/7] Update changelog with merged PR #11 --- CHANGELOG | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG b/CHANGELOG index 68d31aa..a359ddb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,6 +1,7 @@ SlackBundle Dev-Pending ================== - Feature: Monolog-Logger uses colored attachments based on the log level (by @jdecoster) +- Patch: Quoting Services to Support Symfony > 2.8 (by @carlosmasip) SlackBundle v1.3.0 ================== From f564a04342e68b6b61402a92aa7a639d5caf4548 Mon Sep 17 00:00:00 2001 From: Denis Zunke Date: Fri, 12 Feb 2016 22:45:06 +0100 Subject: [PATCH 6/7] Fix deprecations and enable symfony 3 --- DependencyInjection/Configuration.php | 2 +- composer.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index 0fc2bd3..db421b1 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -27,7 +27,7 @@ public function getConfigTreeBuilder() ->end() ->integerNode('limit_retries') ->defaultValue(3) - ->cannotBeEmpty() + ->min(1) ->info('The amount of retries for the connection if the Rate Limits of Slack are reached') ->end() ->end(); diff --git a/composer.json b/composer.json index f898737..a2d9d9c 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,8 @@ "exclude": ["/Tests"] }, "require": { - "php": ">=5.4.0", + "php": ">=5.4", + "symfony/symfony": "~2.3|~3.0", "guzzle/guzzle": ">=3.7.0" }, "autoload": { From 25bd3486122fb3b5f21efd4fb890480520c51103 Mon Sep 17 00:00:00 2001 From: Denis Zunke Date: Fri, 12 Feb 2016 22:47:09 +0100 Subject: [PATCH 7/7] Update changelog for v1.4.0 release --- CHANGELOG | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index a359ddb..b579a06 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,7 +1,9 @@ -SlackBundle Dev-Pending +SlackBundle v1.4.0 ================== - Feature: Monolog-Logger uses colored attachments based on the log level (by @jdecoster) - Patch: Quoting Services to Support Symfony > 2.8 (by @carlosmasip) +- Patch: Fix deprecation in configuration +- Patch: Enable Symfony 3.0 and PHP 7 SlackBundle v1.3.0 ==================