@nxtedition/nxt-undici 6.3.20 → 6.3.21
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.
- package/lib/interceptor/log.js +3 -19
- package/package.json +1 -1
package/lib/interceptor/log.js
CHANGED
|
@@ -7,7 +7,7 @@ class Handler extends DecoratorHandler {
|
|
|
7
7
|
#abort
|
|
8
8
|
#aborted = false
|
|
9
9
|
#pos = 0
|
|
10
|
-
#created =
|
|
10
|
+
#created = performance.now()
|
|
11
11
|
#timing = {
|
|
12
12
|
created: -1,
|
|
13
13
|
connect: -1,
|
|
@@ -23,20 +23,13 @@ class Handler extends DecoratorHandler {
|
|
|
23
23
|
super(handler)
|
|
24
24
|
|
|
25
25
|
this.#opts = opts
|
|
26
|
-
this.#logger = opts.logger.child({
|
|
27
|
-
ureq: {
|
|
28
|
-
id: opts.id,
|
|
29
|
-
url: opts.url,
|
|
30
|
-
},
|
|
31
|
-
})
|
|
26
|
+
this.#logger = opts.logger.child({ ureq: opts })
|
|
32
27
|
|
|
33
28
|
if (logOpts?.bindings) {
|
|
34
29
|
this.#logger = this.#logger.child(logOpts?.bindings)
|
|
35
30
|
}
|
|
36
31
|
|
|
37
|
-
this.#
|
|
38
|
-
|
|
39
|
-
this.#logger.debug({ ureq: opts }, 'upstream request queued')
|
|
32
|
+
this.#logger.debug('upstream request started')
|
|
40
33
|
}
|
|
41
34
|
|
|
42
35
|
onConnect(abort) {
|
|
@@ -48,8 +41,6 @@ class Handler extends DecoratorHandler {
|
|
|
48
41
|
this.#timing.data = -1
|
|
49
42
|
this.#timing.end = -1
|
|
50
43
|
|
|
51
|
-
this.#logger.debug('upstream request started')
|
|
52
|
-
|
|
53
44
|
super.onConnect((reason) => {
|
|
54
45
|
this.#aborted = true
|
|
55
46
|
this.#abort(reason)
|
|
@@ -76,12 +67,6 @@ class Handler extends DecoratorHandler {
|
|
|
76
67
|
|
|
77
68
|
onHeaders(statusCode, headers, resume) {
|
|
78
69
|
this.#timing.headers = performance.now() - this.#created
|
|
79
|
-
|
|
80
|
-
this.#logger.debug(
|
|
81
|
-
{ ures: { statusCode }, elapsedTime: this.#timing.headers },
|
|
82
|
-
'upstream request response',
|
|
83
|
-
)
|
|
84
|
-
|
|
85
70
|
this.#statusCode = statusCode
|
|
86
71
|
this.#headers = headers
|
|
87
72
|
|
|
@@ -128,7 +113,6 @@ class Handler extends DecoratorHandler {
|
|
|
128
113
|
this.#timing.end = performance.now() - this.#created
|
|
129
114
|
|
|
130
115
|
const data = {
|
|
131
|
-
ureq: this.#opts,
|
|
132
116
|
ures: {
|
|
133
117
|
statusCode: this.#statusCode,
|
|
134
118
|
headers: this.#headers,
|