Browse Source

Fix features example

Sam Clements 3 years ago
parent
commit
07f7bf95f3
2 changed files with 12 additions and 8 deletions
  1. 12 0
      examples/features.rs
  2. 0 8
      examples/timestamps.rs

+ 12 - 0
examples/features.rs

@@ -0,0 +1,12 @@
+use simple_logger::SimpleLogger;
+
+fn main() {
+    let mut builder = SimpleLogger::new();
+
+    #[cfg(feature = "chrono")]
+    builder = builder.with_timestamps(true);
+
+    builder.init().unwrap();
+
+    log::warn!("This is an example message.");
+}

+ 0 - 8
examples/timestamps.rs

@@ -1,8 +0,0 @@
-use simple_logger::SimpleLogger;
-
-#[cfg(feature = "chrono")]
-fn main() {
-    SimpleLogger::new().with_timestamps(true).init().unwrap();
-
-    log::warn!("This is an example message.");
-}