Merge branch 'fix/sql_function' into 'master'

兼容sql function

See merge request composer/php-sql-logger!1
This commit is contained in:
李思达 2019-03-25 10:58:30 +08:00
commit 74b4bdaf99

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']);
}
}