-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sync
doesn't work
#504
Comments
A few notes:
Adding some docs on all the above would be good, as it seems it's a source of confusion. |
thank you for the answer, that explains it |
Can one give a short example? |
import pretty from 'pino-pretty'
// Initialize logger
const logger = pino(pretty({sync: true})) |
Yes but the request was how to use it with other transports. I've solved it by constructing my streams manually: const pinoOptions: LoggerOptions = {
// Set the global log level to the lowest level
// We adjust the level per transport
level: 'trace',
hooks: {},
serializers: {
// Handle error properties as Error and serialize them correctly
err: pino.stdSerializers.err,
error: pino.stdSerializers.err,
validationErrors: pino.stdSerializers.err,
},
};
const streams: StreamEntry[] = [];
streams.push({
level: "info",
stream: PinoPretty({
sync: true,
colorize: true,
})
});
streams.push({
level: level,
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
stream: pino.transport({
target: './app.log'
})
});
streams.push({
level: "debug",
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
stream: pino.transport({
target: 'pino-opentelemetry-transport',
})
});
export const baseLogger = pino(pinoOptions, pino.multistream(streams)); |
Expected:
Actual:
It works fine without
pretty-print
:Output:
The text was updated successfully, but these errors were encountered: