From 14b208bbcb27ddf82a0f15c94088eece2b52b4f6 Mon Sep 17 00:00:00 2001 From: "paraxite@naver.com" Date: Fri, 21 Feb 2020 15:45:24 +0900 Subject: [PATCH] enabled optional logging * added description about the env variables to README.md * set version to v1.4.5 [ci-build] --- Cargo.lock | 22 +++++++++---------- Cargo.toml | 2 +- README.md | 5 +++++ .../mac/soundsense-rs.app/Contents/Info.plist | 4 ++-- src/main.rs | 8 ++++--- src/sound.rs | 1 - 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cf92a10..42c8060 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -327,9 +327,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.66" +version = "0.2.67" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d515b1f41455adea1313a4a2ac8a8a477634fbae63cc6100e3aebb207ce61558" +checksum = "eb147597cdf94ed43ab7a9038716637d2d1bf2bc571da995d0028dec06bd3018" [[package]] name = "libloading" @@ -352,9 +352,9 @@ dependencies = [ [[package]] name = "mach" -version = "0.2.3" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86dd2487cdfea56def77b88438a2c915fb45113c5319bfe7e14306ca4cd0b0e1" +checksum = "b823e83b2affd8f40a9ee8c29dbc56404c1e34cd2710921f2801e2cf29527afa" dependencies = [ "libc", ] @@ -382,9 +382,9 @@ dependencies = [ [[package]] name = "minimp3" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9943faa16a9729ff85d28857d9e4a4e8ac4f47f82a738184cd28d32a50c2bc38" +checksum = "dce0cff6a0bfd3f8b6b2350819bbddd63bc65cc45e53888bdd0ff49dde16d2d5" dependencies = [ "minimp3-sys", "slice-deque", @@ -392,9 +392,9 @@ dependencies = [ [[package]] name = "minimp3-sys" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c109ae05c00ad6e3a53fab101e2f234545bdd010f0fffd399355efaf70817817" +checksum = "e21c73734c69dc95696c9ed8926a2b393171d98b3f5f5935686a26a487ab9b90" dependencies = [ "cc", ] @@ -599,9 +599,9 @@ checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "slice-deque" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffddf594f5f597f63533d897427a570dbaa9feabaaa06595b74b71b7014507d7" +checksum = "31ef6ee280cdefba6d2d0b4b78a84a1c1a3f3a4cec98c2d4231c8bc225de0f25" dependencies = [ "libc", "mach", @@ -616,7 +616,7 @@ checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc" [[package]] name = "soundsense-rs" -version = "1.4.4" +version = "1.4.5" dependencies = [ "dirs", "env_logger", diff --git a/Cargo.toml b/Cargo.toml index 8310987..959ec12 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "soundsense-rs" -version = "1.4.4" +version = "1.4.5" build = "build.rs" authors = ["prixt "] edition = "2018" diff --git a/README.md b/README.md index a9d6b8d..a651911 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,11 @@ This pattern will make soundsense-rs ignore any cancallations related to water. The regex pattern uses the [regex crate](https://docs.rs/regex/) syntax. +## Logging +You can set the following environment variables to set the logging parameters. (Disabled on Windows releases) +* __SOUNDSENSE_RS_LOG__: set the level of logging. _(trace, debug, info, warn, error; default: warn)_ +* __SOUNDSENSE_RS_LOG_STYLE__: st the level of the log style. _(always, never; default: always)_ + ## Dependencies Linux: libasound2, libgtk-3, libwebkit2gtk-4.0 diff --git a/dist/mac/soundsense-rs.app/Contents/Info.plist b/dist/mac/soundsense-rs.app/Contents/Info.plist index b5b5e5a..ee53d02 100644 --- a/dist/mac/soundsense-rs.app/Contents/Info.plist +++ b/dist/mac/soundsense-rs.app/Contents/Info.plist @@ -23,10 +23,10 @@ CFBundleDocumentTypes CFBundleShortVersionString - 1.4.4 + 1.4.5 CFBundleVersion - 1.4.4 + 1.4.5 LSMinimumSystemVersion 10.0.0 diff --git a/src/main.rs b/src/main.rs index c6a7500..9d35a91 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,15 +5,17 @@ use std::env; use std::sync::mpsc::channel; use std::path::PathBuf; use regex::Regex; -#[macro_use] -extern crate log; +#[macro_use] extern crate log; mod sound; mod ui; mod message; fn main() { - env_logger::init(); + let env = env_logger::Env::default() + .filter_or("SOUNDSENSE_RS_LOG", "warn") + .write_style_or("SOUNDSENSE_RS_LOG_STYLE", "always"); + env_logger::init_from_env(env); info!("Starting SoundSense-RS"); let args: Vec = env::args().collect(); let mut opts = getopts::Options::new(); diff --git a/src/sound.rs b/src/sound.rs index 6c61821..ff27e04 100644 --- a/src/sound.rs +++ b/src/sound.rs @@ -80,7 +80,6 @@ pub struct SoundEntry { } pub fn run(sound_rx: Receiver, ui_tx: Sender) { - loop { info!("(Re)Starting sound thread."); let mut manager : Option = None;