think-orm
think-orm copied to clipboard
【优化】关于DbManager中log, getDbLog
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; }