fixed more lint issues

This commit is contained in:
Boki 2025-06-20 08:42:58 -04:00
parent 48503ce8d1
commit cc014de397
11 changed files with 42 additions and 11 deletions

View file

@ -31,6 +31,7 @@ export function setLoggerConfig(config: LoggerConfig): void {
globalConfig = { ...globalConfig, ...config };
// Clear cache to force recreation with new config
loggerCache.clear();
// eslint-disable-next-line no-console
console.log('Logger config updated:', globalConfig.logLevel);
}
/**
@ -118,7 +119,11 @@ function getPinoLogger(serviceName: string, config: LoggerConfig = globalConfig)
loggerCache.set(cacheKey, pino(loggerOptions));
}
return loggerCache.get(cacheKey)!;
const logger = loggerCache.get(cacheKey);
if (!logger) {
throw new Error(`Expected logger ${cacheKey} to exist in cache`);
}
return logger;
}
/**
@ -303,6 +308,7 @@ export async function shutdownLoggers(): Promise<void> {
if (typeof logger.flush === 'function') {
logger.flush(err => {
if (err) {
// eslint-disable-next-line no-console
console.error('Logger flush error:', err);
}
resolve();
@ -315,8 +321,10 @@ export async function shutdownLoggers(): Promise<void> {
try {
await Promise.allSettled(flushPromises);
// eslint-disable-next-line no-console
console.log('All loggers flushed successfully');
} catch (error) {
// eslint-disable-next-line no-console
console.error('Logger flush failed:', error);
} finally {
loggerCache.clear();