使用bunyan记录日志,启动项目报错,但是貌似不影响使用,请大神帮忙看看。
发布于 8 年前 作者 yanfch 4254 次浏览 来自 问答

启动异常:

[Error: Module version mismatch. Expected 14, got 46.] { [Error: Cannot find module ‘./build/default/DTraceProviderBindings’] code: ‘MODULE_NOT_FOUND’ } { [Error: Cannot find module ‘./build/Debug/DTraceProviderBindings’] code: ‘MODULE_NOT_FOUND’ }

代码:

'use strict'

var config = require('../config');
var path = require('path');
var bunyan = require('bunyan');

var buyanConfig = {
	name: 'americano-site',
	serializers: {
		req: bunyan.stdSerializers.req,
		res: bunyan.stdSerializers.res,
		err: bunyan.stdSerializers.err
	},
	streams: [
		{
			level: 'debug',
			stream: process.stdout
		},
		{
			name: 'daily-error',
			type: 'rotating-file',
			level: 'error',
			path: path.join(config.root, 'logs', 'error.log'),
			period: '1d',   // daily rotation
			count: 7        // keep 7 back copies
		}
	]
};

module.exports = bunyan.createLogger(buyanConfig);

node 4.4.7 bunyan 1.8.1

回到顶部