TIL: console.log with color
We can use this pattern to output log with color in browser by adding CSS:
const logger = (name) => ({
info: console.info.bind(console, `%c${name}: %s`, 'color: #56d74b'),
verbose: console.debug.bind(console, `%c${name}: %s`, 'color: #70818e'),
})
Author
I'm Oliver Nguyen. A software maker working mostly in Go and JavaScript. I enjoy learning and seeing a better version of myself each day. Occasionally spin off new open source projects. Share knowledge and thoughts during my journey. Connect with me on , , , and .