learn-request-queue/src/logging.ts

15 lines
278 B
TypeScript
Raw 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)
console.log(LogLevel[logLevel].padStart(7) + ' | ' + logMessage)
}