update greeting example

This commit is contained in:
vms 2021-02-05 12:14:42 +03:00
parent 572dce6a76
commit f4634ccd4a
4 changed files with 13 additions and 10 deletions

8
Cargo.lock generated
View File

@ -2431,9 +2431,9 @@ dependencies = [
[[package]] [[package]]
name = "thread_local" name = "thread_local"
version = "1.1.2" version = "1.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8208a331e1cb318dd5bd76951d2b8fc48ca38a69f5f4e4af1b6a9f8c6236915" checksum = "8018d24e04c95ac8790716a5987d0fec4f8b27249ffa0f7d33f1369bdfb88cbd"
dependencies = [ dependencies = [
"once_cell", "once_cell",
] ]
@ -2542,9 +2542,9 @@ checksum = "360dfd1d6d30e05fda32ace2c8c70e9c0a9da713275777f5a4dbb8a1893930c6"
[[package]] [[package]]
name = "tracing" name = "tracing"
version = "0.1.22" version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" checksum = "f7d40a22fd029e33300d8d89a5cc8ffce18bb7c587662f54629e94c9de5487f3"
dependencies = [ dependencies = [
"cfg-if 1.0.0", "cfg-if 1.0.0",
"log", "log",

View File

@ -14,14 +14,16 @@
* limitations under the License. * limitations under the License.
*/ */
use fluence_sdk_main::WASM_LOG_ENV_NAME;
use std::io::Write;
use std::env::var;
const WIT_MODULE_PATH: &str = "wasmer_interface_types_fl"; const WIT_MODULE_PATH: &str = "wasmer_interface_types_fl";
const RUST_LOG_ENV_NAME: &str = "RUST_LOG"; const RUST_LOG_ENV_NAME: &str = "RUST_LOG";
pub(super) fn init_logger() { pub(super) fn init_logger() {
use std::io::Write;
use std::env::var;
use log::LevelFilter::Info; use log::LevelFilter::Info;
use fluence_sdk_main::WASM_LOG_ENV_NAME;
match (var(RUST_LOG_ENV_NAME), var(WASM_LOG_ENV_NAME)) { match (var(RUST_LOG_ENV_NAME), var(WASM_LOG_ENV_NAME)) {
(Ok(_), _) => {} (Ok(_), _) => {}
@ -37,7 +39,8 @@ pub(super) fn init_logger() {
Some(module_path) if module_path.starts_with(WIT_MODULE_PATH) => { Some(module_path) if module_path.starts_with(WIT_MODULE_PATH) => {
writeln!(buf, "[host] {}", record.args()) writeln!(buf, "[host] {}", record.args())
} }
// because of the log_utf8_string implementation, log from a wasm module always has module path // due to the log_utf8_string implementation,
// a log message from a Wasm module always has module path
None => writeln!(buf, "[host] {}", record.args()), None => writeln!(buf, "[host] {}", record.args()),
Some(module_path) => writeln!(buf, "[{}] {}", module_path, record.args()), Some(module_path) => writeln!(buf, "[{}] {}", module_path, record.args()),
} }

View File

@ -16,13 +16,13 @@
mod print_state; mod print_state;
use print_state::print_envs;
use print_state::print_fs_state;
use crate::ReplResult; use crate::ReplResult;
use fluence_app_service::AppService; use fluence_app_service::AppService;
use fluence_app_service::FaaSModuleConfig; use fluence_app_service::FaaSModuleConfig;
use fluence_app_service::TomlAppServiceConfig; use fluence_app_service::TomlAppServiceConfig;
use print_state::print_envs;
use print_state::print_fs_state;
use std::collections::HashMap; use std::collections::HashMap;
use std::fs; use std::fs;