Use logger

[?]
Oct 27, 2018, 2:40 PM
YGC7ZD7NZPCDVETCIBKKTLJPEFLBMQYBIJRDAOHIF762JDMZLUTAC

Dependencies

  • [2] AVBHYHOA Stop xmpp thread by shudown
  • [3] 6DSWVNSY Launch single-thread executor on own thread
  • [4] FVVPKFTL Initial commit
  • [5] HKSQO7JZ Enable hyper http server and configuration

Change contents

  • edit in src/main.rs at line 1
    [3.21][3.0:23]()
    #![deny(missing_docs)]
  • edit in src/main.rs at line 2
    [3.24][3.24:48](),[3.48][3.21:22](),[3.21][3.21:22]()
    //! XMPP client service
  • edit in src/main.rs at line 4
    [3.61]
    [3.61]
    #[macro_use]
    extern crate log;
    extern crate env_logger;
  • edit in src/main.rs at line 17
    [3.77][3.77:113]()
    use tokio::runtime::current_thread;
  • edit in src/main.rs at line 22
    [2.280][2.280:314](),[2.314][3.337:338](),[3.337][3.337:338]()
    mod xmpp;
    use xmpp::xmpp_process;
  • edit in src/main.rs at line 27
    [3.30]
    [3.436]
    env_logger::init();
  • replacement in src/main.rs at line 49
    [3.1093][3.1093:1118]()
    .map_err(|_| ())
    [3.1093]
    [3.1118]
    .map_err(|e| error!("Cann't get CTRL+C signal: {}", e.0))
  • replacement in src/main.rs at line 55
    [3.1293][3.1293:1350](),[3.1350][3.114:176]()
    .map_err(|e| eprintln!("server error: {}", e));
    let mut rt = Runtime::new().expect("Cann't start tokio");
    [3.1293]
    [3.176]
    .map_err(|e| error!("server error: {}", e));
  • replacement in src/main.rs at line 57
    [3.177][3.177:205](),[3.205][2.315:396](),[2.396][3.281:379](),[3.281][3.281:379](),[3.379][2.397:461](),[2.461][3.440:680](),[3.440][3.440:680]()
    rt.spawn(http_server);
    let xmpp_join = std::thread::spawn(move || -> Result<(), tokio::io::Error> {
    // Launch single-threaded runtime
    let mut ctrt = current_thread::Runtime::new()?;
    ctrt.block_on(xmpp_process(ctrl_c.clone().map(|_| ())))
    });
    println!("Server started");
    rt.shutdown_on_idle().wait().expect("Shutdown error");
    println!("Server stopper");
    xmpp_join
    .join()
    .expect("Join xmpp thread")
    .expect("Result xmpp thread");
    [3.177]
    [3.61]
    hyper::rt::run(http_server);
  • edit in Cargo.toml at line 16
    [3.2214]
    [3.2214]
    log = "0.4"
    env_logger = "0.5"
  • edit in Cargo.lock at line 1
    [3.2228]
    [3.2228]
    name = "aho-corasick"
    version = "0.6.8"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    dependencies = [
    "memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
    ]
    [[package]]
  • edit in Cargo.lock at line 269
    [3.10800]
    [3.10800]
    ]
    [[package]]
    name = "env_logger"
    version = "0.5.13"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    dependencies = [
    "atty 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
    "humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
    "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
    "regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
    "termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
  • edit in Cargo.lock at line 427
    [3.15456]
    [3.15456]
    [[package]]
    name = "humantime"
    version = "1.1.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    dependencies = [
    "quick-error 1.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
    ]
  • edit in Cargo.lock at line 923
    [3.32410]
    [3.32410]
    ]
    [[package]]
    name = "regex"
    version = "1.0.5"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    dependencies = [
    "aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)",
    "memchr 2.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
    "regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)",
    "thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
    "utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  • edit in Cargo.lock at line 938
    [3.32425]
    [3.32425]
    name = "regex-syntax"
    version = "0.6.2"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    dependencies = [
    "ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
    ]
    [[package]]
  • edit in Cargo.lock at line 1046
    [3.35355]
    [3.35355]
    "env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)",
  • edit in Cargo.lock at line 1048
    [3.35429]
    [3.35429]
    "log 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)",
  • edit in Cargo.lock at line 1259
    [3.43169]
    [3.43169]
    ]
    [[package]]
    name = "termcolor"
    version = "1.0.4"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    dependencies = [
    "wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
  • edit in Cargo.lock at line 1285
    [3.43748]
    [3.43748]
    ]
    [[package]]
    name = "thread_local"
    version = "0.3.6"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    dependencies = [
    "lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
  • edit in Cargo.lock at line 1574
    [3.56530]
    [3.56530]
    name = "ucd-util"
    version = "0.1.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    [[package]]
  • edit in Cargo.lock at line 1630
    [3.57895]
    [3.57895]
    name = "utf8-ranges"
    version = "1.0.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    [[package]]
  • edit in Cargo.lock at line 1691
    [3.59416]
    [3.59416]
    source = "registry+https://github.com/rust-lang/crates.io-index"
    [[package]]
    name = "winapi-util"
    version = "0.1.1"
  • edit in Cargo.lock at line 1697
    [3.59481]
    [3.59481]
    dependencies = [
    "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
    ]
  • edit in Cargo.lock at line 1705
    [3.59615]
    [3.59615]
    [[package]]
    name = "wincolor"
    version = "1.0.1"
    source = "registry+https://github.com/rust-lang/crates.io-index"
    dependencies = [
    "winapi 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
    "winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
    ]
  • edit in Cargo.lock at line 1769
    [3.61610]
    [3.61610]
    "checksum aho-corasick 0.6.8 (registry+https://github.com/rust-lang/crates.io-index)" = "68f56c7353e5a9547cbd76ed90f7bb5ffc3ba09d4ea9bd1d8c06c8b1142eeb5a"
  • edit in Cargo.lock at line 1802
    [3.66492]
    [3.66492]
    "checksum env_logger 0.5.13 (registry+https://github.com/rust-lang/crates.io-index)" = "15b0a4d2e39f8420210be8b27eeda28029729e2fd4291019455016c348240c38"
  • edit in Cargo.lock at line 1821
    [3.69251]
    [3.69251]
    "checksum humantime 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0484fda3e7007f2a4a0d9c3a703ca38c71c54c55602ce4660c419fd32e188c9e"
  • edit in Cargo.lock at line 1879
    [3.77904]
    [3.77904]
    "checksum regex 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)" = "2069749032ea3ec200ca51e4a31df41759190a88edca0d2d86ee8bedf7073341"
    "checksum regex-syntax 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)" = "747ba3b235651f6e2f67dfa8bcdcd073ddb7c243cb21c442fc12395dfcac212d"
  • edit in Cargo.lock at line 1917
    [3.83403]
    [3.83403]
    "checksum termcolor 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)" = "4096add70612622289f2fdcdbd5086dc81c1e2675e6ae58d6c4f62a16c6d7f2f"
  • edit in Cargo.lock at line 1920
    [3.83705]
    [3.83705]
    "checksum thread_local 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)" = "c6b53e329000edc2b34dbe8545fd20e55a333362d0a321909685a19bd28c3f1b"
  • edit in Cargo.lock at line 1943
    [3.87083]
    [3.87083]
    "checksum ucd-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd2be2d6639d0f8fe6cdda291ad456e23629558d466e2789d2c3e9892bda285d"
  • edit in Cargo.lock at line 1952
    [3.88314]
    [3.88314]
    "checksum utf8-ranges 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "fd70f467df6810094968e2fce0ee1bd0e87157aceb026a8c083bcf5e25b9efe4"
  • edit in Cargo.lock at line 1963
    [3.89837]
    [3.89837]
    "checksum winapi-util 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "afc5508759c5bf4285e61feb862b6083c8480aec864fa17a81fdec6f69b461ab"
  • edit in Cargo.lock at line 1965
    [3.90008]
    [3.90008]
    "checksum wincolor 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "561ed901ae465d6185fa7864d63fbd5720d0ef718366c9a4dc83cf6170d7e9ba"