Crate flogging_macros

Source
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 flogging

Alternatively, 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 &str with interpolated variables: ("Var: {var}")
    • format &str with supporting parameters: ("Var: {}", var)
    • Combination of the last two: ("Vars {var1} - {}:{}", var2, var3)
  • 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 Display implementations, or you just need their data without further explanation.
  • Special Cases
    • entering! and exiting!
    • These two macros have the same features as the others, but they may also be used without any parameters. In such a case, their defaults will be used.

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 Logger instance.
severe
Log a SEVERE message.
warning
Log a WARNING message.

Attribute Macros§

logger
Provides for logging within the attributed function/method.