Refactor executables to separate crates

This commit is contained in:
Wei Tang
2018-05-15 08:05:00 +08:00
parent fd8311983b
commit bb47c22618
16 changed files with 156 additions and 63 deletions
+16
View File
@@ -0,0 +1,16 @@
[package]
name = "pwasm-utils-logger"
version = "0.1.5"
authors = ["Nikolay Volf <nikvolf@gmail.com>", "Sergey Pepyakin <s.pepyakin@gmail.com>"]
license = "MIT/Apache-2.0"
readme = "README.md"
description = "Collection of command-line utilities and corresponding Rust api for producing pwasm-compatible executables"
keywords = ["wasm", "webassembly", "pwasm"]
[lib]
name = "logger"
[dependencies]
log = "0.4"
env_logger = "0.5"
lazy_static = "1.0"
+27
View File
@@ -0,0 +1,27 @@
#[macro_use] extern crate log;
#[macro_use] extern crate lazy_static;
extern crate env_logger;
use std::env;
use log::LevelFilter;
use env_logger::Builder;
lazy_static! {
static ref LOG_DUMMY: bool = {
let mut builder = Builder::new();
builder.filter(None, LevelFilter::Info);
if let Ok(log) = env::var("RUST_LOG") {
builder.parse(&log);
}
builder.init();
trace!("logger initialized");
true
};
}
/// Intialize log with default settings
pub fn init_log() {
let _ = *LOG_DUMMY;
}