Adding logger wrapper.

Log backend messages to syslog.
fixes #135
This commit is contained in:
softsimon
2020-10-13 15:27:52 +07:00
parent 4c203631db
commit 4dacf292c2
15 changed files with 238 additions and 66 deletions

View File

@@ -1,4 +1,5 @@
import * as request from 'request';
import logger from '../logger';
class FiatConversion {
private tickers = {
@@ -10,7 +11,7 @@ class FiatConversion {
constructor() { }
public startService() {
console.log('Starting currency rates service');
logger.info('Starting currency rates service');
setInterval(this.updateCurrency.bind(this), 1000 * 60 * 60);
this.updateCurrency();
}
@@ -21,7 +22,7 @@ class FiatConversion {
private updateCurrency() {
request('https://api.opennode.co/v1/rates', { json: true }, (err, res, body) => {
if (err) { return console.log(err); }
if (err) { return logger.info(err); }
if (body && body.data) {
this.tickers = body.data;
}