Logging: improve legibility of sql queries when verbose mode enabled

This commit is contained in:
Alice Gaudon 2020-09-11 15:14:40 +02:00
parent 0e32d4fc82
commit fd6e384a12

View File

@ -100,11 +100,7 @@ export default class MysqlConnectionManager {
public static async query(queryString: string, values?: any, connection?: Connection): Promise<QueryResult> {
return await new Promise<QueryResult>((resolve, reject) => {
if (Logger.isVerboseMode()) {
Logger.dev('SQL:', queryString, '; values:', values);
} else {
Logger.dev('SQL:', queryString);
}
Logger.dev('SQL:', Logger.isVerboseMode() ? mysql.format(queryString, values) : queryString);
(connection ? connection : this.pool).query(queryString, values, (error, results, fields) => {
if (error !== null) {