refactor(logging): Centralize console logging with debugLogger (#11590)

This commit is contained in:
Abhi
2025-10-21 16:35:22 -04:00
committed by GitHub
parent f5e07d94bd
commit b364f37655
72 changed files with 345 additions and 289 deletions
@@ -7,6 +7,7 @@
import path from 'node:path';
import { promises as fsp, readFileSync } from 'node:fs';
import { Storage } from '../config/storage.js';
import { debugLogger } from './debugLogger.js';
interface UserAccounts {
active: string | null;
@@ -33,7 +34,7 @@ export class UserAccountManager {
// Inlined validation logic
if (typeof parsed !== 'object' || parsed === null) {
console.log('Invalid accounts file schema, starting fresh.');
debugLogger.log('Invalid accounts file schema, starting fresh.');
return defaultState;
}
const { active, old } = parsed as Partial<UserAccounts>;
@@ -43,7 +44,7 @@ export class UserAccountManager {
(Array.isArray(old) && old.every((i) => typeof i === 'string')));
if (!isValid) {
console.log('Invalid accounts file schema, starting fresh.');
debugLogger.log('Invalid accounts file schema, starting fresh.');
return defaultState;
}
@@ -66,7 +67,10 @@ export class UserAccountManager {
) {
return defaultState;
}
console.log('Error during sync read of accounts, starting fresh.', error);
debugLogger.log(
'Error during sync read of accounts, starting fresh.',
error,
);
return defaultState;
}
}
@@ -84,7 +88,7 @@ export class UserAccountManager {
) {
return defaultState;
}
console.log('Could not parse accounts file, starting fresh.', error);
debugLogger.log('Could not parse accounts file, starting fresh.', error);
return defaultState;
}
}