pub struct Logger;Expand description
§Logger for libpt
A logger is generally a functionality that let’s you write information from your library or
application in a more structured manner than if you just wrote all information to stdout or
stderr with the likes of println! or eprintln!.
It offers writing to multiple targets, such as both the terminal and a log file, and allows users to choose the verbosity of the information that gets printed by selecting a Loglevel.
§Levels
- ERROR – Something broke
- WARN – Something is bad
- INFO – Useful information for users
- DEBUG – Useful information for developers
- TRACE – Very verbose information for developers (often for libraries)
§Usage
You don’t need to use the Logger struct, it’s better to use the macros instead:
You can however use the Logger struct in cases where usage of a macro is impossible or
you are somehow working with multiple loggers. The macros offer additional functionalities,
suck as full format! support and context, see tracing, which we use as backend.
§Examples
Logger::builder()
.uptime(true)
.build();
info!("hello world");
Implementations§
Source§impl Logger
§Main implementation
impl Logger
§Main implementation
Sourcepub fn builder() -> LoggerBuilder
pub fn builder() -> LoggerBuilder
Get a new LoggerBuilder