Skip to content

Commit

Permalink
fix: disabled logging
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Merck committed Jun 21, 2023
1 parent 7dde663 commit c9d46f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ declare global {
}
}

Logger.getInstance().disableLogging();

window.addEventListener('load', () => {
if ('serviceWorker' in navigator) {
navigator.serviceWorker
Expand All @@ -29,7 +31,6 @@ window.addEventListener('load', () => {
});
class PwaChat {
constructor() {
Logger.getInstance().enableLogging();
IndexedDBManager.getInstance();
Auth.getInstance();
Router.getInstance();
Expand Down
8 changes: 5 additions & 3 deletions src/ts/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ export class Logger {
private static instance: Logger;
private oldConsoleLog: any = null;

private constructor() {
console.log('[Logger] - instance created');
}
private constructor() {}

static getInstance() {
if (!Logger.instance) {
Expand All @@ -18,10 +16,14 @@ export class Logger {
return;
}

console.log('[Logger] - logging enabled');

window['console']['log'] = this.oldConsoleLog;
}

public disableLogging() {
console.log('[Logger] - logging disabled');

this.oldConsoleLog = console.log;

window['console']['log'] = function () {};
Expand Down

0 comments on commit c9d46f2

Please sign in to comment.