skutil-express-logger
v1.2.0
Published
logger middleware for express in skutil related modules used by the author privately.
Downloads
7
Readme
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
orFunction
, 记录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时,字符串长度阈值,超过该值将被删减