@nxtedition/lib 15.0.6 → 15.0.8

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
@@ -12,14 +12,12 @@ module.exports.createLogger = function (
12
12
  stream = null,
13
13
  ...options
14
14
  } = {},
15
- onTerminate
15
+ onTerminate,
16
16
  ) {
17
17
  if (!stream) {
18
- if (!isMainThread) {
19
- stream = pino.destination({ fd: 1, sync: true })
20
- } else if (
18
+ if (
21
19
  process.stdout.write !== process.stdout.constructor.prototype.write ||
22
- !process.stdout.fd
20
+ process.stdout.fd == null
23
21
  ) {
24
22
  stream = process.stdout
25
23
  }
@@ -29,6 +27,8 @@ module.exports.createLogger = function (
29
27
  // Do nothing...
30
28
  } else if (!extreme) {
31
29
  stream = pino.destination({ fd: process.stdout.fd ?? 1, sync: true })
30
+ } else if (!isMainThread) {
31
+ stream = pino.destination({ fd: 1, sync: false })
32
32
  } else {
33
33
  stream = pino.destination({ fd: process.stdout.fd ?? 1, sync: false, minLength: 4096 })
34
34
  setInterval(() => {
@@ -45,7 +45,7 @@ module.exports.createLogger = function (
45
45
  ...options.serializers,
46
46
  },
47
47
  },
48
- stream
48
+ stream,
49
49
  )
50
50
 
51
51
  let called = false
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/lib",
3
- "version": "15.0.6",
3
+ "version": "15.0.8",
4
4
  "license": "MIT",
5
5
  "author": "Robert Nagy <robert.nagy@boffins.se>",
6
6
  "files": [
@@ -4,11 +4,10 @@ const xuid = require('xuid')
4
4
  class Handler {
5
5
  constructor(opts, { handler }) {
6
6
  this.handler = handler
7
- this.opts = opts
7
+ this.opts = opts.id ? opts : { ...opts, id: xuid() }
8
8
  this.abort = null
9
9
  this.aborted = false
10
-
11
- this.logger = opts.logger.child({ ureq: { id: xuid() } })
10
+ this.logger = opts.logger.child({ ureq: { id: opts.id } })
12
11
  this.pos = 0
13
12
  }
14
13