Skip to content

Commit

Permalink
Increase logging
Browse files Browse the repository at this point in the history
  • Loading branch information
SRichner committed Feb 21, 2024
1 parent b902fc7 commit 45c081c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/electron/electron/main/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if (!app.requestSingleInstanceLock()) {

// Optional, initialize the logger for any renderer process
log.initialize();
const LOG = getLogger('Main', true);
const LOG = getLogger('Main');

app.whenReady().then(async () => {
app.setAppUserModelId('ch.ifi.hasel.personal-analytics');
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { Tracker } from './Tracker';
import { TrackerConfig } from '../../../types/StudyConfig';
import { TrackerType } from '../../../enums/TrackerType.enum';
import { getLogger } from '../../../shared/Logger';

const LOG = getLogger('TrackerService');

export class TrackerService {
private trackers: Tracker[] = [];
Expand All @@ -17,6 +20,7 @@ export class TrackerService {
if (this.isTrackerAlreadyRegistered(trackerType)) {
throw new Error(`Tracker ${trackerType} already registered!`);
}
LOG.info(`Registering tracker ${trackerType}...`);

if (
this.config.windowActivityTracker.enabled &&
Expand Down
2 changes: 1 addition & 1 deletion src/electron/electron/shared/Logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import logger from 'electron-log/main';
import { LogFunctions } from 'electron-log';
import { LOG_FILE_NAME, LOG_LEVEL } from '../config/logger.config';

const getLogger = (loggerName: string, background = false): LogFunctions => {
const getLogger = (loggerName: string, background = true): LogFunctions => {
const currentDate: string = new Date().toISOString().split('T')[0];
const processName: string = background ? LOG_FILE_NAME.BACKGROUND : LOG_FILE_NAME.RENDERER;
logger.transports.file.fileName = `${currentDate}-${processName}.log`;
Expand Down

0 comments on commit 45c081c

Please sign in to comment.