@tng/ilog
v1.0.3
Published
TNG ilog 中间件 ==============
Downloads
3
Readme
TNG ilog 中间件
使用
yarn add @tng/ilog
require('@tng/ilog)({ name: 'Service Name' })
自定义client
的解析函数
const ilog = require('@tng/ilog')
ilog({
name: 'Client Name',
ignoreRoutes: ['/version'], // 不打印日志的路由
ignoreMethods: ['GET', 'OPTIONS'], // 默认是 ['OPTIONS']
parseClientFunction: function (ctx) {
if (_.result(ctx.state, 'consumer._id')) {
return ctx.state.consumer.name + '_' + ctx.state.consumer.clientKey
}
return null
}
})