-
Notifications
You must be signed in to change notification settings - Fork 84
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
Stop redraw when there is other logging #145
Comments
I'm facing this issue too! |
At the moment, the SingleBar does not allow additional logging messages during the progressbar's display. This is however available if you use the MultiBar which has a |
@gregormaclaine Thanks man, it works like a charm! |
@gregormaclaine, thank you for the above suggestion! However, I did notice a weird behavior: the very last message I log using |
@andreiled I ran into this as well. It's because it buffers the logs, and only outputs them when the |
@jcapcik, thank you for the suggestion! |
Here is my solution class MyBar extends cliProgress.SingleBar {
constructor(total = 0, start = 0, suffix = '') {
super({
format: `{bar} {percentage}% | ETA: {eta_formatted} | {value}/{total}${suffix ? ' | ' + suffix : ''}`,
barCompleteChar: '\u2588',
barIncompleteChar: '\u2591'
});
const consoleLoggers = allLoggers.filter(l => l.logToConsole);
this.on('redraw-post', () => consoleLoggers.forEach(l => l.insertNewLineOnce()));
this.start(total, start);
}
end() {
this.render();
this.removeAllListeners();
clearTimeout(this['timer']);
}
} Crucial is calling |
In the code Im running there is an exception so I log the messages. the problem is that it will break the bar and make it redraw. How to make the bar stick at the bottom of the terminal? Thanks in advanced!
The text was updated successfully, but these errors were encountered: