learn-request-queue/src/logging.ts

15 lines
305 B
TypeScript
Raw Permalink Normal View History

2020-09-19 18:23:44 +00:00
import * as config from "./config";
export enum LogLevel {
SILENT,
ERROR,
WARNING,
INFO,
DEBUG
}
export async function log(logLevel: LogLevel, logMessage: any) {
if (config.logLevel >= logLevel)
2020-11-29 05:09:06 +00:00
console.log(new Date().toISOString() + LogLevel[logLevel].padStart(7) + ' | ' + logMessage)
2020-09-19 18:23:44 +00:00
}