'Applying progress bar library with logger library in nodejs

I want to integrate 'cli-progress' with 'pino logger' to create something like this which the progress bar is consistent in its position

[=======================] 100%
log1
log2
log3
...

but I get this instead which the bar will be jammed up with logs

[===                    ] 10%
log1
log2
[==========             ] 30%
log3
...
[=======================] 100%

I wonder if I can achieve something like this which I can separate two write streams to the terminal

such as

[ writes for bar to be consistently on top ]
[ writes for logs will take the rest of the space]

As I know that it is impossible for me to replace "pino", is there a way I can work around with this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source