This commit is contained in:
候学杰 2018-05-02 20:55:02 +08:00
parent 1bf977af39
commit 2424ffcabb

View File

@ -9,6 +9,9 @@ use Monolog\Logger;
class QueryListener class QueryListener
{ {
protected $logger;
/** /**
* Create the event listener. * Create the event listener.
* *
@ -34,7 +37,7 @@ class QueryListener
if (env('APP_DEBUG')) { if (env('APP_DEBUG')) {
$sql = str_replace("?", "'%s'", $event->sql); $sql = str_replace("?", "'%s'", $event->sql);
$log = vsprintf($sql, $event->bindings); $log = vsprintf($sql, $event->bindings);
$this->logger->info($log); $this->logger->info($log, ['conn' => $event->connectionName, 'time' => $event->time]);
} }
} }