-
Notifications
You must be signed in to change notification settings - Fork 847
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
using pino.multistream with synchronous logging #1260
Comments
I can see why that sentence can be confusing: by default pino using Note that multistream can only be asynchronous (by its nature). |
thanks for the explanation. Do you have any guidance for me how I can log (using pino) to multiple destinations and still do it synchronously? If it is not at all possible then I will have to think of some other logging strategy. |
ok, setting multiple transport: {
targets: [
{target: 'pino-pretty'},
{
target: 'pino/file',
level: 'debug',
options: {destination: `${logdir}/debug.log`}
},
{
target: 'pino/file',
level: 'info',
options: {destination: `${logdir}/info.log`}
},
{
target: 'pino/file',
level: 'warn',
options: {destination: `${logdir}/warn.log`}
},
{
target: 'pino/file',
level: 'error',
options: {destination: `${logdir}/error.log`}
},
{
target: 'pino/file',
level: 'fatal',
options: {destination: `${logdir}/fatal.log`}
}
]
} |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
from what I understand, Pino (v 7.5.1) by default does sync logging. From the docs
I am using
pino.multistreams
like soStrangely, Pino is behaving asynchronously. I have a
curl
operation that is outputting out of sequence (before earlier events that are usinglog.info
)and my
console
output isthis is a bit annoying and confusing. Maybe this is not the fault of Pino, and maybe
curl
is causing the problem. But I experience the same problem when I try to use a progress bar. The progress bar displays in the console whilepino
seems to hold on to all the messages. Then the pinolog.info
messages show in the console once the progress bar ends. If I replace pino logging withconsole.log
then the order is as expected. So it seems the problem is with Pino behaving asynchronously whenever some other (non-pino) process writes to the console. How can I go back to simple synchronous logging with pino while using multistreams?The text was updated successfully, but these errors were encountered: