Chrome的内置JavaScript控制台可以显示颜色吗?
我想要红色错误,橙色警告和console.log绿色警告.那可能吗?
Javascriptconsole.log允许我将 CSS 样式应用到第一个参数,如下所示:
console.log("%chey hey we're the monkees!", "font-weight: bold; color: fuchsia")
Run Code Online (Sandbox Code Playgroud)
...这太棒了。但它不能很好地处理多个日志参数。我想做这样的事情:
console.log(`%c${timestamp}`, "color: #999", `%c${tags}`, "background-color: #bbb", message)
// doesn't work; second format code is not interpreted
Run Code Online (Sandbox Code Playgroud)
有没有办法将多种格式代码应用于多个console.log参数?