skutil-express-logger
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

Common utils used by the author privately.

Install

yarn add skutil-express-logger

Usage

const expressLogger = require('skutil-express-logger')
app = express()
app.use(expressLogger(options))

Options

options: Object

  • log: Boolean or Function, 记录log的开关或函数, default: console.log
  • reqBody: Boolean 是否打印请求body, default: true
  • resBody: Boolean 是否打印响应body, default: true
  • printMaxLen: Integer 字符串最大打印长度,超过长度则以<long string>替代
  • shortenJson: Boolean 是否采用删减打印json body的策略, 删减方式为用lodash.cloneDeepWith将json中的长字符串替代为<[num] chars>
  • shortenThresh: Integer 删减json时,字符串长度阈值,超过该值将被删减

Readme

Keywords

Package Sidebar

Install

npm i skutil-express-logger

Weekly Downloads

7

Version

1.2.0

License

MIT

Unpacked Size

7.97 kB

Total Files

6

Last publish

Collaborators

  • stayknight