如何用sails.js自定义颜色logging器
我想要在橙色debugging,而不是红色,但我不知道在哪里configuration(超载?)默认的风帆logging器。 我想我会在引导中做到这一点,但如何? 谢谢。
顺便说一句,有两次红色,一个错误和一个debugging似乎不是很好!
sails.log
在内部使用Winston ,检查Winston文档中的可用选项。 对于0.9.x,你必须跳过下面列出的一些箍。
For Sails v0.9.8
回溯在0.10中find的logging器钩子 :
- 把它放到/ api / hooks / logger中
- 安装依赖项:
npm install --save lodash captains-log sails-util
- 请参阅“For Sails v0.10”下的示例configuration。
- 忽略
silly
的定义,v0.9.8下没有这样的日志级别
For Sails v0.10
在config / log.js中定义颜色(默认configuration,取自这里 )
module.exports.log = { level: 'info', colors: { silly: 'rainbow', input: 'grey', verbose: 'cyan', prompt: 'grey', info: 'green', data: 'grey', help: 'cyan', warn: 'yellow', debug: 'blue', error: 'red' } };
可用的日志样式
在nodejs 颜色模块中find):
- 白色
- 灰色
- 黑色
- 蓝色
- 青色
- 绿色
- 品红
- 红
- 黄色
- whiteBG
- greyBG
- blackBG
- blueBG
- cyanBG
- greenBG
- magentaBG
- redBG
- yellowBG