mirror of
https://github.com/fluencelabs/marine-rs-sdk
synced 2025-03-15 14:30:48 +00:00
reexport WASM_LOG_ENV_NAME
This commit is contained in:
parent
c90b685238
commit
b631dab17f
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "fluence"
|
||||
version = "0.2.9" # remember to update html_root_url
|
||||
version = "0.2.10" # remember to update html_root_url
|
||||
description = "Fluence backend SDK for developing backend applications for the Fluence network"
|
||||
documentation = "https://docs.rs/fluence/"
|
||||
repository = "https://github.com/fluencelabs/rust-sdk"
|
||||
|
@ -48,6 +48,8 @@ pub use export_allocator::deallocate;
|
||||
pub use logger::WasmLoggerBuilder;
|
||||
#[cfg(feature = "logger")]
|
||||
pub use logger::TargetMap;
|
||||
#[cfg(feature = "logger")]
|
||||
pub use logger::WASM_LOG_ENV_NAME;
|
||||
|
||||
pub use result::get_result_ptr;
|
||||
pub use result::get_result_size;
|
||||
|
@ -44,6 +44,12 @@
|
||||
|
||||
use log::Level as LogLevel;
|
||||
|
||||
/// By default, logger will be initialized with log level from this environment variable.
|
||||
pub const WASM_LOG_ENV_NAME: &'static str = "WASM_LOG";
|
||||
|
||||
/// If WASM_LOG_ENV isn't set, then this level will be used as the default.
|
||||
const WASM_DEFAULT_LOG_LEVEL: LogLevel = LogLevel::Info;
|
||||
|
||||
pub type TargetMap = std::collections::HashMap<&'static str, i64>;
|
||||
|
||||
/// The Wasm Logger.
|
||||
@ -75,15 +81,10 @@ impl WasmLoggerBuilder {
|
||||
pub fn new() -> Self {
|
||||
use std::str::FromStr;
|
||||
|
||||
const WASM_LOG_ENV_NAME: &'static str = "WASM_LOG";
|
||||
const RUST_DEFAULT_LOG_LEVEL: LogLevel = LogLevel::Info;
|
||||
|
||||
let log_level = match std::env::var(WASM_LOG_ENV_NAME) {
|
||||
Ok(log_level_str) => {
|
||||
LogLevel::from_str(&log_level_str).unwrap_or(RUST_DEFAULT_LOG_LEVEL)
|
||||
}
|
||||
Err(_) => RUST_DEFAULT_LOG_LEVEL,
|
||||
};
|
||||
let log_level = std::env::var(WASM_LOG_ENV_NAME)
|
||||
.map_or(WASM_DEFAULT_LOG_LEVEL, |log_level_str| {
|
||||
LogLevel::from_str(&log_level_str).unwrap_or(WASM_DEFAULT_LOG_LEVEL)
|
||||
});
|
||||
|
||||
Self {
|
||||
log_level,
|
||||
|
@ -55,7 +55,7 @@
|
||||
//! pub fn curl_get(url: String) -> String;
|
||||
//! }
|
||||
//! ```
|
||||
#![doc(html_root_url = "https://docs.rs/fluence/0.2.9")]
|
||||
#![doc(html_root_url = "https://docs.rs/fluence/0.2.10")]
|
||||
#![deny(
|
||||
dead_code,
|
||||
nonstandard_style,
|
||||
|
Loading…
x
Reference in New Issue
Block a user