Skip to content

Commit

Permalink
slack log driver
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 18, 2018
1 parent 8b7748b commit e691230
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/Illuminate/Log/LogManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Monolog\Handler\ErrorLogHandler;
use Monolog\Handler\HandlerInterface;
use Monolog\Handler\RotatingFileHandler;
use Monolog\Handler\SlackWebhookHandler;

class LogManager implements LoggerInterface
{
Expand Down Expand Up @@ -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.
*
Expand Down

0 comments on commit e691230

Please sign in to comment.