Skip to content

Commit

Permalink
Trim log channel names. (#53554)
Browse files Browse the repository at this point in the history
  • Loading branch information
mathieutu authored Nov 18, 2024
1 parent d5cc423 commit 258ed58
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Illuminate/Log/LogManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,7 +633,7 @@ protected function parseDriver($driver)
$driver ??= 'null';
}

return $driver;
return trim($driver);
}

/**
Expand Down
19 changes: 19 additions & 0 deletions tests/Log/LogManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,25 @@ public function testStackChannel()
$this->assertTrue($handlers[1]->getBubble());
}

public function testParsingStackChannels()
{
$config = $this->app['config'];

$config->set('logging.channels.stack', [
'driver' => 'stack',
'channels' => 'single, daily, stderr',
]);

$manager = new LogManager($this->app);

$manager->channel('stack');

$this->assertSame(
array_keys($manager->getChannels()),
['single', 'daily', 'stderr', 'stack']
);
}

public function testLogManagerCreatesConfiguredMonologHandler()
{
$config = $this->app['config'];
Expand Down

0 comments on commit 258ed58

Please sign in to comment.