diff --git a/app/common/config-util.ts b/app/common/config-util.ts index 831e704f..3cf5b8a9 100644 --- a/app/common/config-util.ts +++ b/app/common/config-util.ts @@ -12,7 +12,6 @@ const {app, dialog} = process.type === "renderer" ? electron.remote : electron; const logger = new Logger({ file: "config-util.log", - timestamp: true, }); let db: JsonDB; diff --git a/app/common/enterprise-util.ts b/app/common/enterprise-util.ts index cdc33a42..5536df9c 100644 --- a/app/common/enterprise-util.ts +++ b/app/common/enterprise-util.ts @@ -5,7 +5,6 @@ import Logger from "./logger-util"; const logger = new Logger({ file: "enterprise-util.log", - timestamp: true, }); // TODO: replace enterpriseSettings type with an interface once settings are final diff --git a/app/common/logger-util.ts b/app/common/logger-util.ts index e99888c7..7a014fc8 100644 --- a/app/common/logger-util.ts +++ b/app/common/logger-util.ts @@ -9,10 +9,7 @@ import {sentryInit, captureException} from "./sentry-util"; const {app} = process.type === "renderer" ? electron.remote : electron; interface LoggerOptions { - timestamp?: true | (() => string); file?: string; - level?: boolean; - logInDevMode?: boolean; } initSetUp(); @@ -41,22 +38,11 @@ type Level = "log" | "debug" | "info" | "warn" | "error"; export default class Logger { nodeConsole: Console; - timestamp?: () => string; - level: boolean; - logInDevMode: boolean; constructor(options: LoggerOptions = {}) { - let { - timestamp = true, - file = "console.log", - level = true, - logInDevMode = false, - } = options; + let {file = "console.log"} = options; file = `${logDir}/${file}`; - if (timestamp === true) { - timestamp = this.getTimestamp; - } // Trim log according to type of process if (process.type === "renderer") { @@ -69,30 +55,12 @@ export default class Logger { const nodeConsole = new Console(fileStream); this.nodeConsole = nodeConsole; - this.timestamp = timestamp; - this.level = level; - this.logInDevMode = logInDevMode; } _log(type: Level, ...args: unknown[]): void { - const {nodeConsole, timestamp, level, logInDevMode} = this; - - switch (true) { - case typeof timestamp === "function": - args.unshift(timestamp() + " |\t"); - // Fall through - - case level: - args.unshift(type.toUpperCase() + " |"); - // Fall through - - case !app.isPackaged || logInDevMode: - nodeConsole[type](...args); - break; - - default: - } - + args.unshift(this.getTimestamp() + " |\t"); + args.unshift(type.toUpperCase() + " |"); + this.nodeConsole[type](...args); console[type](...args); } diff --git a/app/main/linux-update-util.ts b/app/main/linux-update-util.ts index 539a7713..49bebc23 100644 --- a/app/main/linux-update-util.ts +++ b/app/main/linux-update-util.ts @@ -8,7 +8,6 @@ import Logger from "../common/logger-util"; const logger = new Logger({ file: "linux-update-util.log", - timestamp: true, }); let db: JsonDB; diff --git a/app/main/linuxupdater.ts b/app/main/linuxupdater.ts index 5abce37d..edef3262 100644 --- a/app/main/linuxupdater.ts +++ b/app/main/linuxupdater.ts @@ -11,7 +11,6 @@ import {fetchResponse} from "./request"; const logger = new Logger({ file: "linux-update-util.log", - timestamp: true, }); export async function linuxUpdateNotification( diff --git a/app/main/request.ts b/app/main/request.ts index 012205b4..551e2856 100644 --- a/app/main/request.ts +++ b/app/main/request.ts @@ -32,7 +32,6 @@ const defaultIconUrl = "../renderer/img/icon.png"; const logger = new Logger({ file: "domain-util.log", - timestamp: true, }); const generateFilePath = (url: string): string => { diff --git a/app/renderer/js/main.ts b/app/renderer/js/main.ts index 8321d3be..0d282e85 100644 --- a/app/renderer/js/main.ts +++ b/app/renderer/js/main.ts @@ -54,7 +54,6 @@ interface SettingsOptions extends DNDSettings { const logger = new Logger({ file: "errors.log", - timestamp: true, }); const rendererDirectory = path.resolve(__dirname, ".."); diff --git a/app/renderer/js/utils/domain-util.ts b/app/renderer/js/utils/domain-util.ts index e33c5ec0..a8bfcdaf 100644 --- a/app/renderer/js/utils/domain-util.ts +++ b/app/renderer/js/utils/domain-util.ts @@ -13,7 +13,6 @@ const {app, dialog} = remote; const logger = new Logger({ file: "domain-util.log", - timestamp: true, }); const defaultIconUrl = "../renderer/img/icon.png"; diff --git a/app/renderer/js/utils/reconnect-util.ts b/app/renderer/js/utils/reconnect-util.ts index 54655804..f485875b 100644 --- a/app/renderer/js/utils/reconnect-util.ts +++ b/app/renderer/js/utils/reconnect-util.ts @@ -8,7 +8,6 @@ import type WebView from "../components/webview"; const logger = new Logger({ file: "domain-util.log", - timestamp: true, }); export default class ReconnectUtil {