learn-request-queue/src/logging.ts

15 lines
305 B
TypeScript

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(new Date().toISOString() + LogLevel[logLevel].padStart(7) + ' | ' + logMessage)
}