core/utils/Logger.ts
SKINMAKER b421d1ab64
chore: apply prettier (#637)
* chore: apply prettier

* chore: edit ready comment

* chore: move ts comment
2023-11-29 22:04:33 +09:00

21 lines
570 B
TypeScript

const Logger = {
debug: function (message: string) {
print('DEBUG', message, genStyle('cyan'))
},
warn: function (message: string) {
print('WARN', message, genStyle('yellow'))
},
error: function (message: string) {
print('ERROR', message, genStyle('red', 'white'))
},
}
function genStyle(bg: string, text = 'black') {
return `color:${text};background:${bg};padding:1px 3px;border-radius:2px;margin-right:5px;`
}
function print(level: string, message: string, style: string) {
console.log(`%c${level}` + `%c${message}`, style, '')
}
export default Logger