diff --git a/src/Illuminate/Log/LogManager.php b/src/Illuminate/Log/LogManager.php index 64dd238728e5..c93bd93d54e1 100644 --- a/src/Illuminate/Log/LogManager.php +++ b/src/Illuminate/Log/LogManager.php @@ -14,6 +14,7 @@ use Monolog\Handler\ErrorLogHandler; use Monolog\Handler\HandlerInterface; use Monolog\Handler\RotatingFileHandler; +use Monolog\Handler\SlackWebhookHandler; class LogManager implements LoggerInterface { @@ -260,6 +261,28 @@ protected function createDailyDriver(array $config) ]); } + /** + * Create an instance of the Slack log driver. + * + * @param array $config + * @return \Psr\Log\LoggerInterface + */ + protected function createSlackDriver(array $config) + { + return new Monolog($this->parseChannel($config), [ + $this->prepareHandler(new SlackWebhookHandler( + $config['url'], + $config['channel'] ?? null, + $config['username'] ?? 'Laravel', + $config['attachment'] ?? true, + $config['emoji'] ?? ':boom:', + $config['short'] ?? false, + $config['context'] ?? true, + $this->level($config) + )), + ]); + } + /** * Create an instance of the syslog log driver. *