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

Console.log in Observable #122

Open
rap2hpoutre opened this issue Oct 24, 2018 · 1 comment
Open

Console.log in Observable #122

rap2hpoutre opened this issue Oct 24, 2018 · 1 comment

Comments

@rap2hpoutre
Copy link
Contributor

Thank you for maintaining this lib.

This code does not persists console.log ouput:

const Listr = require("listr");
const Observable = require("rxjs").Observable;

const tasks = new Listr([
  {
    title: "task",
    task: async () => {
      return new Observable(observer => {
        console.log("task - INIT");
        observer.next("Foo");

        setTimeout(() => {
          console.log("task - TIMEOUT 2000");
          observer.next("Bar");
        }, 2000);

        setTimeout(() => {
          console.log("task - TIMEOUT 4000");
          observer.complete();
        }, 4000);
      });
    }
  }
]);
tasks.run();

It displays:

✗ node test.js
task - INIT
 ⠏ task
 ⠇ task
 ✔ task

task - TIMEOUT 2000 and task - TIMEOUT 4000 just flash then break line.

Is it the normal behavior? Is there a way to avoid this?

My goal is to persists some error on console (warnings, errors and information that does not need to stop the process but are important).

@privatenumber
Copy link

Logging a line-break \n seems to help it persist

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

2 participants