Skip to content

Commit 7ba0c22

Browse files
committed
support aggregate drivers
1 parent 8f89eac commit 7ba0c22

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

src/Illuminate/Log/LogManager.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ public function driver($driver = null)
9696
protected function get($name)
9797
{
9898
try {
99-
return $this->stores[$name] ?? with($this->resolve($name), function ($monolog) use ($name) {
100-
return $this->tap($name, new Logger($monolog, $this->app['events']));
99+
return $this->stores[$name] ?? with($this->resolve($name), function ($logger) use ($name) {
100+
return $this->tap($name, new Logger($logger, $this->app['events']));
101101
});
102102
} catch (Throwable $e) {
103103
return tap($this->createEmergencyLogger(), function ($logger) use ($e) {
@@ -200,6 +200,21 @@ protected function createCustomDriver(array $config)
200200
return $this->app->make($config['via'])->__invoke($config);
201201
}
202202

203+
/**
204+
* Create a aggregate log driver instance.
205+
*
206+
* @param array $config
207+
* @return \Psr\Log\LoggerInterface
208+
*/
209+
protected function createAggregateDriver(array $config)
210+
{
211+
$handlers = collect($config['channels'])->flatMap(function ($channel) {
212+
return $this->channel($channel)->getHandlers();
213+
})->all();
214+
215+
return new Monolog($this->parseChannel($config), $handlers);
216+
}
217+
203218
/**
204219
* Create an instance of the single file log driver.
205220
*

0 commit comments

Comments
 (0)