Browse Source

Merge pull request #335 from tstenner/env_logger

Update env_logger
Sasha Hilton 5 years ago
parent
commit
4e3576ba7c
3 changed files with 204 additions and 140 deletions
  1. 197 132
      Cargo.lock
  2. 1 1
      Cargo.toml
  3. 6 7
      src/main.rs

File diff suppressed because it is too large
+ 197 - 132
Cargo.lock


+ 1 - 1
Cargo.toml

@@ -34,7 +34,7 @@ path = "protocol"
 
 [dependencies]
 base64 = "0.5.0"
-env_logger = "0.4.0"
+env_logger = "0.6.1"
 futures = "0.1.8"
 getopts = "0.2.14"
 hyper = "0.11.2"

+ 6 - 7
src/main.rs

@@ -14,7 +14,6 @@ extern crate sha1;
 extern crate hex;
 
 use sha1::{Sha1, Digest};
-use env_logger::LogBuilder;
 use futures::sync::mpsc::UnboundedReceiver;
 use futures::{Async, Future, Poll, Stream};
 use std::env;
@@ -53,11 +52,11 @@ fn usage(program: &str, opts: &getopts::Options) -> String {
 }
 
 fn setup_logging(verbose: bool) {
-    let mut builder = LogBuilder::new();
+    let mut builder = env_logger::Builder::new();
     match env::var("RUST_LOG") {
         Ok(config) => {
-            builder.parse(&config);
-            builder.init().unwrap();
+            builder.parse_filters(&config);
+            builder.init();
 
             if verbose {
                 warn!("`--verbose` flag overidden by `RUST_LOG` environment variable");
@@ -65,11 +64,11 @@ fn setup_logging(verbose: bool) {
         }
         Err(_) => {
             if verbose {
-                builder.parse("mdns=info,librespot=trace");
+                builder.parse_filters("mdns=info,librespot=trace");
             } else {
-                builder.parse("mdns=info,librespot=info");
+                builder.parse_filters("mdns=info,librespot=info");
             }
-            builder.init().unwrap();
+            builder.init();
         }
     }
 }

Some files were not shown because too many files changed in this diff