[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:
@@ -8,7 +8,6 @@ import path from 'path';
|
||||
|
||||
import {EventEmitter} from 'events';
|
||||
import {ipcMain, nativeTheme, app} from 'electron';
|
||||
import log from 'electron-log';
|
||||
|
||||
import {
|
||||
AnyConfig,
|
||||
@@ -22,7 +21,7 @@ import {
|
||||
|
||||
import {UPDATE_TEAMS, GET_CONFIGURATION, UPDATE_CONFIGURATION, GET_LOCAL_CONFIGURATION, UPDATE_PATHS} from 'common/communication';
|
||||
import * as Validator from 'common/Validator';
|
||||
|
||||
import {Logger} from 'common/log';
|
||||
import {getDefaultTeamWithTabsFromTeam} from 'common/tabs/TabView';
|
||||
import Utils from 'common/utils/util';
|
||||
|
||||
@@ -34,6 +33,8 @@ import buildConfig from './buildConfig';
|
||||
import RegistryConfig, {REGISTRY_READ_EVENT} from './RegistryConfig';
|
||||
import migrateConfigItems from './migrationPreferences';
|
||||
|
||||
const log = new Logger('Config');
|
||||
|
||||
/**
|
||||
* Handles loading and merging all sources of configuration as well as saving user provided config
|
||||
*/
|
||||
@@ -160,7 +161,7 @@ export class Config extends EventEmitter {
|
||||
* @param {*} data value to save for provided key
|
||||
*/
|
||||
set = (key: keyof ConfigType, data: ConfigType[keyof ConfigType]): void => {
|
||||
log.debug('Config.set');
|
||||
log.debug('set');
|
||||
this.setMultiple({[key]: data});
|
||||
}
|
||||
|
||||
@@ -184,7 +185,7 @@ export class Config extends EventEmitter {
|
||||
* @param {array} properties an array of config properties to save
|
||||
*/
|
||||
setMultiple = (newData: Partial<ConfigType>) => {
|
||||
log.debug('Config.setMultiple', newData);
|
||||
log.debug('setMultiple', newData);
|
||||
|
||||
this.localConfigData = Object.assign({}, this.localConfigData, newData);
|
||||
if (newData.teams && this.localConfigData) {
|
||||
|
Reference in New Issue
Block a user