Logging: improve legibility of sql queries when verbose mode enabled
This commit is contained in:
parent
0e32d4fc82
commit
fd6e384a12
@ -100,11 +100,7 @@ export default class MysqlConnectionManager {
|
|||||||
|
|
||||||
public static async query(queryString: string, values?: any, connection?: Connection): Promise<QueryResult> {
|
public static async query(queryString: string, values?: any, connection?: Connection): Promise<QueryResult> {
|
||||||
return await new Promise<QueryResult>((resolve, reject) => {
|
return await new Promise<QueryResult>((resolve, reject) => {
|
||||||
if (Logger.isVerboseMode()) {
|
Logger.dev('SQL:', Logger.isVerboseMode() ? mysql.format(queryString, values) : queryString);
|
||||||
Logger.dev('SQL:', queryString, '; values:', values);
|
|
||||||
} else {
|
|
||||||
Logger.dev('SQL:', queryString);
|
|
||||||
}
|
|
||||||
|
|
||||||
(connection ? connection : this.pool).query(queryString, values, (error, results, fields) => {
|
(connection ? connection : this.pool).query(queryString, values, (error, results, fields) => {
|
||||||
if (error !== null) {
|
if (error !== null) {
|
||||||
|
Loading…
Reference in New Issue
Block a user