Skip to content

Commit

Permalink
fix: console events disabled in production
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio286 committed Jul 18, 2022
1 parent ec75f95 commit 0b1aa3d
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/main/libs/AntaresCore.ts
Expand Up @@ -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 mainWindow = webContents.fromId(1);
mainWindow.send('query-log', { cUid, sql: escapedSql, date: new Date() });
console.log(escapedSql);
if (process.env.NODE_ENV === 'development') console.log(escapedSql);
};

/**
Expand Down
2 changes: 1 addition & 1 deletion src/main/libs/clients/MySQLClient.ts
Expand Up @@ -1536,7 +1536,7 @@ export class MySQLClient extends AntaresCore {
}

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 = {
nest: false,
Expand Down
2 changes: 1 addition & 1 deletion src/main/libs/clients/PostgreSQLClient.ts
Expand Up @@ -1314,7 +1314,7 @@ export class PostgreSQLClient extends AntaresCore {
}

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 = {
nest: false,
Expand Down
2 changes: 1 addition & 1 deletion src/main/libs/clients/SQLiteClient.ts
Expand Up @@ -586,7 +586,7 @@ export class SQLiteClient extends AntaresCore {
}

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 = {
nest: false,
Expand Down

0 comments on commit 0b1aa3d

Please sign in to comment.