Merge pull request #1166 from matthiasbeyer/log-0-4-0

Dependency update: log 0.4.0
This commit is contained in:
Matthias Beyer 2018-01-18 15:40:50 +01:00 committed by GitHub
commit 3735fbac2f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
43 changed files with 90 additions and 85 deletions

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
url = "1.2"
toml = "0.4"
toml-query = "0.6"

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
url = "1.2"
toml = "0.4"
toml-query = "0.6"

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
url = "1.5"
toml = "0.4"
toml-query = "0.6"

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
libimagrt = { version = "0.6.0", path = "../../../lib/core/libimagrt" }
libimagerror = { version = "0.6.0", path = "../../../lib/core/libimagerror" }

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
libimagrt = { version = "0.6.0", path = "../../../lib/core/libimagrt" }
libimagerror = { version = "0.6.0", path = "../../../lib/core/libimagerror" }

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
toml = "0.4"
error-chain = "0.11"

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
toml = "0.4"
libimagstore = { version = "0.6.0", path = "../../../lib/core/libimagstore" }
@ -32,7 +32,7 @@ libimagutil = { version = "0.6.0", path = "../../../lib/etc/libimagutil" }
[dev-dependencies]
toml-query = "0.6"
env_logger = "0.4"
env_logger = "0.5"
[dev-dependencies.libimagutil]
version = "0.6.0"

View file

@ -273,8 +273,7 @@ mod tests {
}
fn setup_logging() {
use env_logger;
let _ = env_logger::init().unwrap_or(());
let _ = ::env_logger::try_init();
}
#[test]

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
toml = "0.4"
toml-query = "0.6"
handlebars = "0.29.0"

View file

@ -22,7 +22,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
walkdir = "1"
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
toml = "0.4"
toml-query = "0.6"

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
toml = "0.4"
toml-query = "0.6"

View file

@ -15,7 +15,7 @@ homepage = "http://imag-pim.org"
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
toml = "0.4"
toml-query = "0.6"
handlebars = "0.29"

View file

@ -22,7 +22,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
chrono = "0.4"
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
toml = "0.4"
toml-query = "0.6"

View file

@ -17,7 +17,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
libimagrt = { version = "0.6.0", path = "../../../lib/core/libimagrt" }
libimagerror = { version = "0.6.0", path = "../../../lib/core/libimagerror" }

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
itertools = "0.7"
libimagrt = { version = "0.6.0", path = "../../../lib/core/libimagrt" }

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
chrono = "0.4"
filters = "0.2"
itertools = "0.7"

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
toml = "0.4"
toml-query = "0.6"
is-match = "0.1"

View file

@ -20,5 +20,5 @@ is-it-maintained-open-issues = { repository = "matthiasbeyer/imag" }
maintenance = { status = "actively-developed" }
[dependencies]
log = "0.3"
log = "0.4.0"
ansi_term = "0.10"

View file

@ -21,9 +21,8 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
env_logger = "0.4"
env_logger = "0.5"
toml = "0.4"
log = "0.3"
xdg-basedir = "1.0"
itertools = "0.7"
ansi_term = "0.10"
@ -37,6 +36,11 @@ libimagerror = { version = "0.6.0", path = "../../../lib/core/libimagerror" }
libimagutil = { version = "0.6.0", path = "../../../lib/etc/libimagutil" }
libimaginteraction = { version = "0.6.0", path = "../../../lib/etc/libimaginteraction" }
[dependencies.log]
version = "0.4.0-rc.1"
default-features = false
features = ["std"]
[features]
default = []

View file

@ -30,7 +30,7 @@ use error::ResultExt;
use runtime::Runtime;
use clap::ArgMatches;
use log::{Log, LogLevel, LogRecord, LogMetadata};
use log::{Log, Level, Record, Metadata};
use toml::Value;
use toml_query::read::TomlValueReadExt;
use toml_query::read::TomlValueReadTypeExt;
@ -52,7 +52,7 @@ impl Default for LogDestination {
struct ModuleSettings {
enabled: bool,
level: Option<LogLevel>,
level: Option<Level>,
#[allow(unused)]
destinations: Option<Vec<LogDestination>>,
@ -60,7 +60,7 @@ struct ModuleSettings {
/// Logger implementation for `log` crate.
pub struct ImagLogger {
global_loglevel : LogLevel,
global_loglevel : Level,
#[allow(unused)]
global_destinations : Vec<LogDestination>,
@ -114,7 +114,7 @@ impl ImagLogger {
})
}
pub fn global_loglevel(&self) -> LogLevel {
pub fn global_loglevel(&self) -> Level {
self.global_loglevel
}
@ -122,12 +122,16 @@ impl ImagLogger {
impl Log for ImagLogger {
fn enabled(&self, metadata: &LogMetadata) -> bool {
fn enabled(&self, metadata: &Metadata) -> bool {
metadata.level() <= self.global_loglevel
}
fn log(&self, record: &LogRecord) {
if record.location().module_path().starts_with("handlebars") {
fn flush(&self) {
// nothing?
}
fn log(&self, record: &Record) {
if record.module_path().map(|m| m.starts_with("handlebars")).unwrap_or(false) {
// This is a ugly, yet necessary hack. When logging, we use handlebars for templating.
// But as the handlebars library itselfs logs via a normal logging macro ("debug!()"),
// we have a recursion in our chain.
@ -143,9 +147,9 @@ impl Log for ImagLogger {
{
data.insert("level", format!("{}", record.level()));
data.insert("module_path", String::from(record.location().module_path()));
data.insert("file", String::from(record.location().file()));
data.insert("line", format!("{}", record.location().line()));
data.insert("module_path", String::from(record.module_path().unwrap_or("<modulepath unknown>")));
data.insert("file", String::from(record.file().unwrap_or("<file unknown>")));
data.insert("line", format!("{}", record.line().unwrap_or(0)));
data.insert("target", String::from(record.target()));
data.insert("message", format!("{}", record.args()));
}
@ -209,27 +213,26 @@ impl Log for ImagLogger {
}
}
fn match_log_level_str(s: &str) -> Result<LogLevel> {
fn match_log_level_str(s: &str) -> Result<Level> {
match s {
"trace" => Ok(LogLevel::Trace),
"debug" => Ok(LogLevel::Debug),
"info" => Ok(LogLevel::Info),
"warn" => Ok(LogLevel::Warn),
"error" => Ok(LogLevel::Error),
"trace" => Ok(Level::Trace),
"debug" => Ok(Level::Debug),
"info" => Ok(Level::Info),
"warn" => Ok(Level::Warn),
"error" => Ok(Level::Error),
_ => return Err(RE::from_kind(EK::InvalidLogLevelSpec)),
}
}
fn aggregate_global_loglevel(matches: &ArgMatches, config: Option<&Value>)
-> Result<LogLevel>
fn aggregate_global_loglevel(matches: &ArgMatches, config: Option<&Value>) -> Result<Level>
{
fn get_arg_loglevel(matches: &ArgMatches) -> Result<Option<LogLevel>> {
fn get_arg_loglevel(matches: &ArgMatches) -> Result<Option<Level>> {
if matches.is_present(Runtime::arg_debugging_name()) {
return Ok(Some(LogLevel::Debug))
return Ok(Some(Level::Debug))
}
if matches.is_present(Runtime::arg_verbosity_name()) {
return Ok(Some(LogLevel::Info))
return Ok(Some(Level::Info))
}
match matches.value_of(Runtime::arg_verbosity_name()) {
@ -253,7 +256,7 @@ fn aggregate_global_loglevel(matches: &ArgMatches, config: Option<&Value>)
Ok(cfg_loglevel)
} else {
get_arg_loglevel(matches).map(|o| o.unwrap_or(LogLevel::Info))
get_arg_loglevel(matches).map(|o| o.unwrap_or(Level::Info))
}
}

View file

@ -26,7 +26,6 @@ pub use clap::App;
use toml::Value;
use clap::{Arg, ArgMatches};
use log;
use configuration::{fetch_config, override_config, InternalConfiguration};
use error::RuntimeError;
@ -335,22 +334,25 @@ impl<'a> Runtime<'a> {
/// Initialize the internal logger
fn init_logger(matches: &ArgMatches, config: Option<&Value>) {
use log::set_max_level;
use log::set_boxed_logger;
use std::env::var as env_var;
use env_logger;
if env_var("IMAG_LOG_ENV").is_ok() {
env_logger::init().unwrap();
let _ = env_logger::try_init();
} else {
log::set_logger(|max_log_lvl| {
let logger = ImagLogger::new(matches, config)
.map_err_trace()
.unwrap_or_else(|_| exit(1));
max_log_lvl.set(logger.global_loglevel().to_log_level_filter());
debug!("Init logger with {}", logger.global_loglevel());
Box::new(logger)
})
.map_err(|e| panic!("Could not setup logger: {:?}", e))
.ok();
let logger = ImagLogger::new(matches, config)
.map_err_trace()
.unwrap_or_else(|_| exit(1));
set_max_level(logger.global_loglevel().to_level_filter());
debug!("Init logger with {}", logger.global_loglevel());
set_boxed_logger(Box::new(logger))
.map_err(|e| panic!("Could not setup logger: {:?}", e))
.ok();
}
}

View file

@ -22,7 +22,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
glob = "0.2.11"
lazy_static = "0.2"
log = "0.3"
log = "0.4.0"
regex = "0.2"
semver = "0.8"
toml = "0.4"
@ -39,7 +39,7 @@ libimagutil = { version = "0.6.0", path = "../../../lib/etc/libimagutil" }
[dev-dependencies]
tempdir = "0.3"
env_logger = "0.4"
env_logger = "0.5"
[features]
default = []

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
chrono = "0.4"
log = "0.3"
log = "0.4.0"
toml = "0.4"
toml-query = "0.6"
itertools = "0.7"

View file

@ -20,7 +20,7 @@ is-it-maintained-open-issues = { repository = "matthiasbeyer/imag" }
maintenance = { status = "actively-developed" }
[dependencies]
log = "0.3"
log = "0.4.0"
email = "0.0.17"
filters = "0.2"
error-chain = "0.11"

View file

@ -20,7 +20,7 @@ is-it-maintained-open-issues = { repository = "matthiasbeyer/imag" }
maintenance = { status = "actively-developed" }
[dependencies]
log = "0.3"
log = "0.4.0"
toml = "0.4"
toml-query = "0.6"
error-chain = "0.11"

View file

@ -24,7 +24,7 @@ task-hookrs = "0.4"
uuid = "0.5"
toml = "0.4"
toml-query = "0.6"
log = "0.3"
log = "0.4.0"
serde_json = "1"
error-chain = "0.11"

View file

@ -20,7 +20,7 @@ is-it-maintained-open-issues = { repository = "matthiasbeyer/imag" }
maintenance = { status = "actively-developed" }
[dependencies]
log = "0.3"
log = "0.4.0"
toml = "0.4"
toml-query = "0.6"
is-match = "0.1"
@ -30,5 +30,5 @@ libimagerror = { version = "0.6.0", path = "../../../lib/core/libimagerror" }
libimagstore = { version = "0.6.0", path = "../../../lib/core/libimagstore" }
[dev-dependencies]
env_logger = "0.4"
env_logger = "0.5"

View file

@ -175,7 +175,7 @@ mod tests {
#[test]
fn test_creating_category_creates_store_entry_with_header_field_set() {
let _ = env_logger::init();
let _ = env_logger::try_init();
let category_name = "examplecategory";
let store = get_store();
let res = store.create_category(category_name);

View file

@ -23,7 +23,7 @@ maintenance = { status = "actively-developed" }
clap = ">=2.17"
filters = "0.2"
itertools = "0.7"
log = "0.3"
log = "0.4.0"
regex = "0.2"
semver = "0.8"
toml = "0.4"

View file

@ -26,5 +26,5 @@ libimagstore = { version = "0.6.0", path = "../../../lib/core/libimagstore" }
libimagerror = { version = "0.6.0", path = "../../../lib/core/libimagerror" }
[dev-dependencies]
env_logger = "0.4"
env_logger = "0.5"

View file

@ -108,8 +108,7 @@ mod tests {
use entry::*;
fn setup_logging() {
use env_logger;
let _ = env_logger::init().unwrap_or(());
let _ = ::env_logger::try_init;
}
fn get_store() -> Store {

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
itertools = "0.7"
log = "0.3"
log = "0.4.0"
toml = "0.4"
url = "1.5"
rust-crypto = "0.2"
@ -34,5 +34,5 @@ libimagerror = { version = "0.6.0", path = "../../../lib/core/libimagerror" }
libimagutil = { version = "0.6.0", path = "../../../lib/etc/libimagutil" }
[dev-dependencies]
env_logger = "0.4"
env_logger = "0.5"

View file

@ -411,7 +411,7 @@ mod tests {
fn setup_logging() {
use env_logger;
let _ = env_logger::init().unwrap_or(());
let _ = env_logger::try_init();
}
pub fn get_store() -> Store {

View file

@ -767,8 +767,7 @@ mod test {
use super::Link;
fn setup_logging() {
use env_logger;
let _ = env_logger::init().unwrap_or(());
let _ = ::env_logger::try_init();
}
pub fn get_store() -> Store {

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
prettytable-rs = "0.6.*"
error-chain = "0.11"

View file

@ -20,11 +20,11 @@ is-it-maintained-open-issues = { repository = "matthiasbeyer/imag" }
maintenance = { status = "actively-developed" }
[dependencies]
log = "0.3"
log = "0.4.0"
hoedown = "6.0.0"
url = "1.5"
error-chain = "0.11"
env_logger = "0.4"
env_logger = "0.5"
libimagstore = { version = "0.6.0", path = "../../../lib/core/libimagstore" }
libimagerror = { version = "0.6.0", path = "../../../lib/core/libimagerror" }

View file

@ -218,8 +218,7 @@ mod tests {
use libimagentrylink::internal::InternalLinker;
fn setup_logging() {
use env_logger;
let _ = env_logger::init().unwrap_or(());
let _ = ::env_logger::try_init();
}
pub fn get_store() -> Store {

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
itertools = "0.7"
log = "0.3"
log = "0.4.0"
rust-crypto = "0.2"
toml = "0.4"
toml-query = "0.6"

View file

@ -21,7 +21,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
log = "0.3"
log = "0.4.0"
regex = "0.2"
toml = "0.4"
itertools = "0.7"

View file

@ -20,7 +20,7 @@ is-it-maintained-open-issues = { repository = "matthiasbeyer/imag" }
maintenance = { status = "actively-developed" }
[dependencies]
log = "0.3"
log = "0.4.0"
toml = "0.4"
error-chain = "0.11"

View file

@ -24,7 +24,7 @@ ansi_term = "0.10"
clap = ">=2.17"
interactor = "0.1"
lazy_static = "0.2"
log = "0.3"
log = "0.4.0"
regex = "0.2"
toml = "0.4"
error-chain = "0.11"

View file

@ -22,7 +22,7 @@ maintenance = { status = "actively-developed" }
[dependencies]
clap = ">=2.17"
lazy_static = "0.2"
log = "0.3"
log = "0.4.0"
chrono = "0.4"
regex = "0.2"

View file

@ -29,7 +29,7 @@ maintenance = { status = "actively-developed" }
url = "1.5"
boolinator = "2.4.0"
lazy_static = "0.2"
log = "0.3"
log = "0.4.0"
regex = "0.2"
tempfile = "2.1"