Skip to content

Commit

Permalink
support aggregate drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Jan 16, 2018
1 parent 8f89eac commit 7ba0c22
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions src/Illuminate/Log/LogManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ public function driver($driver = null)
protected function get($name)
{
try {
return $this->stores[$name] ?? with($this->resolve($name), function ($monolog) use ($name) {
return $this->tap($name, new Logger($monolog, $this->app['events']));
return $this->stores[$name] ?? with($this->resolve($name), function ($logger) use ($name) {
return $this->tap($name, new Logger($logger, $this->app['events']));
});
} catch (Throwable $e) {
return tap($this->createEmergencyLogger(), function ($logger) use ($e) {
Expand Down Expand Up @@ -200,6 +200,21 @@ protected function createCustomDriver(array $config)
return $this->app->make($config['via'])->__invoke($config);
}

/**
* Create a aggregate log driver instance.
*
* @param array $config
* @return \Psr\Log\LoggerInterface
*/
protected function createAggregateDriver(array $config)
{
$handlers = collect($config['channels'])->flatMap(function ($channel) {
return $this->channel($channel)->getHandlers();
})->all();

return new Monolog($this->parseChannel($config), $handlers);
}

/**
* Create an instance of the single file log driver.
*
Expand Down

0 comments on commit 7ba0c22

Please sign in to comment.