Expand description
This crate provides a wrapper over log
crate that allows you
to specify the type of messages and automatically suppress
types of messages that are overwhelmingly sent.
Basic usage:
clilog::info!(I01TEST, "test message");
when message tagged I01TEST
is sent over 20 times, a tip will be
printed and further such messages will be suppressed.
At the end, you can optionally print a statistics of how many messages are suppressed. (TODO: not implemented yet.)
Re-exports§
Macros§
- debug
- error
- executing
- Makes an existing timer output an ‘executing’ mesasge. Can be called multiple times.
- finish
- Makes an existing timer output a ‘finished’ mesasge and suppresses the normal drop message. Only the first call has any effect, subsequent calls will be ignored.
- info
- log_
monitor - general logging macro that can either log normally, or
check the count before logging.
this is the basis of other macros like
info
,warn
, etc. - stimer
- Creates a timer that logs a starting mesage and a finished message.
- timer
- Creates a timer that does not log a starting message, only a finished one.
- trace
- warn
Structs§
- Logging
Timer - When this struct is dropped, it logs a message stating its name and how long the execution time was. Can be used to time functions or other critical areas.
Enums§
- Level
- An enum representing the available verbosity levels of the logger.
Constants§
Functions§
- init_
stderr_ color_ debug - convenient shortcut that you can call in your
main()
to initialize logging with stderr color output. - obtain_
count - get and increment by 1 the number of occurrence for a specific kind of message. this is not intended to be used separately, but is expected to be called from our macro expansion.