waibu 2.15.2 → 2.16.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -46,7 +46,7 @@ async function hook () {
46
46
  if (this.config.log.defer) {
47
47
  this.reqLog = this.reqLog ?? {}
48
48
  this.reqLog[req.id] = msg
49
- } else if (!this.config.log.noReq) this.app[ns].log.info(msg)
49
+ } else if (!this.config.log.disable.includes('request')) this.app[ns].log.info(msg)
50
50
  if (Object.keys(this.config.paramsCharMap).length === 0) return
51
51
  for (const key in req.params) {
52
52
  let val = req.params[key]
@@ -83,10 +83,10 @@ async function hook () {
83
83
  const time = plain ? elapsed.toFixed(2) : chalk[tc](elapsed.toFixed(2))
84
84
  if (this.config.log.defer) {
85
85
  this.reqLog = this.reqLog ?? {}
86
- if (this.reqLog[req.id] && !this.config.log.noReq) this.app[ns].log.info(this.reqLog[req.id])
86
+ if (this.reqLog[req.id] && !this.config.log.disable.includes('request')) this.app[ns].log.info(this.reqLog[req.id])
87
87
  delete this.reqLog[req.id]
88
88
  }
89
- if (!this.config.log.noReply) this.app[ns].log[level]('httpResp%s%s%s%s%s', arrow, method, url, state, time)
89
+ if (!this.config.log.disable.includes('response')) this.app[ns].log[level]('httpResp%s%s%s%s%s', arrow, method, url, state, time)
90
90
  }
91
91
  }, {
92
92
  level: 5,
package/index.js CHANGED
@@ -92,8 +92,7 @@ async function factory (pkgName) {
92
92
  detectors: ['qs']
93
93
  },
94
94
  log: {
95
- noReq: false,
96
- noReply: false,
95
+ disable: [],
97
96
  defer: false
98
97
  },
99
98
  prefixVirtual: '~',
@@ -161,6 +160,8 @@ async function factory (pkgName) {
161
160
  * @async
162
161
  */
163
162
  init = async () => {
163
+ const { isString } = this.app.lib._
164
+ if (isString(this.config.log.disable)) this.config.log.disable = [this.config.log.disable]
164
165
  if (this.config.home === '/') this.config.home = false
165
166
  await collectRoutePathHandlers.call(this)
166
167
  }
@@ -9,7 +9,7 @@ export function redirect (err = {}, req, reply) {
9
9
  async function handleRedirect (options) {
10
10
  const me = this
11
11
  this.instance.decorateReply('redirectTo', function (url, options = {}) {
12
- return redirect.call(me, { redirect: url, options }, null, this, url, options)
12
+ return redirect.call(me, { redirect: url, options }, null, this)
13
13
  })
14
14
  }
15
15
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "waibu",
3
- "version": "2.15.2",
3
+ "version": "2.16.1",
4
4
  "description": "Web Framework for Bajo",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/wiki/CHANGES.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changes
2
2
 
3
+ ## 2026-06-03
4
+
5
+ - [2.16.1] Bug fix in ```handle-redirect.js```
6
+
7
+ ## 2026-05-30
8
+
9
+ - [2.16.0] Change ```config.log.[noReq|noReply]``` to array ```config.log.disable``` with possible values: ```request``` and ```response```. Defaults to empty values
10
+
3
11
  ## 2026-05-29
4
12
 
5
13
  - [2.15.1] Bug fix in ```build-locals.js```