title: How to work with logging and progress bar in a node.js CLI application?
body: <h2>Context</h2>
  <p>In the Node.js application, I use:</p>
  <ul>
  <li><a href="https://github.com/visionmedia/node-progress" rel="nofollow noreferrer">node-progress</a> for progress bar</li>
  <li><a href="https://github.com/winstonjs/winston" rel="nofollow noreferrer">winston</a> for logging</li>
  </ul>
  <p>The CLI application will display a progress bar when building files. During the build operation, sometimes information/errors need to be logged to the console. This disturbs the progress bar in that:</p>
  <ul>
  <li>the info/error logs to the console immediately after the progress bar and not on a newline</li>
  <li>the progress bar gets printed again after the logs have finished, resulting in multiple progress bars printed in the console</li>
  </ul>
  <p>Illustration of the console:</p>
  <pre><code>[===========----------------------] 11 / 33 builtwarn: something wrong here.
  [=============--------------------] 13 / 33 builtwarn: something wrong here.
  warn: example warning that continues here.
  error:  some stacktrace
  [=================================] 33 / 33 built
  </code></pre>
  <h2>Question</h2>
  <p>Is there a way to ensure that the progress bar is not disturbed and any information logs to the console are printed above/below the bar? Such that only one progress bar is shown.</p>
  <p>I understand that there's a <a href="https://github.com/visionmedia/node-progress#interrupt" rel="nofollow noreferrer"><code>interrupt</code></a> method in node-progress, but I am not sure how to use that with winston.</p>
  <p>I would imagine this to be a fairly common scenario in CLI applications so any suggestions/ideas of how to do it via other dependencies/approaches are appreciated too!</p>