fix: console events disabled in production

This commit is contained in:
Fabio Di Stasio 2022-07-18 17:21:34 +02:00
parent ec75f9546a
commit 0b1aa3dd29
4 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ const queryLogger = ({ sql, cUid }: {sql: string; cUid: string}) => {
const escapedSql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '').replace(/\s\s+/g, ' '); const escapedSql = sql.replace(/(\/\*(.|[\r\n])*?\*\/)|(--(.*|[\r\n]))/gm, '').replace(/\s\s+/g, ' ');
const mainWindow = webContents.fromId(1); const mainWindow = webContents.fromId(1);
mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() }); mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() });
console.log(escapedSql); if (process.env.NODE_ENV === 'development') console.log(escapedSql);
}; };
/** /**

View File

@ -1536,7 +1536,7 @@ export class MySQLClient extends AntaresCore {
} }
async raw<T = antares.QueryResult> (sql: string, args?: antares.QueryParams) { async raw<T = antares.QueryResult> (sql: string, args?: antares.QueryParams) {
if (process.env.NODE_ENV === 'development') this._logger({ cUid: this._cUid, sql }); this._logger({ cUid: this._cUid, sql });
args = { args = {
nest: false, nest: false,

View File

@ -1314,7 +1314,7 @@ export class PostgreSQLClient extends AntaresCore {
} }
async raw<T = antares.QueryResult> (sql: string, args?: antares.QueryParams) { async raw<T = antares.QueryResult> (sql: string, args?: antares.QueryParams) {
if (process.env.NODE_ENV === 'development') this._logger({ cUid: this._cUid, sql }); this._logger({ cUid: this._cUid, sql });
args = { args = {
nest: false, nest: false,

View File

@ -586,7 +586,7 @@ export class SQLiteClient extends AntaresCore {
} }
async raw<T = antares.QueryResult> (sql: string, args?: antares.QueryParams) { async raw<T = antares.QueryResult> (sql: string, args?: antares.QueryParams) {
if (process.env.NODE_ENV === 'development') this._logger({ cUid: this._cUid, sql });// TODO: replace BLOB content with a placeholder this._logger({ cUid: this._cUid, sql });// TODO: replace BLOB content with a placeholder
args = { args = {
nest: false, nest: false,