pino-seq 1.1.0 → 2.0.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: [16.x, 18.x, 20.x]
19
+ node-version: [18.x, 20.x, 22.x]
20
20
  os: [ubuntu-latest, windows-latest, macOS-latest]
21
21
 
22
22
  steps:
@@ -27,4 +27,5 @@ jobs:
27
27
  node-version: ${{ matrix.node-version }}
28
28
  - run: npm ci
29
29
  - run: npm run build --if-present
30
- - run: npm test
30
+ - run: npm test
31
+ - run: ./cli.js --help
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # pino-seq ![Build](https://github.com/datalust/pino-seq/workflows/Test/badge.svg) ![Publish](https://github.com/datalust/pino-seq/workflows/Publish/badge.svg) [![NPM](https://img.shields.io/npm/v/pino-seq.svg)](https://www.npmjs.com/package/pino-seq)
2
2
 
3
- A stream to send [Pino](https://github.com/pinojs/pino) events to [Seq](https://datalust.co/seq). Tested with Node.js versions 4.2.2 and up.
3
+ A stream to send [Pino](https://github.com/pinojs/pino) events to [Seq](https://datalust.co/seq). Tested with Node.js versions 18.x and up.
4
4
 
5
5
  ### Out-of-process (transport) usage <sup>recommended</sup>
6
6
 
@@ -9,7 +9,7 @@ First, install and use `pino` in your Node.js app, following the instructions in
9
9
  This will look something like:
10
10
 
11
11
  ```js
12
- const logger = require('pino')();
12
+ const logger = (await import('pino'))();
13
13
  logger.info('Hello, World!');
14
14
  ```
15
15
 
@@ -47,8 +47,8 @@ node your-app.js 2> >(pino-seq --logOtherAs Error --serverUrl http://localhost:5
47
47
  Use the `createStream()` method to create a Pino stream configuration, passing `serverUrl`, `apiKey` and batching parameters.
48
48
 
49
49
  ```js
50
- let pino = require('pino');
51
- let pinoToSeq = require('pino-seq');
50
+ import pino from 'pino';
51
+ import pinoToSeq from 'pino-seq';
52
52
 
53
53
  let stream = pinoToSeq.createStream({ serverUrl: 'http://localhost:5341' });
54
54
  let logger = pino({ name: 'pino-seq example' }, stream);
package/cli.js CHANGED
@@ -1,14 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
- const program = require('commander');
4
- const split2 = require('split2');
5
-
6
- const pkg = require('./package.json');
7
- const pinoSeq = require('./index');
3
+ import { program } from 'commander';
4
+ import split2 from 'split2';
5
+ import pinoSeq from './index.js';
8
6
 
9
7
  function main() {
10
8
  program
11
- .version(pkg.version)
12
9
  .option('-s, --serverUrl <serverUrl>', 'Seq server instance')
13
10
  .option('-k, --apiKey <apiKey>', 'Seq API key')
14
11
  .option(
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- let pino = require('pino');
4
- let pinoToSeq = require('../index');
3
+ import pino from 'pino';
4
+ import pinoToSeq from '../index.js';
5
5
 
6
6
  let stream = pinoToSeq.createStream({serverUrl: "http://localhost:5341"});
7
7
  let logger = pino({name: "pino-seq example"}, stream);
@@ -1,6 +1,5 @@
1
- import * as Pino from "pino"
2
- import * as PinoSeq from ".."
3
-
1
+ import Pino from "pino"
2
+ import PinoSeq from ".."
4
3
 
5
4
  const stream = PinoSeq.createStream({serverUrl: "http://localhost:5341"});
6
5
 
@@ -13,3 +12,5 @@ logger.info("Hello Seq, from Pino");
13
12
 
14
13
  const frLogger = logger.child({lang: "fr"});
15
14
  frLogger.warn("au reviour");
15
+
16
+ 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/index.js CHANGED
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
- let PinoSeqStream = require('./pinoSeqStream');
3
+ import { PinoSeqStream } from './pinoSeqStream.js';
4
4
 
5
- module.exports = {
5
+ export default {
6
6
  createStream: config => {
7
7
  config = config || {};
8
8
  return new PinoSeqStream(config);
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "pino-seq",
3
- "version": "1.1.0",
3
+ "version": "2.0.0",
4
4
  "description": "A stream that sends Pino log events to Seq",
5
5
  "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "type": "module",
6
8
  "scripts": {
7
- "test": "node ./node_modules/mocha/bin/mocha",
8
- "test:cli": "node ./test/cli_tests.js | node ./cli.js --property application='pino-seq'",
9
+ "test": "mocha",
9
10
  "start": "node ./example/example.js",
10
- "start:ts": "ts-node ./example/example.ts"
11
+ "start:ts": "tsx ./example/example.ts"
11
12
  },
12
13
  "bin": {
13
14
  "pino-seq": "./cli.js"
@@ -27,18 +28,17 @@
27
28
  },
28
29
  "homepage": "https://github.com/datalust/pino-seq#readme",
29
30
  "devDependencies": {
30
- "@types/pino": "^5.8.6",
31
- "mocha": "^7.1.1",
32
- "ts-node": "^8.1.0",
33
- "typescript": "^3.4.4"
31
+ "mocha": "^11.2.2",
32
+ "tsx": "^4.19.4",
33
+ "typescript": "^5.8.3"
34
34
  },
35
35
  "dependencies": {
36
- "commander": "^2.20.0",
37
- "seq-logging": "^2.2.0",
38
- "split2": "^3.1.1",
39
- "pino": "^6.7.0"
36
+ "commander": "^13.1.0",
37
+ "seq-logging": "^3.0.0",
38
+ "split2": "^4.2.0",
39
+ "pino": "^9.6.0"
40
40
  },
41
41
  "engines": {
42
- "node": ">=14.0.0"
42
+ "node": ">=18.0.0"
43
43
  }
44
44
  }
package/pinoSeqStream.js CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
- let stream = require('stream');
4
- let seq = require('seq-logging');
3
+ import stream from 'stream';
4
+ import { Logger as SeqLogger } from 'seq-logging';
5
5
 
6
6
  let LEVEL_NAMES = {
7
7
  10: 'Verbose',
@@ -22,7 +22,7 @@ class PinoSeqStream extends stream.Writable {
22
22
  this._logOtherAs = logOtherAs;
23
23
  this._bufferTime = false;
24
24
  this._buffer = [];
25
- this._logger = new seq.Logger(loggerConfig);
25
+ this._logger = new SeqLogger(loggerConfig);
26
26
  }
27
27
 
28
28
  _write(message, enc, cb) {
@@ -98,6 +98,11 @@ class PinoSeqStream extends stream.Writable {
98
98
  }
99
99
  }
100
100
 
101
+ flush() {
102
+ this.flushBuffer();
103
+ return this._logger.flush();
104
+ }
105
+
101
106
  // Force the underlying logger to flush at the time of the call
102
107
  // and wait for pending writes to complete
103
108
  _final(callback) {
@@ -109,4 +114,4 @@ class PinoSeqStream extends stream.Writable {
109
114
  }
110
115
  }
111
116
 
112
- module.exports = PinoSeqStream;
117
+ export { PinoSeqStream };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- let PinoSeqStream = require('../pinoSeqStream');
3
+ import { PinoSeqStream } from '../pinoSeqStream.js';
4
4
 
5
5
  describe('PinoSeqStream', () => {
6
6
  describe('constructor', () => {
package/test/cli_tests.js DELETED
@@ -1,20 +0,0 @@
1
- "use strict";
2
-
3
- const pino = require('pino')({
4
- level: 'trace'
5
- });
6
-
7
- pino.trace('trace message');
8
- pino.debug('debug message');
9
- pino.info('info message');
10
- pino.warn('warn message');
11
- pino.error(new Error('error 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');