rust-lang / mdBook

Create book from markdown files. Like Gitbook but implemented in Rust
https://rust-lang.github.io/mdBook/
Mozilla Public License 2.0
17.69k stars 1.61k forks source link

Improve output to stdout #407

Closed azerupi closed 6 years ago

azerupi commented 7 years ago

Currently, rendering a book prints lines like these on the terminal:

INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./introduction.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating index.html from "/Volumes/FilesOSX/Users/azerupi/Programming/Rust/mdBook/../../TESTS/timely-dataflow/mdbook/book/./introduction.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_0/chapter_0.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_0/chapter_0_1.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_0/chapter_0_2.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_0/chapter_0_3.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_1/chapter_1.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_1/chapter_1_1.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_1/chapter_1_2.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_1/chapter_1_3.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_2/chapter_2.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_2/chapter_2_1.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_2/chapter_2_2.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_2/chapter_2_3.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_2/chapter_2_4.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_3.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_3/chapter_3_1.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_3/chapter_3_2.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_3/chapter_3_3.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_5.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_5/chapter_5_1.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_5/chapter_5_2.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_5/chapter_5_3.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_5/chapter_5_4.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_4/chapter_4.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_4/chapter_4_1.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating "./chapter_4/chapter_4_2.html" ✓
INFO:mdbook::renderer::html_handlebars::hbs_renderer: [*] Creating print.html ✓

That is a lot of repetition and even information the user should not need to see. The INFO:mdbook::renderer::html_handlebars::hbs_renderer: should be hidden from stdout. Also, it may not be that interesting to list out all the files we create by default. We should probably hide this behind a verbose flag.

I think we need a better solution for logging and printing to the user. The two don't seem to mix well, we already considered doing like cargo and separate logging from user output. Having two separate mechanics for the two. Maybe it's time to reconsider something like that and improve our story dramatically here.

So as we brainstorm, here are a couple of things I would consider to be the requirements:

boxdot commented 6 years ago

Is this actually still relevant? I don't see the above output anymore:

2018-01-29 21:06:09 [INFO] (mdbook::book): Book building has started
2018-01-29 21:06:09 [INFO] (mdbook::book): Running the html backend

I guess, it still would make sense to output that the book was created successfully?

Michael-F-Bryan commented 6 years ago

Thanks @boxdot. We probably should have closed this issue when we toned down the logging in #569, although that was mostly a case of converting info!() log messages into debug!().

I'll look at adding a final "book built successfully" message after the renderers have run.