@tng/ilog

1.0.3 • Public • Published

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
  }
})

Readme

Keywords

none

Package Sidebar

Install

npm i @tng/ilog

Weekly Downloads

0

Version

1.0.3

License

ISC

Unpacked Size

3.31 kB

Total Files

4

Last publish

Collaborators

  • aerohui
  • isayme
  • orangemi