google / comprehensive-rust

This is the Rust course used by the Android team at Google. It provides you the material to quickly teach Rust.
https://google.github.io/comprehensive-rust/
Apache License 2.0
28.01k stars 1.67k forks source link

[Exercise][13. Methods and Traits] Better output of example solution #2382

Closed Alx-Lai closed 1 month ago

Alx-Lai commented 2 months ago

In Section13.4, there's an exercise code section to write a VerbosityFilter of a Logger; however, the logger uses eprintln! macro to output the log, which output to stderr. Therefore, the run result in the website shows only No output.

Should we consider logging out messages from both stdout and stderr?

Comparison In Rust Playground:

=====Standard Error=====
   Compiling playground v0.0.1 (/playground)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.54s
     Running `target/debug/playground`
verbosity=2: Uhoh
=====Standard Output====

In Comprehensive Rust:

No output
djmitche commented 1 month ago

Probably easiest to just change eprintln to println? Do you want to make up a PR?

Alx-Lai commented 1 month ago

Hi @djmitche, just noticed #531, probably we can revert this change after #531 is fixed.

djmitche commented 1 month ago

Thanks for spotting that! I think the change is fine with or without that fix.