pino-seq 1.0.0 → 1.2.0

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.
@@ -16,7 +16,7 @@ jobs:
16
16
 
17
17
  strategy:
18
18
  matrix:
19
- node-version: [14.x, 16.x, 18.x, 20.x]
19
+ node-version: [16.x, 18.x, 20.x]
20
20
  os: [ubuntu-latest, windows-latest, macOS-latest]
21
21
 
22
22
  steps:
@@ -13,3 +13,5 @@ logger.info("Hello Seq, from Pino");
13
13
 
14
14
  const frLogger = logger.child({lang: "fr"});
15
15
  frLogger.warn("au reviour");
16
+
17
+ stream.flush().then((_) => console.log('flushed'));
package/index.d.ts CHANGED
@@ -11,7 +11,9 @@ declare namespace PinoSeq {
11
11
  onError?: (e: Error) => void;
12
12
  }
13
13
 
14
- function createStream(config: PinoSeq.SeqConfig): Writable;
14
+ function createStream(config: PinoSeq.SeqConfig): Writable & {
15
+ flush: () => Promise<Boolean>;
16
+ };
15
17
  }
16
18
 
17
19
  export = PinoSeq;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pino-seq",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "A stream that sends Pino log events to Seq",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -27,16 +27,16 @@
27
27
  },
28
28
  "homepage": "https://github.com/datalust/pino-seq#readme",
29
29
  "devDependencies": {
30
+ "@types/pino": "^5.8.6",
30
31
  "mocha": "^7.1.1",
31
- "pino": "^6.7.0",
32
32
  "ts-node": "^8.1.0",
33
33
  "typescript": "^3.4.4"
34
34
  },
35
35
  "dependencies": {
36
- "@types/pino": "^5.8.6",
37
36
  "commander": "^2.20.0",
38
- "seq-logging": "^2.0.0",
39
- "split2": "^3.1.1"
37
+ "seq-logging": "^2.2.0",
38
+ "split2": "^3.1.1",
39
+ "pino": "^6.7.0"
40
40
  },
41
41
  "engines": {
42
42
  "node": ">=14.0.0"
package/pinoSeqStream.js CHANGED
@@ -38,6 +38,8 @@ class PinoSeqStream extends stream.Writable {
38
38
  let forSeq = {
39
39
  timestamp: new Date(time),
40
40
  level: LEVEL_NAMES[level],
41
+ traceId: props.trace_id,
42
+ spanId: props.span_id,
41
43
  messageTemplate: msg ? msg : errMessage,
42
44
  properties: { ...this._additionalProperties, ...errorProps, ...props },
43
45
  exception: stack ? stack : errStack
@@ -96,6 +98,11 @@ class PinoSeqStream extends stream.Writable {
96
98
  }
97
99
  }
98
100
 
101
+ flush() {
102
+ this.flushBuffer();
103
+ return this._logger.flush();
104
+ }
105
+
99
106
  // Force the underlying logger to flush at the time of the call
100
107
  // and wait for pending writes to complete
101
108
  _final(callback) {
package/test/cli_tests.js CHANGED
@@ -9,4 +9,12 @@ pino.debug('debug message');
9
9
  pino.info('info message');
10
10
  pino.warn('warn message');
11
11
  pino.error(new Error('error message'));
12
- pino.fatal('fatal message');
12
+ pino.fatal('fatal message');
13
+
14
+ const logWithProperties = pino.child({
15
+ a: 1,
16
+ trace_id: '6112be4ab9f113c499dbf4817e503a69',
17
+ span_id: '2f2b39a596fc76cd',
18
+ });
19
+
20
+ logWithProperties.info('info with properties');