mirror of
https://github.com/pezkuwichain/wasm-instrument.git
synced 2026-06-16 04:51:03 +00:00
Refactor executables to separate crates
This commit is contained in:
@@ -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"
|
||||
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user