
Security News
vlt Launches "reproduce": A New Tool Challenging the Limits of Package Provenance
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
@zhike/log-express-middleware
Advanced tools
日志打印中间件
$ npm install @zhike/log-express-middleware
const logger = require('@zhike/log-express-middleware')
const Express = require('express')
var bodyParser = require('body-parser')
const app = new Express()
app.use(bodyParser.json())
//只打印requestBody
app.use(logger())
// 打印所有路径的headers中的content-type。只打印以/player2开头的路径的responseBody
app.use(logger({
requestHeaders: ['content-type'],
responseHeaders: ['content-type'],
responseBodyWhiteList: ['/^\/player2/']
}))
// 对密码进行隐藏
app.use(logger({
handler: function(req, res, _log) {
if (req.path === '/signin') {
_log.requestBody.password = '****1**'
}
}
}))
参数名 | 类型 | 说明 |
---|---|---|
reqId | String | 响应标识id(使用自定义的reqId需放在日志中间件前。如果为空且ctx.reqId为空则使用uuidv4自动生成reqId) |
requestHeaders | Array | 需要打印的request头部 (默认不打印) |
responseHeaders | Array | 需要打印的response头部 (默认不打印) |
responseBodyWhiteList | Array | 白名单,字符串数组,可为正则(对于正则匹配剔除部分路由,可在业务代码中的ctx.useResponseBodyOption=false跳过路由规则) |
responseBodyBlackList | Array | 黑名单,字符串数组,可为正则(对于正则匹配剔除部分路由,可在业务代码中使用ctx.useResponseBodyOption=false跳过路由规则) |
handler | Function(req, res, _log) | 特殊处理函数。_log目前有requestBody属性,可以用来调整requestBody打印(是req.body的副本,进行修改,不会影响req.body) |
注意:
FAQs
The npm package @zhike/log-express-middleware receives a total of 0 weekly downloads. As such, @zhike/log-express-middleware popularity was classified as not popular.
We found that @zhike/log-express-middleware demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 13 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
vlt's new "reproduce" tool verifies npm packages against their source code, outperforming traditional provenance adoption in the JavaScript ecosystem.
Research
Security News
Socket researchers uncovered a malicious PyPI package exploiting Deezer’s API to enable coordinated music piracy through API abuse and C2 server control.
Research
The Socket Research Team discovered a malicious npm package, '@ton-wallet/create', stealing cryptocurrency wallet keys from developers and users in the TON ecosystem.