Skip to content

Commit

Permalink
修正获取未定义 logger 失败的bug
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouyl committed Nov 24, 2018
1 parent d6d6551 commit 8b94cc0
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/LoggerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,12 @@ public function add($channel, LoggerInterface $logger)
*/
public function get($channel = null)
{
$channel = empty($channel) ? $this->getDefault() : $channel;
if (empty($channel) || ! isset($this->loggers[$channel])) {
$channel = $this->getDefault();
}

if (! isset($this->instances[$channel])) {
$this->instances[$channel] = $this->make(
isset($this->loggers[$channel]) ? $channel : $this->getDefault(),
$this->loggers[$channel] ? $this->loggers[$channel] : []
);
$this->instances[$channel] = $this->make($channel, $this->loggers[$channel]);
}

return $this->instances[$channel];
Expand Down

0 comments on commit 8b94cc0

Please sign in to comment.