mirror of
https://github.com/fluencelabs/marine.git
synced 2024-12-12 06:45:32 +00:00
update examples (#47)
This commit is contained in:
parent
de3d51ef8f
commit
0b8f757dcd
126
Cargo.lock
generated
126
Cargo.lock
generated
@ -53,7 +53,7 @@ dependencies = [
|
||||
name = "arguments-passing-test"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"safe-transmute",
|
||||
]
|
||||
|
||||
@ -67,7 +67,7 @@ checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544"
|
||||
name = "arrays-passing-test"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"safe-transmute",
|
||||
]
|
||||
|
||||
@ -184,7 +184,7 @@ checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38"
|
||||
name = "call_parameters"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -413,10 +413,10 @@ dependencies = [
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "curl"
|
||||
name = "curl_adapter"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"log",
|
||||
]
|
||||
|
||||
@ -621,7 +621,7 @@ name = "facade"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"log",
|
||||
]
|
||||
|
||||
@ -678,7 +678,7 @@ version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8165090ee52453a5c14bd42212bfc6516860c4aaa2315fd568c0198b46b52901"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fluence 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -690,7 +690,7 @@ name = "fce-wit-generator"
|
||||
version = "0.1.11"
|
||||
dependencies = [
|
||||
"fce-wit-parser",
|
||||
"fluence-sdk-wit 0.2.9",
|
||||
"fluence-sdk-wit 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"once_cell",
|
||||
"serde",
|
||||
"serde_json",
|
||||
@ -733,30 +733,21 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "fluence"
|
||||
version = "0.2.9"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1099731bb64286758969fb8dd6f903d1e4a7398d8e63bdec1be6387576f4d8ab"
|
||||
checksum = "573e8c4ab833d4a69ce87cf1638256465940ebd062c22b3e12a22beb4527c3bb"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro 0.2.9",
|
||||
"fluence-sdk-main 0.2.9",
|
||||
"fluence-sdk-macro 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fluence-sdk-main 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence"
|
||||
version = "0.2.9"
|
||||
source = "git+https://github.com/fluencelabs/rust-sdk?branch=logger_env#be250f9c1f75309b1d96d78dbfd380a8fae7fd3f"
|
||||
version = "0.2.11"
|
||||
source = "git+https://github.com/fluencelabs/rust-sdk#3aab224c9778f6eb8f9750779982f33976bee630"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro 0.2.10 (git+https://github.com/fluencelabs/rust-sdk?branch=logger_env)",
|
||||
"fluence-sdk-main 0.2.10 (git+https://github.com/fluencelabs/rust-sdk?branch=logger_env)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence"
|
||||
version = "0.2.9"
|
||||
source = "git+https://github.com/fluencelabs/rust-sdk#ebf3e63aef8d4aafda41180eeb299c4138628174"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro 0.2.10 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence-sdk-main 0.2.10 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence-sdk-macro 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence-sdk-main 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -781,7 +772,7 @@ dependencies = [
|
||||
"env_logger 0.7.1",
|
||||
"fce",
|
||||
"fce-utils",
|
||||
"fluence-sdk-main 0.2.9",
|
||||
"fluence-sdk-main 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools",
|
||||
"log",
|
||||
"once_cell",
|
||||
@ -799,65 +790,47 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-macro"
|
||||
version = "0.2.9"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ca5ffdf0ccf817b1e4e8438f6da7e8fa024679c706a69bde7aa8cad8b43e90ee"
|
||||
checksum = "348397aaa898e0bcd1554e71add917b400542684f0d416ef9cc8693da7daba48"
|
||||
dependencies = [
|
||||
"fluence-sdk-wit 0.2.9",
|
||||
"fluence-sdk-wit 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-macro"
|
||||
version = "0.2.10"
|
||||
source = "git+https://github.com/fluencelabs/rust-sdk?branch=logger_env#be250f9c1f75309b1d96d78dbfd380a8fae7fd3f"
|
||||
version = "0.2.11"
|
||||
source = "git+https://github.com/fluencelabs/rust-sdk#3aab224c9778f6eb8f9750779982f33976bee630"
|
||||
dependencies = [
|
||||
"fluence-sdk-wit 0.2.10 (git+https://github.com/fluencelabs/rust-sdk?branch=logger_env)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-macro"
|
||||
version = "0.2.10"
|
||||
source = "git+https://github.com/fluencelabs/rust-sdk#ebf3e63aef8d4aafda41180eeb299c4138628174"
|
||||
dependencies = [
|
||||
"fluence-sdk-wit 0.2.10 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence-sdk-wit 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-main"
|
||||
version = "0.2.9"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d4f81c3778c18d372fec6d96049f25e29fc4ff7ba4ab65ef4c2285f971e8670a"
|
||||
checksum = "fd4aa0aee4ae98fc74ef7e49800f6b0f5e7395e7b4f8a5758090e74d3d936e7d"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro 0.2.9",
|
||||
"fluence-sdk-macro 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-main"
|
||||
version = "0.2.10"
|
||||
source = "git+https://github.com/fluencelabs/rust-sdk?branch=logger_env#be250f9c1f75309b1d96d78dbfd380a8fae7fd3f"
|
||||
version = "0.2.11"
|
||||
source = "git+https://github.com/fluencelabs/rust-sdk#3aab224c9778f6eb8f9750779982f33976bee630"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro 0.2.10 (git+https://github.com/fluencelabs/rust-sdk?branch=logger_env)",
|
||||
"log",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-main"
|
||||
version = "0.2.10"
|
||||
source = "git+https://github.com/fluencelabs/rust-sdk#ebf3e63aef8d4aafda41180eeb299c4138628174"
|
||||
dependencies = [
|
||||
"fluence-sdk-macro 0.2.10 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence-sdk-macro 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"log",
|
||||
"serde",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-wit"
|
||||
version = "0.2.9"
|
||||
version = "0.2.11"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f9c68c4d07e821e1be23b01c278acdae4e825d03c46879f453426ea3160b3e25"
|
||||
checksum = "ef3b20f7cd8ac6ee02a0ee7abd62f9339a236520430c0c702802149dc221555a"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -869,21 +842,8 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-wit"
|
||||
version = "0.2.10"
|
||||
source = "git+https://github.com/fluencelabs/rust-sdk?branch=logger_env#be250f9c1f75309b1d96d78dbfd380a8fae7fd3f"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"syn",
|
||||
"uuid",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "fluence-sdk-wit"
|
||||
version = "0.2.10"
|
||||
source = "git+https://github.com/fluencelabs/rust-sdk#ebf3e63aef8d4aafda41180eeb299c4138628174"
|
||||
version = "0.2.11"
|
||||
source = "git+https://github.com/fluencelabs/rust-sdk#3aab224c9778f6eb8f9750779982f33976bee630"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
@ -932,7 +892,9 @@ dependencies = [
|
||||
"clap",
|
||||
"env_logger 0.7.1",
|
||||
"fluence-app-service",
|
||||
"fluence-sdk-main 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"itertools",
|
||||
"log",
|
||||
"rustop",
|
||||
"rustyline",
|
||||
"rustyline-derive",
|
||||
@ -1245,7 +1207,7 @@ dependencies = [
|
||||
name = "inner-records-test"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"safe-transmute",
|
||||
]
|
||||
|
||||
@ -1284,7 +1246,7 @@ dependencies = [
|
||||
name = "ipfs-effector"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"log",
|
||||
]
|
||||
|
||||
@ -1292,7 +1254,7 @@ dependencies = [
|
||||
name = "ipfs-pure"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"log",
|
||||
]
|
||||
|
||||
@ -1371,7 +1333,7 @@ checksum = "1482821306169ec4d07f6aca392a4681f66c75c9918aa49641a2595db64053cb"
|
||||
name = "local_storage"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk?branch=logger_env)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"log",
|
||||
]
|
||||
|
||||
@ -1907,7 +1869,7 @@ dependencies = [
|
||||
name = "record-effector"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"test-record",
|
||||
]
|
||||
|
||||
@ -1915,7 +1877,7 @@ dependencies = [
|
||||
name = "record-pure"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"test-record",
|
||||
]
|
||||
|
||||
@ -2342,7 +2304,7 @@ dependencies = [
|
||||
name = "test-record"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2822,7 +2784,7 @@ dependencies = [
|
||||
name = "wasm-greeting"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fluence 0.2.9 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
"fluence 0.2.11 (git+https://github.com/fluencelabs/rust-sdk)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -2830,7 +2792,7 @@ name = "wasm-sqlite-test"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"fce-sqlite-connector",
|
||||
"fluence 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fluence 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -14,7 +14,7 @@ members = [
|
||||
"examples/records/pure",
|
||||
"examples/records/test-record",
|
||||
"examples/sqlite",
|
||||
"examples/url-downloader/curl",
|
||||
"examples/url-downloader/curl_adapter",
|
||||
"examples/url-downloader/facade",
|
||||
"examples/url-downloader/local_storage",
|
||||
"fluence-app-service",
|
||||
|
@ -10,7 +10,7 @@ modules_dir = "artifacts/"
|
||||
mapped_dirs = { "sites" = "./sites" }
|
||||
|
||||
[[module]]
|
||||
name = "curl"
|
||||
name = "curl_adapter"
|
||||
logger_enabled = true
|
||||
|
||||
[module.mounted_binaries]
|
||||
|
Binary file not shown.
BIN
examples/url-downloader/artifacts/curl_adapter.wasm
Executable file
BIN
examples/url-downloader/artifacts/curl_adapter.wasm
Executable file
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,18 +1,18 @@
|
||||
#!/bin/sh
|
||||
|
||||
# This script builds all subprojects and puts all created Wasm modules in one dir
|
||||
cd facade
|
||||
cd local_storage
|
||||
cargo update
|
||||
fce build --release
|
||||
cd ../curl
|
||||
cd ../curl_adapter
|
||||
cargo update
|
||||
fce build --release
|
||||
cd ../local_storage
|
||||
cd ../facade
|
||||
cargo update
|
||||
fce build --release
|
||||
|
||||
cd ..
|
||||
rm -f artifacts/*
|
||||
cp ../../target/wasm32-wasi/release/curl.wasm artifacts/
|
||||
cp ../../target/wasm32-wasi/release/local_storage.wasm artifacts/
|
||||
cp ../../target/wasm32-wasi/release/curl_adapter.wasm artifacts/
|
||||
cp ../../target/wasm32-wasi/release/facade.wasm artifacts/
|
||||
|
@ -1,12 +1,12 @@
|
||||
[package]
|
||||
name = "curl"
|
||||
name = "curl_adapter"
|
||||
version = "0.1.0"
|
||||
authors = ["Fluence Labs"]
|
||||
edition = "2018"
|
||||
|
||||
[[bin]]
|
||||
path = "src/main.rs"
|
||||
name = "curl"
|
||||
name = "curl_adapter"
|
||||
|
||||
[dependencies]
|
||||
fluence = { git = "https://github.com/fluencelabs/rust-sdk", features = ["logger"] }
|
@ -33,7 +33,7 @@ fn get_n_save(url: String, file_name: String) -> String {
|
||||
|
||||
/// Importing `curl` module
|
||||
#[fce]
|
||||
#[link(wasm_import_module = "curl")]
|
||||
#[link(wasm_import_module = "curl_adapter")]
|
||||
extern "C" {
|
||||
pub fn download(url: String) -> String;
|
||||
}
|
||||
|
@ -9,5 +9,5 @@ name = "local_storage"
|
||||
path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
fluence = { git = "https://github.com/fluencelabs/rust-sdk", features = ["logger"], branch = "logger_env" }
|
||||
fluence = { git = "https://github.com/fluencelabs/rust-sdk", features = ["logger"]}
|
||||
log = "0.4.8"
|
||||
|
@ -29,7 +29,7 @@ pub fn main() {
|
||||
/// You can read or write files from the file system if there is permission to use directories described in `Config.toml`.
|
||||
#[fce]
|
||||
pub fn put(name: String, file_content: Vec<u8>) -> String {
|
||||
log::info!("put called with {:?}", file_content);
|
||||
log::info!("put called with file name {}", name);
|
||||
|
||||
let rpc_tmp_filepath = format!("{}{}", SITES_DIR, name);
|
||||
|
||||
@ -43,7 +43,7 @@ pub fn put(name: String, file_content: Vec<u8>) -> String {
|
||||
|
||||
#[fce]
|
||||
pub fn get(file_name: String) -> Vec<u8> {
|
||||
log::debug!("get called with file name: {}", file_name);
|
||||
log::info!("get called with file name: {}", file_name);
|
||||
|
||||
let tmp_filepath = format!("{}{}", SITES_DIR, file_name);
|
||||
|
||||
|
@ -9,7 +9,7 @@ edition = "2018"
|
||||
[dependencies]
|
||||
fce = { path = "../engine", version = "0.1.12" }
|
||||
fce-utils = { path = "../crates/utils", version = "0.1.0" }
|
||||
fluence-sdk-main = "=0.2.9"
|
||||
fluence-sdk-main = { version = "=0.2.11", features = ["logger"] }
|
||||
|
||||
wasmer-runtime = { package = "wasmer-runtime-fl", version = "0.17.0" }
|
||||
# dynamicfunc-fat-closures allows using state inside DynamicFunc
|
||||
|
@ -111,7 +111,7 @@ impl FluenceFaaS {
|
||||
module_name.clone(),
|
||||
Some(module_config),
|
||||
call_parameters.clone(),
|
||||
&logger_filter
|
||||
&logger_filter,
|
||||
)?;
|
||||
fce.load_module(module_name, &module_bytes, fce_module_config)?;
|
||||
}
|
||||
@ -256,8 +256,16 @@ impl FluenceFaaS {
|
||||
let config = config.map(|c| c.try_into()).transpose()?;
|
||||
let name = name.into();
|
||||
|
||||
let fce_module_config =
|
||||
crate::misc::make_fce_config(name.clone(), config, self.call_parameters.clone())?;
|
||||
// LoggerFilter can be initialized with an empty string
|
||||
let wasm_log_env = std::env::var(WASM_LOG_ENV_NAME).unwrap_or_default();
|
||||
let logger_filter = LoggerFilter::from_env_string(&wasm_log_env);
|
||||
|
||||
let fce_module_config = crate::misc::make_fce_config(
|
||||
name.clone(),
|
||||
config,
|
||||
self.call_parameters.clone(),
|
||||
&logger_filter,
|
||||
)?;
|
||||
self.fce
|
||||
.load_module(name, &wasm_bytes, fce_module_config)
|
||||
.map_err(Into::into)
|
||||
|
@ -17,7 +17,7 @@
|
||||
mod logger_filter;
|
||||
mod log_utf8_string_impl;
|
||||
|
||||
pub const WASM_LOG_ENV_NAME: &str = "WASM_LOG";
|
||||
pub use fluence_sdk_main::WASM_LOG_ENV_NAME;
|
||||
|
||||
pub(crate) use logger_filter::LoggerFilter;
|
||||
pub(crate) use log_utf8_string_impl::log_utf8_string_closure;
|
||||
|
@ -85,7 +85,7 @@ pub(crate) fn make_fce_config(
|
||||
module_name: String,
|
||||
faas_module_config: Option<FaaSModuleConfig>,
|
||||
call_parameters: Rc<RefCell<fluence_sdk_main::CallParameters>>,
|
||||
logger_filter: &LoggerFilter<'_>
|
||||
logger_filter: &LoggerFilter<'_>,
|
||||
) -> Result<FCEModuleConfig> {
|
||||
let mut fce_module_config = FCEModuleConfig::default();
|
||||
|
||||
@ -130,7 +130,7 @@ pub(crate) fn make_fce_config(
|
||||
let log_level = level_filter.to_level();
|
||||
let log_level_str = match log_level {
|
||||
Some(log_level) => log_level.to_string(),
|
||||
None => String::from("off")
|
||||
None => String::from("off"),
|
||||
};
|
||||
|
||||
// overwrite possibly installed log variable in config
|
||||
@ -207,4 +207,3 @@ pub(crate) fn load_modules_from_fs(
|
||||
|
||||
Ok(loaded)
|
||||
}
|
||||
|
||||
|
@ -13,6 +13,7 @@ path = "src/main.rs"
|
||||
|
||||
[dependencies]
|
||||
fluence-app-service = { path = "../../fluence-app-service", version = "0.1.13", features = ["raw-module-api"] }
|
||||
fluence-sdk-main = { version = "=0.2.11", features = ["logger"] }
|
||||
|
||||
anyhow = "1.0.31"
|
||||
clap = "2.33.1"
|
||||
@ -20,6 +21,7 @@ serde_json = "1.0.57"
|
||||
wasmer-wasi = { package = "wasmer-wasi-fl", version = "0.17.1"}
|
||||
|
||||
env_logger = "0.7.1"
|
||||
log = "0.4.11"
|
||||
rustyline = { version = "6.1.2", features = ["with-fuzzy"] }
|
||||
rustyline-derive = "0.3.1"
|
||||
rustop = "1.1.0"
|
||||
|
@ -120,10 +120,23 @@ fn main() -> Result<()> {
|
||||
|
||||
fn init_logger() {
|
||||
use std::io::Write;
|
||||
use std::env::var;
|
||||
use log::LevelFilter::Info;
|
||||
use fluence_sdk_main::WASM_LOG_ENV_NAME;
|
||||
|
||||
const WIT_MODULE_PATH: &str = "wasmer_interface_types_fl";
|
||||
const RUST_LOG_ENV_NAME: &str = "RUST_LOG";
|
||||
|
||||
match (var(RUST_LOG_ENV_NAME), var(WASM_LOG_ENV_NAME)) {
|
||||
(Ok(_), _) => {}
|
||||
(Err(_), Ok(wasm_log_env)) if !wasm_log_env.starts_with("off") => {
|
||||
std::env::set_var(RUST_LOG_ENV_NAME, "trace")
|
||||
}
|
||||
_ => return,
|
||||
};
|
||||
|
||||
env_logger::builder()
|
||||
.format(|buf, record| {
|
||||
const WIT_MODULE_PATH: &'static str = "wasmer_interface_types_fl";
|
||||
match record.module_path() {
|
||||
Some(module_path) if module_path.starts_with(WIT_MODULE_PATH) => {
|
||||
writeln!(buf, "[host] {}", record.args())
|
||||
@ -133,6 +146,13 @@ fn init_logger() {
|
||||
Some(module_path) => writeln!(buf, "[{}] {}", module_path, record.args()),
|
||||
}
|
||||
})
|
||||
// set a default level Info for Wasmer components
|
||||
.filter(Some("cranelift_codegen"), Info)
|
||||
.filter(Some("wasmer_wasi"), Info)
|
||||
.filter(Some(WIT_MODULE_PATH), Info)
|
||||
// the same for rustyline and fce
|
||||
.filter(Some("rustyline"), Info)
|
||||
.filter(Some("fce"), Info)
|
||||
.init();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user