Expand description
§Flogging Macros
This is a supporting crate for the flogging crate.
It is not meant to be used on its own. In fact, it would not work without the
other crate. Further, it should not be separately added to your project. Add
flogging instead, and this will be included as a dependent to that crate.
$ cargo add floggingAlternatively, add the following to your project’s Cargo.toml file:
[dependencies]
flogging = "0.4.1"§Special Note
For the macros that accept the parameter: msg, the following is true:
- They accept parameters the same as for
std::format!- plain text
&str:("It's your time.") - format
&strwith interpolated variables:("Var: {var}") - format
&strwith supporting parameters:("Var: {}", var) - Combination of the last two:
("Vars {var1} - {}:{}", var2, var3)
- plain text
- Additional Feature
- Just one or more variables:
(var1, var2, var3) - In this case, a default format string will be used:
"{}, {}, {}" - The number of
"{}"will depend on the number of parameters. - Ideal for logging concrete instances that have very good
Displayimplementations, or you just need their data without further explanation.
- Just one or more variables:
- Special Cases
Macros§
- config
- Log a CONFIG message.
- entering
- Log entry into a function/method.
- exiting
- Log return from a function/method.
- fine
- Log a FINE message.
- finer
- Log a FINER message.
- finest
- Log a FINEST message.
- get_
handler - Get the required
Handler. - info
- Log an INFO message.
- set_
level - Set the logging level for this
Loggerinstance. - severe
- Log a SEVERE message.
- warning
- Log a WARNING message.
Attribute Macros§
- logger
- Provides for logging within the attributed function/method.