From a63de84e65125c730d81d17ad8e0839d9befbd87 Mon Sep 17 00:00:00 2001 From: Alan Hamlett Date: Tue, 17 Dec 2024 12:14:18 +0100 Subject: [PATCH] More debug logs --- electron/watchers/watcher.ts | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/electron/watchers/watcher.ts b/electron/watchers/watcher.ts index 0cad9cf..ad27b46 100644 --- a/electron/watchers/watcher.ts +++ b/electron/watchers/watcher.ts @@ -1,16 +1,16 @@ +import type { IGlobalKeyListener } from "node-global-key-listener"; import { - WindowInfo, activeWindow, subscribeActiveWindow, unsubscribeActiveWindow, + WindowInfo, } from "@miniben90/x-win"; +import { GlobalKeyboardListener } from "node-global-key-listener"; import { AppsManager } from "../helpers/apps-manager"; -import { GlobalKeyboardListener } from "node-global-key-listener"; -import type { IGlobalKeyListener } from "node-global-key-listener"; -import { Logging } from "../utils/logging"; import { MonitoredApp } from "../helpers/monitored-app"; import { MonitoringManager } from "../helpers/monitoring-manager"; +import { Logging, LogLevel } from "../utils/logging"; import { Wakatime } from "./wakatime"; export class Watcher { @@ -79,6 +79,7 @@ export class Watcher { Logging.instance().log( `App changed from ${this.activeWindow?.info.name || "nil"} to ${windowInfo.info.name}`, + LogLevel.DEBUG, ); this.activeWindow = windowInfo; @@ -88,7 +89,16 @@ export class Watcher { ); if (isMonitored) { + Logging.instance().log( + `Monitoring ${windowInfo.info.name}: ${this.activeWindow.info.path}`, + LogLevel.DEBUG, + ); this.watchKeyboardEvents(); + } else { + Logging.instance().log( + `Not monitoring ${windowInfo.info.name}: ${this.activeWindow.info.path}`, + LogLevel.DEBUG, + ); } } },