add release_log_level feature to simulate release logs in debug mode.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
3140f101c1
commit
aef77bd338
2 changed files with 11 additions and 5 deletions
|
@ -377,6 +377,9 @@ hot_reload = ["dep:hot-lib-reloader"]
|
|||
|
||||
hardened_malloc = ["hardened_malloc-rs"]
|
||||
|
||||
# developer feature useful only in debug builds.
|
||||
release_log_level = []
|
||||
|
||||
# client/server interopability hacks
|
||||
#
|
||||
## element has various non-spec compliant behaviour
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
/// Log event at given level in debug-mode (when debug-assertions are enabled).
|
||||
/// In release mode it becomes DEBUG level, and possibly subject to elision.
|
||||
/// In release-mode it becomes DEBUG level, and possibly subject to elision.
|
||||
///
|
||||
/// Release-mode can be simulated in debug-mode builds by enabling the feature
|
||||
/// 'release_log_level'.
|
||||
#[macro_export]
|
||||
macro_rules! debug_event {
|
||||
( $level:expr, $($x:tt)+ ) => {
|
||||
if cfg!(debug_assertions) {
|
||||
if cfg!(debug_assertions) && cfg!(not(feature = "release_log_level")) {
|
||||
tracing::event!( $level, $($x)+ );
|
||||
} else {
|
||||
tracing::debug!( $($x)+ );
|
||||
|
@ -12,7 +15,7 @@ macro_rules! debug_event {
|
|||
}
|
||||
|
||||
/// Log message at the ERROR level in debug-mode (when debug-assertions are
|
||||
/// enabled). In release mode it becomes DEBUG level, and possibly subject to
|
||||
/// enabled). In release-mode it becomes DEBUG level, and possibly subject to
|
||||
/// elision.
|
||||
#[macro_export]
|
||||
macro_rules! debug_error {
|
||||
|
@ -22,7 +25,7 @@ macro_rules! debug_error {
|
|||
}
|
||||
|
||||
/// Log message at the WARN level in debug-mode (when debug-assertions are
|
||||
/// enabled). In release mode it becomes DEBUG level, and possibly subject to
|
||||
/// enabled). In release-mode it becomes DEBUG level, and possibly subject to
|
||||
/// elision.
|
||||
#[macro_export]
|
||||
macro_rules! debug_warn {
|
||||
|
@ -32,7 +35,7 @@ macro_rules! debug_warn {
|
|||
}
|
||||
|
||||
/// Log message at the INFO level in debug-mode (when debug-assertions are
|
||||
/// enabled). In release mode it becomes DEBUG level, and possibly subject to
|
||||
/// enabled). In release-mode it becomes DEBUG level, and possibly subject to
|
||||
/// elision.
|
||||
#[macro_export]
|
||||
macro_rules! debug_info {
|
||||
|
|
Loading…
Add table
Reference in a new issue