Use log instead of println in log_utf8_string (#4)

This commit is contained in:
folex 2020-06-17 13:42:11 +03:00 committed by GitHub
parent a85ac4ff14
commit e2cf6089df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 2 deletions

1
Cargo.lock generated
View File

@ -395,6 +395,7 @@ version = "0.1.0"
dependencies = [ dependencies = [
"cmd_lib", "cmd_lib",
"fce", "fce",
"log",
"serde", "serde",
"serde_derive", "serde_derive",
"serde_json", "serde_json",

View File

@ -17,6 +17,7 @@ serde = { version = "1.0.111", features = ["derive"] }
serde_json = "1.0.53" serde_json = "1.0.53"
serde_derive = "1.0.111" serde_derive = "1.0.111"
cmd_lib = "0.7.8" cmd_lib = "0.7.8"
log = "0.4.8"
[patch.'https://github.com/fluencelabs/wasmer'] [patch.'https://github.com/fluencelabs/wasmer']
wasmer-wasi = { path = "lib/wasi" } wasmer-wasi = { path = "lib/wasi" }

View File

@ -32,8 +32,8 @@ pub(super) fn log_utf8_string(ctx: &mut Ctx, offset: i32, size: i32) {
let wasm_ptr = WasmPtr::<u8, Array>::new(offset as _); let wasm_ptr = WasmPtr::<u8, Array>::new(offset as _);
match wasm_ptr.get_utf8_string(ctx.memory(0), size as _) { match wasm_ptr.get_utf8_string(ctx.memory(0), size as _) {
Some(msg) => print!("{}", msg), Some(msg) => log::info!("{}", msg),
None => println!("ipfs node logger: incorrect UTF8 string's been supplied to logger"), None => log::warn!("ipfs node logger: incorrect UTF8 string's been supplied to logger"),
} }
} }