@nxtedition/nxt-undici 6.3.6 → 6.3.7

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.
@@ -89,19 +89,24 @@ class Handler extends DecoratorHandler {
89
89
  onComplete() {
90
90
  this.#timing.end = performance.now() - this.#created
91
91
 
92
- this.#logger.debug(
93
- {
94
- ures: {
95
- statusCode: this.#statusCode,
96
- headers: this.#headers,
97
- timing: this.#timing,
98
- bytesRead: this.#pos,
99
- bytesReadPerSecond: (this.#pos * 1e3) / (this.#timing.end - this.#timing.data),
100
- },
101
- elapsedTime: this.#timing.end,
92
+ const data = {
93
+ ures: {
94
+ statusCode: this.#statusCode,
95
+ headers: this.#headers,
96
+ timing: this.#timing,
97
+ bytesRead: this.#pos,
98
+ bytesReadPerSecond: (this.#pos * 1e3) / (this.#timing.end - this.#timing.data),
102
99
  },
103
- 'upstream request completed',
104
- )
100
+ elapsedTime: this.#timing.end,
101
+ }
102
+
103
+ if (this.#statusCode >= 500) {
104
+ this.#logger.error(data, 'upstream request completed')
105
+ } else if (this.#statusCode >= 400) {
106
+ this.#logger.warn(data, 'upstream request completed')
107
+ } else {
108
+ this.#logger.debug(data, 'upstream request completed')
109
+ }
105
110
 
106
111
  super.onComplete()
107
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/nxt-undici",
3
- "version": "6.3.6",
3
+ "version": "6.3.7",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "main": "lib/index.js",