mirror of
https://github.com/Seldaek/monolog.git
synced 2025-10-23 01:26:11 +02:00
Update SlackHandler tests && allow SlackRecord formatter change after construction
This commit is contained in:
committed by
Haralan Dobrev
parent
01a2ac25a2
commit
08b577c657
@@ -226,4 +226,14 @@ class SlackRecord
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the formatter
|
||||
*
|
||||
* @param FormatterInterface $formatter
|
||||
*/
|
||||
public function setFormatter(FormatterInterface $formatter)
|
||||
{
|
||||
$this->formatter = $formatter;
|
||||
}
|
||||
}
|
||||
|
@@ -11,6 +11,7 @@
|
||||
|
||||
namespace Monolog\Handler;
|
||||
|
||||
use Monolog\Formatter\FormatterInterface;
|
||||
use Monolog\Logger;
|
||||
use Monolog\Handler\Slack\SlackRecord;
|
||||
|
||||
@@ -178,4 +179,12 @@ class SlackHandler extends SocketHandler
|
||||
|
||||
return $this->slackRecord->stringify($fields);
|
||||
}
|
||||
|
||||
public function setFormatter(FormatterInterface $formatter)
|
||||
{
|
||||
parent::setFormatter($formatter);
|
||||
$this->slackRecord->setFormatter($formatter);
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user