兼容sql function

This commit is contained in:
lisida 2019-03-25 10:15:30 +08:00
parent 211ff1de4a
commit c743240d63

View File

@ -35,7 +35,8 @@ class QueryListener
{
if (env('APP_DEBUG')) {
$sql = str_replace("?", "'%s'", $event->sql);
$this->logger->debug(vsprintf($sql, $event->bindings), ['conn' => $event->connectionName, 'time' => $event->time.'ms']);
$log = $event->bindings ? vsprintf($sql, $event->bindings) : $sql;
$this->logger->debug($log, ['conn' => $event->connectionName, 'time' => $event->time.'ms']);
}
}