From 06872452f4509ecf9574d24f8b0ab979701a9d21 Mon Sep 17 00:00:00 2001 From: Devin Binnie <52460000+devinbinnie@users.noreply.github.com> Date: Fri, 1 Sep 2023 11:52:11 -0400 Subject: [PATCH] [MM-54170] Automatically set the logging level to info if not specified (#2811) * [MM-54170] Automatically set the logging level to info if not specified * Fix test --- src/common/config/defaultPreferences.ts | 1 + src/common/log.test.js | 8 ++++++++ src/common/log.ts | 3 +++ 3 files changed, 12 insertions(+) diff --git a/src/common/config/defaultPreferences.ts b/src/common/config/defaultPreferences.ts index 2a4c2269..5ef4e379 100644 --- a/src/common/config/defaultPreferences.ts +++ b/src/common/config/defaultPreferences.ts @@ -48,6 +48,7 @@ const defaultPreferences: ConfigV3 = { lastActiveTeam: 0, downloadLocation: getDefaultDownloadLocation(), startInFullscreen: false, + logLevel: 'info', }; export default defaultPreferences; diff --git a/src/common/log.test.js b/src/common/log.test.js index 0f73089b..f7c942ec 100644 --- a/src/common/log.test.js +++ b/src/common/log.test.js @@ -10,6 +10,14 @@ jest.unmock('common/log'); jest.mock('electron-log', () => ({ log: jest.fn(), + transports: { + file: { + level: 'info', + }, + console: { + level: 'info', + }, + }, })); jest.mock('common/utils/util', () => ({ diff --git a/src/common/log.ts b/src/common/log.ts index 6e718c43..6daf6147 100644 --- a/src/common/log.ts +++ b/src/common/log.ts @@ -22,6 +22,9 @@ export class Logger { constructor(...prefixes: string[]) { this.prefixes = this.shortenPrefixes(...prefixes); + + // Start on info by default + setLoggingLevel('info'); } withPrefix = (...prefixes: string[]) => {