Better logging system
This commit is contained in:
parent
e5f96b966a
commit
e9696fac25
3 changed files with 42 additions and 7 deletions
14
src/logging.ts
Normal file
14
src/logging.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
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)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue