Created
September 23, 2016 18:40
-
-
Save vedovelli/c0bfe1676938b0a76e358470e9023791 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\DB::listen(function ($query) { | |
$fullQuery = vsprintf(str_replace(array('%', '?'), array('%%', '%s'), $query->sql), $query->bindings); | |
$logString = "Connection: {$query->connectionName} | |
Execution time: {$query->time}ms | |
Query: ${fullQuery} | |
---------------------" . PHP_EOL; | |
\Storage::append('logs/queries.log', $logString); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment