think-orm icon indicating copy to clipboard operation
think-orm copied to clipboard

【优化】关于DbManager中log, getDbLog

Open stopfoot opened this issue 3 years ago • 0 comments

public function log(string $log, string $type = 'sql') { if ($this->log) { $this->log->log($type, $log); } else { $this->dbLog[$type][] = $log; } }

这段代码中,当有 $this->log时,日志就无法进入$this->dbLog 实际使用中,$this->log 由facade初始化默认有。除非重新set。 这与文档说明的支持的多通道有些差异。

建议调整为: public function log(string $log, string $type = 'sql') { if ($this->log) { $this->log->log($type, $log); } $this->dbLog[$type][] = $log; }

stopfoot avatar Jan 28 '22 07:01 stopfoot