From 64106c4d3d4ddba8c7bc2af75376e6d3d3d75601 Mon Sep 17 00:00:00 2001 From: Date: Mon, 29 Jun 2015 20:16:15 +0000 Subject: Update documentation --- log/macro.log_enabled!.html | 130 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 log/macro.log_enabled!.html (limited to 'log/macro.log_enabled!.html') diff --git a/log/macro.log_enabled!.html b/log/macro.log_enabled!.html new file mode 100644 index 0000000..2507d8e --- /dev/null +++ b/log/macro.log_enabled!.html @@ -0,0 +1,130 @@ + + + + + + + + + + log::log_enabled! - Rust + + + + + + + + + + + + + + + +
+

log::log_enabled! + + [] + + [src]

+
+macro_rules! log_enabled {
+    (target: $target:expr, $lvl:expr) => ({
+        let lvl = $lvl;
+        !cfg!(log_level = "off") &&
+            (lvl <= $crate::LogLevel::Error || !cfg!(log_level = "error")) &&
+            (lvl <= $crate::LogLevel::Warn || !cfg!(log_level = "warn")) &&
+            (lvl <= $crate::LogLevel::Debug || !cfg!(log_level = "debug")) &&
+            (lvl <= $crate::LogLevel::Info || !cfg!(log_level = "info")) &&
+            lvl <= $crate::max_log_level() &&
+            $crate::__enabled(lvl, $target)
+    });
+    ($lvl:expr) => (log_enabled!(target: module_path!(), $lvl))
+}
+
+

Determines if a message logged at the specified level in that module will +be logged.

+ +

This can be used to avoid expensive computation of log message arguments if +the message would be ignored anyway.

+ +

Examples

+use log::LogLevel::Debug;
+
+if log_enabled!(Debug) {
+    debug!("expensive debug data: {}", expensive_call());
+}
+
+
+ + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3