skutil-express-logger

    1.0.2 • 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时,字符串长度阈值,超过该值将被删减

    Install

    npm i skutil-express-logger

    DownloadsWeekly Downloads

    1

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    6.16 kB

    Total Files

    4

    Last publish

    Collaborators

    • stayknight