changed coloring of log

main
Theenoro 2021-05-12 00:47:15 +02:00
parent ee215cd884
commit b801f27636
2 changed files with 30 additions and 4 deletions

View File

@ -0,0 +1,25 @@
export const RESET = "\x1b[0m"
export const BRIGHT = "\x1b[1m"
export const DIM = "\x1b[2m"
export const UNDERSCORE = "\x1b[4m"
export const BLINK = "\x1b[5m"
export const REVERSE = "\x1b[7m"
export const HIDDEN = "\x1b[8m"
export const FGBLACK = "\x1b[30m"
export const FGRRED = "\x1b[31m"
export const FGGREEN = "\x1b[32m"
export const FGYELLOW = "\x1b[33m"
export const FGBLUE = "\x1b[34m"
export const FGMAGENTA = "\x1b[35m"
export const FGCYAN = "\x1b[36m"
export const FGWHITE = "\x1b[37m"
export const BGBLACK = "\x1b[40m"
export const BGRED = "\x1b[41m"
export const BGGREEN = "\x1b[42m"
export const BGYELLOW = "\x1b[43m"
export const BGBLUE = "\x1b[44m"
export const BGMAGENTA = "\x1b[45m"
export const BGCYAN = "\x1b[46m"
export const BGWHITE = "\x1b[47m"

View File

@ -1,6 +1,7 @@
import { Config } from "../../../config/index.js"
import { FGCYAN, RESET } from "./color.js"
let reset = `\x1b[0m`
export class Log{
@ -14,11 +15,11 @@ export class Log{
}
static debug = (str) => {
let title = "debug"
const title = "debug"
Config.log.debug && Config.log.json && Log.jsonOutput(title,str)
Config.log.debug && Config.log.text && Log.output(title,"\x1b[34m",str)
Config.log.debug && Config.log.text && Log.output(title, FGCYAN ,str)
}
@ -26,6 +27,6 @@ export class Log{
console.log(JSON.stringify({date:`${new Date().toJSON()}`,title:title,code:str}))
}
static output = (title,color,str) => {
console.log(`${new Date().toJSON()} ${color}[${title}]${reset} ${str}`)
console.log(`${new Date().toJSON()} ${color}[${title}]${RESET} ${str}`)
}
}