Skip to content
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

In high frequency updates the loader shows up in between multibar logs #157

Open
saikatmitra91 opened this issue Apr 10, 2024 · 0 comments

Comments

@saikatmitra91
Copy link

Code Snippet

const cliProgress = require("cli-progress");
const ProgressBar = cliProgress.MultiBar;

const multi = new ProgressBar({
  format:
    "Progress |" +
    "{bar}" +
    "| {percentage}% || {value}/{total} Chunks || Speed: {speed} || ETA: {eta}s",
  hideCursor: true,
  barCompleteChar: '\u2588',
    barIncompleteChar: '\u2591',
    clearOnComplete: true,
    stopOnComplete: true,
    forceRedraw: true
});

const bar1 = multi.create(100, 0);
const bar2 = multi.create(100, 0)

let i = 0;
const interval = setInterval(() => {
  // Simulate some process
  i++;

  // Print logs
  multi.log(`Log message ${i} \n`);

  // Update progress bar
  bar1.update(i);
  bar2.update(i);

  if (i === 100) {
    clearInterval(interval);
    multi.stop();
    console.log("All items processed!");
  }
}, 10);

Output
Screenshot 2024-04-10 at 5 27 19 PM

Expected

Screenshot 2024-04-10 at 5 32 26 PM

The logs should be clean with progress bar cleanly appearing at the bottom

please let me know If there is a way to mitigate this issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant