浏览代码

Add a timestamp option using a static UTC offset

Closes https://github.com/borntyping/rust-simple_logger/issues/50
Sam Clements 3 年之前
父节点
当前提交
63519f5d55
共有 1 个文件被更改,包括 12 次插入0 次删除
  1. 12 0
      examples/timestamps_utc_offset.rs

+ 12 - 0
examples/timestamps_utc_offset.rs

@@ -0,0 +1,12 @@
+use simple_logger::SimpleLogger;
+use time::UtcOffset;
+
+fn main() {
+    SimpleLogger::new()
+        .with_utc_offset(UtcOffset::from_hms(14, 0, 0).unwrap())
+        .init()
+        .unwrap();
+
+    log::warn!("This is an example message using a static UTC offset.");
+    log::info!("Daylight savings or other timezone changes will not be respected.");
+}