Auto merge of #561 - pornel:logging, r=fitzgen

Run without logging feature

The build was broken without default features
This commit is contained in:
bors-servo 2017-03-06 09:36:06 -08:00 committed by GitHub
commit 17275f8700
2 changed files with 10 additions and 3 deletions

View File

@ -1,12 +1,12 @@
macro_rules! log {
(target: $target:expr, $lvl:expr, $($arg)+) => {
(target: $target:expr, $lvl:expr, $($arg:tt)+) => {
let _ = $target;
let _ = log!($lvl, $($arg)+);
};
($lvl:expr, $($arg:tt)+) => {
($lvl:expr, $($arg:tt)+) => {{
let _ = $lvl;
let _ = format_args!($($arg)+);
};
}};
}
macro_rules! error {
(target: $target:expr, $($arg:tt)*) => { log!($target, $($arg)*); };

View File

@ -1,6 +1,8 @@
extern crate bindgen;
#[cfg(feature="logging")]
extern crate env_logger;
#[macro_use]
#[cfg(feature="logging")]
extern crate log;
extern crate clang_sys;
extern crate clap;
@ -10,10 +12,15 @@ use bindgen::clang_version;
use std::env;
use std::panic;
#[macro_use]
#[cfg(not(feature="logging"))]
mod log_stubs;
mod options;
use options::builder_from_flags;
pub fn main() {
#[cfg(feature="logging")]
log::set_logger(|max_log_level| {
use env_logger::Logger;
let env_logger = Logger::new();