add request id

This commit is contained in:
候学杰 2018-05-03 17:58:02 +08:00
parent 2c83fc85a2
commit 09457a3f11

View File

@ -37,7 +37,9 @@ class QueryListener
if (env('APP_DEBUG')) {
$sql = str_replace("?", "'%s'", $event->sql);
$log = vsprintf($sql, $event->bindings);
$this->logger->info($log.';', ['conn' => $event->connectionName, 'time' => $event->time.'ms']);
$requestId = app('request')->header('x-request-id');
$text = "$requestId\t$log\t";
$this->logger->debug($text, ['conn' => $event->connectionName, 'time' => $event->time.'ms']);
}
}