fixed up logger error to make it better to handle in code

This commit is contained in:
Bojan Kucera 2025-06-07 11:58:24 -04:00
parent db66687f48
commit d0bb4db042
18 changed files with 51 additions and 45 deletions

View file

@ -49,7 +49,7 @@ const workInterval = setInterval(() => {
try {
await initiateShutdown();
} catch (error) {
logger.error('Manual shutdown failed', { error });
logger.error('Manual shutdown failed', error);
process.exit(1);
}
}, 2000);

View file

@ -136,7 +136,7 @@ export class UnifiedDataProvider implements DataProvider {
try {
data = await this.fetchFromQuestDB(symbol, from, to, interval);
} catch (error) {
logger.warn('Failed to fetch from QuestDB, generating simulated data', { error });
logger.warn('Failed to fetch from QuestDB, generating simulated data', error);
data = this.generateHistoricalData(symbol, from, to, interval);
}
} else {

View file

@ -135,7 +135,7 @@ onShutdown(async () => {
// await proxyService.shutdown();
logger.info('✅ Proxy service cleanup completed');
} catch (error) {
logger.error('❌ Proxy service cleanup failed', { error });
logger.error('❌ Proxy service cleanup failed', error);
}
});
@ -182,7 +182,7 @@ demonstrateCustomProxySource()
}, 2000);
})
.catch((error) => {
logger.error('💥 Proxy demo failed', { error });
logger.error('💥 Proxy demo failed', error);
clearShutdownTimer();
setTimeout(() => process.exit(1), 1000);
});

View file

@ -97,7 +97,7 @@ export class ProxyService {
try {
await this.scrapeProxies();
} catch (error) {
this.logger.error('Error in periodic proxy refresh', {error});
this.logger.error('Error in periodic proxy refresh', error);
}
}, intervalMs);
}
@ -318,7 +318,7 @@ export class ProxyService {
}
}
} catch (error) {
this.logger.error('Error updating proxy status', {error});
this.logger.error('Error updating proxy status', error);
}
}
/**
@ -346,7 +346,7 @@ export class ProxyService {
this.logger.warn('No working proxies available');
return null;
} catch (error) {
this.logger.error('Error getting working proxy', {error});
this.logger.error('Error getting working proxy', error);
return null;
}
}
@ -371,7 +371,7 @@ export class ProxyService {
return workingProxies;
} catch (error) {
this.logger.error('Error getting working proxies', {error});
this.logger.error('Error getting working proxies', error);
return [];
}
}
@ -391,7 +391,7 @@ export class ProxyService {
this.logger.warn('getAllProxies not fully implemented - Redis cache provider limitations');
return proxies;
} catch (error) {
this.logger.error('Error getting all proxies', {error});
this.logger.error('Error getting all proxies', error);
return [];
}
}
@ -424,7 +424,7 @@ export class ProxyService {
return stats;
} catch (error) {
this.logger.error('Error getting proxy stats', {error});
this.logger.error('Error getting proxy stats', error);
return {
total: 0,
working: 0,
@ -485,7 +485,7 @@ export class ProxyService {
stillWorking: successCount
});
} catch (error) {
this.logger.error('Error in health check', {error});
this.logger.error('Error in health check', error);
}
}, intervalMs);
}
@ -502,7 +502,7 @@ export class ProxyService {
this.logger.info('Cleared proxy stats from cache');
this.logger.warn('Full proxy data clearing not implemented due to cache provider limitations');
} catch (error) {
this.logger.error('Error clearing proxy data', {error});
this.logger.error('Error clearing proxy data', error);
}
}