Skip to main content

Module lv

Module lv 

Source
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 --color flag
LogLevel
An enum representing the available verbosity levels of the logger.
Lv
Level of a message/print event.
Print
Print level settable with -v and -q flags
Prompt
Prompt level set with --yes, --interactive, and --non-interactive flags

Constants§

D
Debug
E
Error
H
Hint
I
Info
P
Print
T
Trace
W
Warn

Functions§

color_enabled
Get if color printing is enabled Only works when cu::cli is being used.
disable_print_timeprint
Disable printing the time took to run the command
disable_trace_hintprint
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