about summary refs log tree commit diff
path: root/src/liblog/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/liblog/lib.rs')
-rw-r--r--src/liblog/lib.rs21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/liblog/lib.rs b/src/liblog/lib.rs
index 6d2afa2a643..3ff7ee390f1 100644
--- a/src/liblog/lib.rs
+++ b/src/liblog/lib.rs
@@ -12,9 +12,24 @@
 
 Utilities for program-wide and customizable logging
 
-This module is used by the compiler when emitting output for the logging family
-of macros. The methods of this module shouldn't necessarily be used directly,
-but rather through the logging macros defined.
+## Example
+
+```
+#[feature(phase)];
+#[phase(syntax, link)] extern crate log;
+
+fn main() {
+    debug!("this is a debug {}", "message");
+    error!("this is printed by default");
+
+    if log_enabled!(log::INFO) {
+        let x = 3 * 4; // expensive computation
+        info!("the answer was: {}", x);
+    }
+}
+```
+
+## Logging Macros
 
 There are five macros that the logging subsystem uses: