diff --git a/src/Monolog/Handler/Slack/SlackRecord.php b/src/Monolog/Handler/Slack/SlackRecord.php index 3c64ef4b..95318849 100644 --- a/src/Monolog/Handler/Slack/SlackRecord.php +++ b/src/Monolog/Handler/Slack/SlackRecord.php @@ -96,12 +96,15 @@ class SlackRecord public function getSlackData(array $record) { $dataArray = array( - 'channel' => $this->channel, 'username' => $this->username, 'text' => '', 'attachments' => array(), ); + if ($this->channel) { + $dataArray['channel'] = $this->channel; + } + if ($this->formatter) { $message = $this->formatter->format($record); } else {