@@ -35,15 +35,14 @@ public function boot()
3535 $ sqlWithPlaceholders = str_replace (['% ' , '? ' ], ['%% ' , '%s ' ], $ query ->sql );
3636
3737 $ bindings = $ query ->connection ->prepareBindings ($ query ->bindings );
38- $ pdo = $ query ->connection ->getPdo ();
39- $ realSql = $ sqlWithPlaceholders ;
38+ $ pdo = $ query ->connection ->getPdo ();
39+ $ realSql = $ sqlWithPlaceholders ;
4040 $ duration = $ this ->formatDuration ($ query ->time / 1000 );
4141
4242 if (count ($ bindings ) > 0 ) {
4343 $ realSql = vsprintf ($ sqlWithPlaceholders , array_map ([$ pdo , 'quote ' ], $ bindings ));
4444 }
45-
46- Log::debug (sprintf ('[%s] %s | %s: %s ' , $ duration , $ realSql , request ()->method (), request ()->getRequestUri ()));
45+ Log::debug (sprintf ('[%s] [%s] %s | %s: %s ' , $ query ->connection ->getDatabaseName (), $ duration , $ realSql , request ()->method (), request ()->getRequestUri ()));
4746 });
4847 }
4948
@@ -64,11 +63,11 @@ public function register()
6463 private function formatDuration ($ seconds )
6564 {
6665 if ($ seconds < 0.001 ) {
67- return round ($ seconds * 1000000 ). 'μs ' ;
66+ return round ($ seconds * 1000000 ) . 'μs ' ;
6867 } elseif ($ seconds < 1 ) {
69- return round ($ seconds * 1000 , 2 ). 'ms ' ;
68+ return round ($ seconds * 1000 , 2 ) . 'ms ' ;
7069 }
7170
72- return round ($ seconds , 2 ). 's ' ;
71+ return round ($ seconds , 2 ) . 's ' ;
7372 }
7473}
0 commit comments