dir = $filesystem->getDirectoryWrite(DirectoryList::VAR_DIR); $this->debugFile = $debugFile; } /** * {@inheritdoc} */ public function log($str) { $str = '## ' . date('Y-m-d H:i:s') . "\r\n" . $str; $stream = $this->dir->openFile($this->debugFile, 'a'); $stream->lock(); $stream->write($str); $stream->unlock(); $stream->close(); } /** * {@inheritdoc} */ public function logStats($type, $sql, $bind = [], $result = null) { $stats = $this->getStats($type, $sql, $bind, $result); if ($stats) { $this->log($stats); } } /** * {@inheritdoc} */ public function critical(\Exception $e) { $this->log("EXCEPTION \n$e\n\n"); } }