Expand description
§Logging
Does not require any feature flag
The logging macros (debug, info, trace, warn, error) are
re-exported from the log crate and are
used as cu::debug!, cu::info!, etc. This means your log statements
are integrated into the log infrastructure when you use cu in a library.
Additionally, the cu::fmtand! and
cu::panicand! macros allow you
to log a message in additional to format!/panic!.
When the cli feature is enabled, you also get log integration
with CLI flags and other terminal-printing features.
See Command Line Interface
cu::lv shorthands should be used within this library (for example
cu::lv::D for debug). You can also call .into() to convert it
to log::Level. Additionally cu::lv::LogLevel is a re-export of log::Level.
Macros§
- debug
- Logs a message at the debug level.
- error
- Logs a message at the error level.
- info
- Logs a message at the info level.
- trace
- Logs a message at the trace level.
- warn
- Logs a message at the warn level.
Structs§
- LogRecord
- The “payload” of a log message.
Enums§
- Color
- Color Level settable with
--colorflag - LogLevel
- An enum representing the available verbosity levels of the logger.
- Lv
- Level of a message/print event.
- Print level settable with
-vand-qflags - Prompt
- Prompt level set with
--yes,--interactive, and--non-interactiveflags
Constants§
Functions§
- color_
enabled - Get if color printing is enabled Only works when cu::cli is being used.
- disable_
print_ time print - Disable printing the time took to run the command
- disable_
trace_ hint print - Disable printing the trace hint line if the CLI entry point returns an error
- is_
print_ time_ enabled - Check if the “finished in TIME” line will be printed on exit. Only works when cu::cli is being used
- is_
trace_ hint_ enabled - Check if the “use -vv to display backtrace” will be printed on error. Only works when cu::cli is being used