Add cfg to preclude log elision without requiring debug_assertions.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -200,7 +200,8 @@ Various debug commands can be found in `!admin debug`.
|
|||||||
Tuwunel builds without debug or trace log levels at compile time by default
|
Tuwunel builds without debug or trace log levels at compile time by default
|
||||||
for substantial performance gains in CPU usage and improved compile times. If
|
for substantial performance gains in CPU usage and improved compile times. If
|
||||||
you need to access debug/trace log levels, you will need to build without the
|
you need to access debug/trace log levels, you will need to build without the
|
||||||
`release_max_log_level` feature or use our provided static debug binaries.
|
`release_max_log_level` feature or use our provided release-logging binaries
|
||||||
|
and images.
|
||||||
|
|
||||||
#### Changing log level dynamically
|
#### Changing log level dynamically
|
||||||
|
|
||||||
|
|||||||
@@ -114,6 +114,12 @@ pub fn rttype_name<T: ?Sized>(_: &T) -> &'static str { type_name::<T>() }
|
|||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn type_name<T: ?Sized>() -> &'static str { std::any::type_name::<T>() }
|
pub fn type_name<T: ?Sized>() -> &'static str { std::any::type_name::<T>() }
|
||||||
|
|
||||||
|
/// Returns true if debug logging is enabled. In this mode extra logging calls
|
||||||
|
/// are made at all log levels, not just DEBUG and TRACE. These logs are demoted
|
||||||
|
/// to DEBUG level when this function returns false; as a consequence they will
|
||||||
|
/// be elided by `release_max_log_level` when featured.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
#[inline]
|
#[inline]
|
||||||
pub const fn logging() -> bool { cfg!(debug_assertions) }
|
pub const fn logging() -> bool {
|
||||||
|
cfg!(debug_assertions) || cfg!(tuwunel_debug) || cfg!(not(feature = "release_max_log_level"))
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user