[MM-51873] Create central logging module for adding prefixes to differentiate logs between modules (#2652)

* Create central logging module for adding prefixes to differentiate logs between modules

* Turn logger into class

* Merge'd

* Rework to use class more intelligently

* Fix modalView

* Fix webContentEvents

* Update src/main/app/intercom.ts

Co-authored-by: Daniel Espino García <larkox@gmail.com>

* Shorten prefixes on object creation

---------

Co-authored-by: Daniel Espino García <larkox@gmail.com>
This commit is contained in:
Devin Binnie
2023-04-05 12:09:56 -04:00
committed by GitHub
parent 865b00625e
commit 245215c678
42 changed files with 409 additions and 240 deletions

View File

@@ -2,9 +2,9 @@
// See LICENSE.txt for license information.
import {ipcMain} from 'electron';
import log from 'electron-log';
import {GET_AVAILABLE_LANGUAGES, GET_LANGUAGE_INFORMATION} from 'common/communication';
import {Logger} from 'common/log';
import {Language, languages} from '../../i18n/i18n';
@@ -16,6 +16,8 @@ export function localizeMessage(s: string, defaultString = '', values: any = {})
return str;
}
const log = new Logger('i18nManager');
export class I18nManager {
currentLanguage: Language;
@@ -27,7 +29,7 @@ export class I18nManager {
}
setLocale = (locale: string) => {
log.debug('i18nManager.setLocale', locale);
log.debug('setLocale', locale);
if (this.isLanguageAvailable(locale)) {
this.currentLanguage = this.getLanguages()[locale];