@nxtedition/lib 15.0.8 → 15.0.11

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/logger.js CHANGED
@@ -28,9 +28,10 @@ module.exports.createLogger = function (
28
28
  } else if (!extreme) {
29
29
  stream = pino.destination({ fd: process.stdout.fd ?? 1, sync: true })
30
30
  } else if (!isMainThread) {
31
- stream = pino.destination({ fd: 1, sync: false })
31
+ // TODO (fix): Async logging?
32
+ stream = pino.destination({ fd: 1, sync: true })
32
33
  } else {
33
- stream = pino.destination({ fd: process.stdout.fd ?? 1, sync: false, minLength: 4096 })
34
+ stream = pino.destination({ sync: false, minLength: 4096 })
34
35
  setInterval(() => {
35
36
  logger.flush()
36
37
  }, flushInterval).unref()
@@ -60,9 +61,13 @@ module.exports.createLogger = function (
60
61
  err = new Error(err)
61
62
  }
62
63
  logger.fatal({ err }, evt || 'error caused exit')
64
+
63
65
  if (stream?.flushSync) {
64
66
  stream.flushSync()
65
67
  }
68
+
69
+ process._rawDebug(err.stack)
70
+
66
71
  process.exit(1)
67
72
  } else {
68
73
  logger.info(`${evt} caught`)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "15.0.8",
3
+ "version": "15.0.11",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "files": [
package/undici/index.js CHANGED
@@ -142,6 +142,7 @@ async function request(urlOrOpts, opts = {}) {
142
142
 
143
143
  dispatch(opts, {
144
144
  resolve,
145
+ logger: opts.logger,
145
146
  /** @type {Function | null} */ abort: null,
146
147
  /** @type {stream.Readable | null} */ body: null,
147
148
  onConnect(abort) {
@@ -166,6 +167,10 @@ async function request(urlOrOpts, opts = {}) {
166
167
  statusMessage,
167
168
  headers,
168
169
  size: Number.isFinite(contentLength) ? contentLength : null,
170
+ }).on('error', (err) => {
171
+ if (this.logger && this.body?.listenerCount('error') === 1) {
172
+ this.logger.error({ err }, 'unhandled response body error')
173
+ }
169
174
  })
170
175
 
171
176
  this.resolve(this.body)