Improved logging dev experience
This commit is contained in:
parent
81c620f191
commit
4fae4b40b6
1 changed files with 12 additions and 5 deletions
|
@ -1,13 +1,20 @@
|
|||
import fs from "fs"
|
||||
import colors, { Color } from "colors"
|
||||
import { NextApiRequest } from "next"
|
||||
import { IncomingMessage } from "http"
|
||||
colors.enable()
|
||||
|
||||
const loggingTemplates: { [key: string]: LoggingType } = {
|
||||
const loggingTemplates: {
|
||||
system: LoggingType
|
||||
infoGreen: LoggingType
|
||||
infoCyan: LoggingType
|
||||
debug: LoggingType
|
||||
post: LoggingType
|
||||
warn: LoggingType
|
||||
error: LoggingType
|
||||
} = {
|
||||
system: ["SYSTEM", "green"],
|
||||
"info.green": ["INFO", "green"],
|
||||
"info.cyan": ["INFO", "cyan"],
|
||||
infoGreen: ["INFO", "green"],
|
||||
infoCyan: ["INFO", "cyan"],
|
||||
debug: ["Debug", "grey"],
|
||||
post: ["Post", "white"],
|
||||
warn: ["WARN", "yellow"],
|
||||
|
@ -22,7 +29,7 @@ let started: boolean = false
|
|||
async function logStartup() {
|
||||
await fs.promises.stat("log").catch(async () => {
|
||||
await fs.promises.mkdir("log")
|
||||
await logging(`Created 'log' Folder.`, ["info.cyan", "system"])
|
||||
await logging(`Created 'log' Folder.`, ["infoCyan", "system"])
|
||||
})
|
||||
started = true
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue