There's more...

For simplicity's sake, FileLogger doesn't discriminate against any targets. A more sophisticated logger, like env_logger, can set different logging levels on different targets. For this purpose, log provides us with the LevelFilter enum, which has an Off state that corresponds to no logging enabled for this target. If you need to create such a logger, be sure to remember said enum. You can get some inspiration about how to implement target-based filters by looking at the source code of env_logger at https://github.com/sebasmagri/env_logger/blob/master/src/filter/mod.rs.

In a really user-friendly logger, you'll want to display the timestamp in the user's own local time. For all things related to time measurement, time zones, and dates, check out the chrono crate at https://crates.io/crates/chrono.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.224.59.145