Comparing version 7.6.2 to 7.6.3
@@ -35,3 +35,3 @@ # Web Frameworks | ||
See the [fastify documentation](https://www.fastify.io/docs/latest/Logging/) for more information. | ||
See the [fastify documentation](https://www.fastify.io/docs/latest/Reference/Logging/) for more information. | ||
@@ -38,0 +38,0 @@ <a id="express"></a> |
@@ -409,2 +409,5 @@ 'use strict' | ||
} else if (opts.transport) { | ||
if (opts.transport instanceof SonicBoom || opts.transport.writable || opts.transport._writableState) { | ||
throw Error('option.transport do not allow stream, please pass to option directly. e.g. pino(transport)') | ||
} | ||
stream = transport({ caller, ...opts.transport }) | ||
@@ -414,2 +417,4 @@ } | ||
opts.serializers = Object.assign({}, defaultOptions.serializers, opts.serializers) | ||
opts.formatters = Object.assign({}, defaultOptions.formatters, opts.formatters) | ||
if ('onTerminated' in opts) { | ||
@@ -416,0 +421,0 @@ throw Error('The onTerminated option has been removed, use pino.final instead') |
@@ -66,2 +66,3 @@ 'use strict' | ||
stream.flushSync() | ||
stream.end() | ||
} | ||
@@ -68,0 +69,0 @@ |
{ | ||
"name": "pino", | ||
"version": "7.6.2", | ||
"version": "7.6.3", | ||
"description": "super fast, all natural json logger", | ||
@@ -5,0 +5,0 @@ "main": "pino.js", |
@@ -232,4 +232,4 @@ // Type definitions for pino 7.0 | ||
interface TransportPipelineOptions{ | ||
pipeline: TransportSingleOptions[] | ||
interface TransportPipelineOptions<TransportOptions = Record<string, any>> extends TransportBaseOptions<TransportOptions>{ | ||
pipeline: TransportSingleOptions<TransportOptions>[] | ||
} | ||
@@ -566,2 +566,12 @@ | ||
}; | ||
/** | ||
* Stringification limit at a specific nesting depth when logging circular object. Default: `5`. | ||
*/ | ||
depthLimit?: number | ||
/** | ||
* Stringification limit of properties/elements when logging a specific object/array with circular references. Default: `100`. | ||
*/ | ||
edgeLimit?: number | ||
} | ||
@@ -704,3 +714,3 @@ | ||
export function transport<TransportOptions = Record<string, any>>( | ||
options: TransportSingleOptions<TransportOptions> | TransportMultiOptions<TransportOptions> | ||
options: TransportSingleOptions<TransportOptions> | TransportMultiOptions<TransportOptions> | TransportPipelineOptions<TransportOptions> | ||
): ThreadStream | ||
@@ -707,0 +717,0 @@ |
@@ -115,9 +115,2 @@ 'use strict' | ||
if (!allFormatters.bindings) { | ||
allFormatters.bindings = defaultOptions.formatters.bindings | ||
} | ||
if (!allFormatters.level) { | ||
allFormatters.level = defaultOptions.formatters.level | ||
} | ||
const stringifiers = redact ? redaction(redact, stringify) : {} | ||
@@ -124,0 +117,0 @@ const stringifyFn = stringify.bind({ |
@@ -10,2 +10,3 @@ 'use strict' | ||
logger.info('Hello') | ||
process.exit(0) |
@@ -380,2 +380,16 @@ 'use strict' | ||
test('log and exit before ready with async dest', async ({ not }) => { | ||
const destination = join( | ||
os.tmpdir(), | ||
'_' + Math.random().toString(36).substr(2, 9) | ||
) | ||
const child = execa(process.argv[0], [join(__dirname, '..', 'fixtures', 'transport-exit-immediately-with-async-dest.js'), destination]) | ||
await once(child, 'exit') | ||
const actual = await readFile(destination, 'utf8') | ||
not(strip(actual).match(/HELLO/), null) | ||
not(strip(actual).match(/WORLD/), null) | ||
}) | ||
test('string integer destination', async ({ not }) => { | ||
@@ -484,1 +498,18 @@ let actual = '' | ||
}) | ||
test('transport options with stream', async ({ fail, equal, teardown }) => { | ||
try { | ||
const dest1 = join( | ||
os.tmpdir(), | ||
'_' + Math.random().toString(36).substr(2, 9) | ||
) | ||
const transportStream = pino.transport({ target: 'pino/file', options: { destination: dest1 } }) | ||
teardown(transportStream.end.bind(transportStream)) | ||
pino({ | ||
transport: transportStream | ||
}) | ||
fail('must throw') | ||
} catch (err) { | ||
equal(err.message, 'option.transport do not allow stream, please pass to option directly. e.g. pino(transport)') | ||
} | ||
}) |
@@ -47,2 +47,14 @@ import { pino } from '../../pino' | ||
const pipelineTransport = pino.transport({ | ||
pipeline: [{ | ||
target: './my-transform.js' | ||
}, { | ||
// Use target: 'pino/file' to write to stdout | ||
// without any change. | ||
target: 'pino-pretty' | ||
}] | ||
}) | ||
pino(pipelineTransport) | ||
expectType<pino.Logger>(pino({ | ||
@@ -49,0 +61,0 @@ transport: { |
@@ -58,2 +58,10 @@ import P, { pino } from "../../"; | ||
pino({ | ||
depthLimit: 1 | ||
}); | ||
pino({ | ||
edgeLimit: 1 | ||
}); | ||
pino({ | ||
browser: { | ||
@@ -60,0 +68,0 @@ write(o) {}, |
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
461418
145
11116
49