Comparing version 8.20.0 to 8.21.0
@@ -14,2 +14,3 @@ # Pino Ecosystem | ||
### Frameworks | ||
+ [`express-pino-logger`](https://github.com/pinojs/express-pino-logger): use | ||
@@ -19,2 +20,8 @@ Pino to log requests within [express](https://expressjs.com/). | ||
log requests within [Koa](https://koajs.com/). | ||
+ [`rill-pino-logger`](https://github.com/pinojs/rill-pino-logger): use Pino as | ||
the logger for the [Rill framework](https://rill.site/). | ||
+ [`restify-pino-logger`](https://github.com/pinojs/restify-pino-logger): use | ||
Pino to log requests within [restify](http://restify.com/). | ||
### Utilities | ||
+ [`pino-arborsculpture`](https://github.com/pinojs/pino-arborsculpture): change | ||
@@ -59,6 +66,2 @@ log levels at runtime. | ||
according to a given format string. | ||
+ [`restify-pino-logger`](https://github.com/pinojs/restify-pino-logger): use | ||
Pino to log requests within [restify](http://restify.com/). | ||
+ [`rill-pino-logger`](https://github.com/pinojs/rill-pino-logger): use Pino as | ||
the logger for the [Rill framework](https://rill.site/). | ||
+ [`pino-test`](https://github.com/pinojs/pino-test): a set of utilities for | ||
@@ -65,0 +68,0 @@ verifying logs generated by the Pino logger. |
@@ -426,2 +426,3 @@ # Transports | ||
+ [pino-discord-webhook](#pino-discord-webhook) | ||
+ [pino-logfmt](#pino-logfmt) | ||
@@ -1051,2 +1052,17 @@ ### Legacy | ||
<a id="pino-logfmt"></a> | ||
### pino-logfmt | ||
[pino-logfmt](https://github.com/botflux/pino-logfmt) is a Pino v7+ transport that formats logs into [logfmt](https://brandur.org/logfmt). This transport can output the formatted logs to stdout or file. | ||
```js | ||
import pino from 'pino' | ||
const logger = pino({ | ||
transport: { | ||
target: 'pino-logfmt' | ||
} | ||
}) | ||
``` | ||
<a id="communication-between-pino-and-transport"></a> | ||
@@ -1053,0 +1069,0 @@ ## Communication between Pino and Transports |
'use strict' | ||
module.exports = { version: '8.20.0' } | ||
module.exports = { version: '8.21.0' } |
@@ -24,2 +24,3 @@ 'use strict' | ||
add, | ||
emit, | ||
flushSync, | ||
@@ -83,2 +84,10 @@ end, | ||
function emit (...args) { | ||
for (const { stream } of this.streams) { | ||
if (typeof stream.emit === 'function') { | ||
stream.emit(...args) | ||
} | ||
} | ||
} | ||
function flushSync () { | ||
@@ -158,2 +167,3 @@ for (const { stream } of this.streams) { | ||
clone, | ||
emit, | ||
flushSync, | ||
@@ -160,0 +170,0 @@ [metadata]: true |
@@ -114,2 +114,4 @@ 'use strict' | ||
options.pinoWillSendConfig = true | ||
return buildStream(fixTarget(target), options, worker) | ||
@@ -116,0 +118,0 @@ |
{ | ||
"name": "pino", | ||
"version": "8.20.0", | ||
"version": "8.21.0", | ||
"description": "super fast, all natural json logger", | ||
@@ -107,3 +107,3 @@ "main": "pino.js", | ||
"on-exit-leak-free": "^2.1.0", | ||
"pino-abstract-transport": "^1.1.0", | ||
"pino-abstract-transport": "^1.2.0", | ||
"pino-std-serializers": "^6.0.0", | ||
@@ -115,3 +115,3 @@ "process-warning": "^3.0.0", | ||
"sonic-boom": "^3.7.0", | ||
"thread-stream": "^2.0.0" | ||
"thread-stream": "^2.6.0" | ||
}, | ||
@@ -118,0 +118,0 @@ "tsd": { |
@@ -164,2 +164,6 @@ 'use strict' | ||
if (typeof stream.emit === 'function') { | ||
stream.emit('message', { code: 'PINO_CONFIG', config: { levels, messageKey, errorKey } }) | ||
} | ||
assertLevelComparison(levelComparison) | ||
@@ -166,0 +170,0 @@ const levelCompFunc = genLevelComparison(levelComparison) |
@@ -232,2 +232,35 @@ 'use strict' | ||
test('streams receive a message event with PINO_CONFIG', ({ match, end }) => { | ||
const stream = sink() | ||
stream.once('message', (message) => { | ||
match(message, { | ||
code: 'PINO_CONFIG', | ||
config: { | ||
errorKey: 'err', | ||
levels: { | ||
labels: { | ||
10: 'trace', | ||
20: 'debug', | ||
30: 'info', | ||
40: 'warn', | ||
50: 'error', | ||
60: 'fatal' | ||
}, | ||
values: { | ||
debug: 20, | ||
error: 50, | ||
fatal: 60, | ||
info: 30, | ||
trace: 10, | ||
warn: 40 | ||
} | ||
}, | ||
messageKey: 'msg' | ||
} | ||
}) | ||
end() | ||
}) | ||
pino(stream) | ||
}) | ||
test('does not explode with a circular ref', async ({ doesNotThrow }) => { | ||
@@ -234,0 +267,0 @@ const stream = sink() |
@@ -11,3 +11,3 @@ 'use strict' | ||
const strip = require('strip-ansi') | ||
const { file } = require('./helper') | ||
const { file, sink } = require('./helper') | ||
@@ -250,2 +250,15 @@ test('sends to multiple streams using string levels', function (t) { | ||
test('emit propagates events to each stream', function (t) { | ||
t.plan(3) | ||
const handler = function (data) { | ||
t.equal(data.msg, 'world') | ||
} | ||
const streams = [sink(), sink(), sink()] | ||
streams.forEach(function (s) { | ||
s.once('hello', handler) | ||
}) | ||
const stream = multistream(streams) | ||
stream.emit('hello', { msg: 'world' }) | ||
}) | ||
test('children support custom levels', function (t) { | ||
@@ -252,0 +265,0 @@ const stream = writeStream(function (data, enc, cb) { |
@@ -456,2 +456,15 @@ 'use strict' | ||
test('sets worker data informing the transport that pino will send its config', ({ match, plan, teardown }) => { | ||
plan(1) | ||
const transport = pino.transport({ | ||
target: join(__dirname, '..', 'fixtures', 'transport-worker-data.js') | ||
}) | ||
teardown(transport.end.bind(transport)) | ||
const instance = pino(transport) | ||
transport.once('workerData', (workerData) => { | ||
match(workerData.workerData, { pinoWillSendConfig: true }) | ||
}) | ||
instance.info('hello') | ||
}) | ||
test('stdout in worker', async ({ not }) => { | ||
@@ -458,0 +471,0 @@ let actual = '' |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
715158
195
14206
55
Updatedthread-stream@^2.6.0