add SQL formatter

This commit is contained in:
Daniel Seifert 2020-04-30 20:45:41 +02:00
parent b58b674c3a
commit 8df59407d9
Signed by: DanielS
GPG Key ID: 8A7C4C6ED1915C6F
2 changed files with 5 additions and 2 deletions

View File

@ -3,7 +3,8 @@
"description": "Returns all SQL queries in the browser.",
"type": "library",
"require": {
"monolog/monolog": "^1"
"monolog/monolog": "^1",
"nilportugues/sql-query-formatter": "^1.2.2"
},
"license": "GPL-3.0",
"autoload": {

View File

@ -42,10 +42,12 @@ class OxidSQLLogger implements SQLLogger
*/
public function startQuery($sql, array $params = null, array $types = null)
{
$formatter = new Formatter();
Monolog\Registry::sql()->addDebug(
$this->message ? $this->message : $sql,
[
'query' => $sql,
'query' => $formatter->format($sql),
'params' => $params,
'types' => $types,
'logStartingFile' => $this->logStartingFile,