pchickey requested wasmtime-core-reviewers for a review on PR #7239.
pchickey requested wasmtime-default-reviewers for a review on PR #7239.
pchickey requested alexcrichton for a review on PR #7239.
pchickey opened PR #7239 from bytecodealliance:pch/cli_tracing
to bytecodealliance:main
:
We use
log
andtracing
messages in many parts of the wasmtime project to provide debug output. This PR installstracing-subscriber
in the wasmtime-clifn main()
. It is configured to read theWASMTIME_LOG
env variable, output to stderr, and use ansi coloring when std::io::stderr().is_terminal().<details>
[phickey@pch-tower:src/wasmtime]% WASMTIME_LOG=wasmtime_wasi=trace cargo run -- --wasm component-model cli_hello_stdout.component.wasm Compiling wasmtime-cli v15.0.0 (/home/phickey/src/wasmtime) Finished dev [unoptimized + debuginfo] target(s) in 1.27s Running `target/debug/wasmtime --wasm component-model cli_hello_stdout.component.wasm` 2023-10-13T20:49:45.513742Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="terminal-stdin" function="get-terminal-stdin"}: wasmtime_wasi::preview2::bindings::wasi::cli::terminal_stdin: call 2023-10-13T20:49:45.513811Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="terminal-stdin" function="get-terminal-stdin"}: wasmtime_wasi::preview2::bindings::wasi::cli::terminal_stdin: return result=Ok(Some(Resource { rep: 3, state: "own (not in table)" })) 2023-10-13T20:49:45.513943Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="terminal-stdout" function="get-terminal-stdout"}: wasmtime_wasi::preview2::bindings::wasi::cli::terminal_stdout: call 2023-10-13T20:49:45.513972Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="terminal-stdout" function="get-terminal-stdout"}: wasmtime_wasi::preview2::bindings::wasi::cli::terminal_stdout: return result=Ok(Some(Resource { rep: 4, state: "own (not in table)" })) 2023-10-13T20:49:45.514052Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="terminal-stderr" function="get-terminal-stderr"}: wasmtime_wasi::preview2::bindings::wasi::cli::terminal_stderr: call 2023-10-13T20:49:45.514081Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="terminal-stderr" function="get-terminal-stderr"}: wasmtime_wasi::preview2::bindings::wasi::cli::terminal_stderr: return result=Ok(Some(Resource { rep: 5, state: "own (not in table)" })) 2023-10-13T20:49:45.514182Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="stdin" function="get-stdin"}: wasmtime_wasi::preview2::bindings::wasi::cli::stdin: call 2023-10-13T20:49:45.514214Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="stdin" function="get-stdin"}: wasmtime_wasi::preview2::bindings::wasi::cli::stdin: return result=Ok(Resource { rep: 6, state: "own (not in table)" }) 2023-10-13T20:49:45.514289Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="stdout" function="get-stdout"}: wasmtime_wasi::preview2::bindings::wasi::cli::stdout: call 2023-10-13T20:49:45.514511Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="stdout" function="get-stdout"}: wasmtime_wasi::preview2::bindings::wasi::cli::stdout: return result=Ok(Resource { rep: 7, state: "own (not in table)" }) 2023-10-13T20:49:45.514595Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="stderr" function="get-stderr"}: wasmtime_wasi::preview2::bindings::wasi::cli::stderr: call 2023-10-13T20:49:45.514635Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="stderr" function="get-stderr"}: wasmtime_wasi::preview2::bindings::wasi::cli::stderr: return result=Ok(Resource { rep: 8, state: "own (not in table)" }) 2023-10-13T20:49:45.514696Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="preopens" function="get-directories"}: wasmtime_wasi::preview2::bindings::wasi::filesystem::preopens: call 2023-10-13T20:49:45.514726Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="preopens" function="get-directories"}: wasmtime_wasi::preview2::bindings::wasi::filesystem::preopens: return result=Ok([]) 2023-10-13T20:49:45.514846Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams: call self_=Resource { rep: 7, state: "borrow" } contents=[104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 10] 2023-10-13T20:49:45.515027Z DEBUG wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::write_stream: worker writing: b"hello, world\n" hello, world 2023-10-13T20:49:45.515316Z DEBUG wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::write_stream: worker marking flush complete 2023-10-13T20:49:45.515371Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams: return result=Ok(()) 2023-10-13T20:49:45.515460Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams: call self_=Resource { rep: 8, state: "borrow" } contents=[104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 10] 2023-10-13T20:49:45.515534Z DEBUG wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::write_stream: worker writing: b"hello, world\n" hello, world 2023-10-13T20:49:45.515655Z DEBUG wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::write_stream: worker marking flush complete 2023-10-13T20:49:45.515701Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams: return result=Ok(())
</details>
pchickey edited PR #7239:
We use
log
andtracing
messages in many parts of the wasmtime project to provide debug output. This PR installstracing-subscriber
in the wasmtime-clifn main()
. It is configured to read theWASMTIME_LOG
env variable, output to stderr, and use ansi coloring when std::io::stderr().is_terminal().<details>
<pre>
[phickey@pch-tower:src/wasmtime]% WASMTIME_LOG=wasmtime_wasi=trace cargo run -- --wasm component-model cli_hello_stdout.component.wasm
Compiling wasmtime-cli v15.0.0 (/home/phickey/src/wasmtime)
Finished dev [unoptimized + debuginfo] target(s) in 1.27s
Runningtarget/debug/wasmtime --wasm component-model cli_hello_stdout.component.wasm
2023-10-13T20:49:45.513742Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="terminal-stdin" function="get-terminal-stdin"}: wasmtime_wasi::preview2::bindings::wasi::cli::terminal_stdin: call
2023-10-13T20:49:45.513811Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="terminal-stdin" function="get-terminal-stdin"}: wasmtime_wasi::preview2::bindings::wasi::cli::terminal_stdin: return result=Ok(Some(Resource { rep: 3, state: "own (not in table)" }))
2023-10-13T20:49:45.513943Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="terminal-stdout" function="get-terminal-stdout"}: wasmtime_wasi::preview2::bindings::wasi::cli::terminal_stdout: call
2023-10-13T20:49:45.513972Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="terminal-stdout" function="get-terminal-stdout"}: wasmtime_wasi::preview2::bindings::wasi::cli::terminal_stdout: return result=Ok(Some(Resource { rep: 4, state: "own (not in table)" }))
2023-10-13T20:49:45.514052Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="terminal-stderr" function="get-terminal-stderr"}: wasmtime_wasi::preview2::bindings::wasi::cli::terminal_stderr: call
2023-10-13T20:49:45.514081Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="terminal-stderr" function="get-terminal-stderr"}: wasmtime_wasi::preview2::bindings::wasi::cli::terminal_stderr: return result=Ok(Some(Resource { rep: 5, state: "own (not in table)" }))
2023-10-13T20:49:45.514182Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="stdin" function="get-stdin"}: wasmtime_wasi::preview2::bindings::wasi::cli::stdin: call
2023-10-13T20:49:45.514214Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="stdin" function="get-stdin"}: wasmtime_wasi::preview2::bindings::wasi::cli::stdin: return result=Ok(Resource { rep: 6, state: "own (not in table)" })
2023-10-13T20:49:45.514289Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="stdout" function="get-stdout"}: wasmtime_wasi::preview2::bindings::wasi::cli::stdout: call
2023-10-13T20:49:45.514511Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="stdout" function="get-stdout"}: wasmtime_wasi::preview2::bindings::wasi::cli::stdout: return result=Ok(Resource { rep: 7, state: "own (not in table)" })
2023-10-13T20:49:45.514595Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="stderr" function="get-stderr"}: wasmtime_wasi::preview2::bindings::wasi::cli::stderr: call
2023-10-13T20:49:45.514635Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="stderr" function="get-stderr"}: wasmtime_wasi::preview2::bindings::wasi::cli::stderr: return result=Ok(Resource { rep: 8, state: "own (not in table)" })
2023-10-13T20:49:45.514696Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="preopens" function="get-directories"}: wasmtime_wasi::preview2::bindings::wasi::filesystem::preopens: call
2023-10-13T20:49:45.514726Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="preopens" function="get-directories"}: wasmtime_wasi::preview2::bindings::wasi::filesystem::preopens: return result=Ok([])
2023-10-13T20:49:45.514846Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams: call self_=Resource { rep: 7, state: "borrow" } contents=[104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 10]
2023-10-13T20:49:45.515027Z DEBUG wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::write_stream: worker writing: b"hello, world\n"
hello, world
2023-10-13T20:49:45.515316Z DEBUG wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::write_stream: worker marking flush complete
2023-10-13T20:49:45.515371Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams: return result=Ok(())
2023-10-13T20:49:45.515460Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams: call self_=Resource { rep: 8, state: "borrow" } contents=[104, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100, 10]
2023-10-13T20:49:45.515534Z DEBUG wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::write_stream: worker writing: b"hello, world\n"
hello, world
2023-10-13T20:49:45.515655Z DEBUG wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::write_stream: worker marking flush complete
2023-10-13T20:49:45.515701Z TRACE wit-bindgen export{module="wasi:cli/run" function="run"}:wit-bindgen import{module="streams" function="[method]output-stream.blocking-write-and-flush"}: wasmtime_wasi::preview2::bindings::sync_io::_internal::wasi::io::streams: return result=Ok(())</pre>
</details>
pchickey updated PR #7239.
elliottt submitted PR review:
Nice!
pchickey merged PR #7239.
Last updated: Dec 23 2024 at 13:07 UTC