summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAnton Nizhegorodov <anizh3gorodov@gmail.com>2016-11-13 23:02:58 +0200
committerHaralan Dobrev <hkdobrev@gmail.com>2016-11-19 18:53:02 +0200
commit01a2ac25a2deddea55eada54b3a92eca90215866 (patch)
treee1810fd54da4e5435971d1d6604345ce689525fe /src
parent4ab8ed0a53fe308c6f1417ead393a3bada5e24fa (diff)
downloadmonolog-01a2ac25a2deddea55eada54b3a92eca90215866.zip
monolog-01a2ac25a2deddea55eada54b3a92eca90215866.tar.gz
monolog-01a2ac25a2deddea55eada54b3a92eca90215866.tar.bz2
Codereview fixes based on @stof comments
Diffstat (limited to 'src')
-rw-r--r--src/Monolog/Handler/Slack/SlackRecord.php21
-rw-r--r--src/Monolog/Handler/SlackHandler.php17
-rw-r--r--src/Monolog/Handler/SlackbotHandler.php9
3 files changed, 15 insertions, 32 deletions
diff --git a/src/Monolog/Handler/Slack/SlackRecord.php b/src/Monolog/Handler/Slack/SlackRecord.php
index 121dea1..7e3eb7c 100644
--- a/src/Monolog/Handler/Slack/SlackRecord.php
+++ b/src/Monolog/Handler/Slack/SlackRecord.php
@@ -35,7 +35,7 @@ class SlackRecord
/**
* Slack channel (encoded ID or name)
- * @var string
+ * @var string|null
*/
private $channel;
@@ -79,15 +79,8 @@ class SlackRecord
*/
private $lineFormatter;
- public function __construct(
- $channel,
- $username = 'Monolog',
- $useAttachment = true,
- $iconEmoji = null,
- $useShortAttachment = false,
- $includeContextAndExtra = false,
- FormatterInterface $formatter = null
- ) {
+ public function __construct($channel = null, $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $useShortAttachment = false, $includeContextAndExtra = false, FormatterInterface $formatter = null)
+ {
$this->channel = $channel;
$this->username = $username;
$this->iconEmoji = trim($iconEmoji, ':');
@@ -145,7 +138,7 @@ class SlackRecord
$attachment['fields'][] = array(
'title' => "Extra",
'value' => $this->stringify($record['extra']),
- 'short' => $this->useShortAttachment,
+ 'short' => true,
);
} else {
// Add all extra fields as individual fields in attachment
@@ -153,7 +146,7 @@ class SlackRecord
$attachment['fields'][] = array(
'title' => $var,
'value' => is_array($val) ? $this->lineFormatter->stringify($val) : $val,
- 'short' => $this->useShortAttachment,
+ 'short' => false,
);
}
}
@@ -164,7 +157,7 @@ class SlackRecord
$attachment['fields'][] = array(
'title' => "Context",
'value' => $this->stringify($record['context']),
- 'short' => $this->useShortAttachment,
+ 'short' => true,
);
} else {
// Add all context fields as individual fields in attachment
@@ -172,7 +165,7 @@ class SlackRecord
$attachment['fields'][] = array(
'title' => $var,
'value' => is_array($val) ? $this->lineFormatter->stringify($val) : $val,
- 'short' => $this->useShortAttachment,
+ 'short' => false,
);
}
}
diff --git a/src/Monolog/Handler/SlackHandler.php b/src/Monolog/Handler/SlackHandler.php
index 28fdfbe..e8d585a 100644
--- a/src/Monolog/Handler/SlackHandler.php
+++ b/src/Monolog/Handler/SlackHandler.php
@@ -46,21 +46,10 @@ class SlackHandler extends SocketHandler
* @param bool $includeContextAndExtra Whether the attachment should include context and extra data
* @throws MissingExtensionException If no OpenSSL PHP extension configured
*/
- public function __construct(
- $token,
- $channel,
- $username = 'Monolog',
- $useAttachment = true,
- $iconEmoji = null,
- $level = Logger::CRITICAL,
- $bubble = true,
- $useShortAttachment = false,
- $includeContextAndExtra = false
- ) {
+ public function __construct($token, $channel, $username = 'Monolog', $useAttachment = true, $iconEmoji = null, $level = Logger::CRITICAL, $bubble = true, $useShortAttachment = false, $includeContextAndExtra = false)
+ {
if (!extension_loaded('openssl')) {
- throw new MissingExtensionException(
- 'The OpenSSL PHP extension is required to use the SlackHandler'
- );
+ throw new MissingExtensionException('The OpenSSL PHP extension is required to use the SlackHandler');
}
parent::__construct('ssl://slack.com:443', $level, $bubble);
diff --git a/src/Monolog/Handler/SlackbotHandler.php b/src/Monolog/Handler/SlackbotHandler.php
index 0cea9c2..de6051b 100644
--- a/src/Monolog/Handler/SlackbotHandler.php
+++ b/src/Monolog/Handler/SlackbotHandler.php
@@ -40,10 +40,11 @@ class SlackbotHandler extends AbstractProcessingHandler
private $channel;
/**
- * @param string $token Slackbot token
- * @param string $channel Slack channel (encoded ID or name)
- * @param int $level The minimum logging level at which this handler will be triggered
- * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
+ * @param string $slackTeam Slack team slug
+ * @param string $token Slackbot token
+ * @param string $channel Slack channel (encoded ID or name)
+ * @param int $level The minimum logging level at which this handler will be triggered
+ * @param bool $bubble Whether the messages that are handled can bubble up the stack or not
*/
public function __construct(
$slackTeam,