chore: refactor config and fix audits (#406)

This commit is contained in:
Jef LeCompte
2020-10-03 13:15:39 -04:00
committed by GitHub
parent f006a8595b
commit 8098a31092
28 changed files with 1765 additions and 403 deletions
+5 -5
View File
@@ -1,7 +1,7 @@
import {Link, Store} from './store/model';
import winston, {format} from 'winston';
import {Config} from './config';
import chalk from 'chalk';
import {config} from './config';
const prettyJson = format.printf(info => {
const timestamp = new Date().toLocaleTimeString();
@@ -13,7 +13,7 @@ const prettyJson = format.printf(info => {
return chalk.grey(`[${timestamp}]`) + ` ${info.level} ` + chalk.grey('::') + ` ${info.message}`;
});
export const Logger = winston.createLogger({
export const logger = winston.createLogger({
format: format.combine(
format.colorize(),
format.prettyPrint(),
@@ -21,7 +21,7 @@ export const Logger = winston.createLogger({
format.simple(),
prettyJson
),
level: Config.logLevel,
level: config.logLevel,
transports: [new winston.transports.Console({})]
});
@@ -76,10 +76,10 @@ export const Print = {
},
maxPrice(link: Link, store: Store, price: number, color?: boolean): string {
if (color) {
return '✖ ' + buildProductString(link, store, true) + ' :: ' + chalk.yellow(`PRICE ${price} EXCEEDS LIMIT ${Config.store.maxPrice}`);
return '✖ ' + buildProductString(link, store, true) + ' :: ' + chalk.yellow(`PRICE ${price} EXCEEDS LIMIT ${config.store.maxPrice}`);
}
return `${buildProductString(link, store)} :: PRICE ${price} EXCEEDS LIMIT ${Config.store.maxPrice}`;
return `${buildProductString(link, store)} :: PRICE ${price} EXCEEDS LIMIT ${config.store.maxPrice}`;
},
message(message: string, topic: string, store: Store, color?: boolean): string {
if (color) {