runwasi icon indicating copy to clipboard operation
runwasi copied to clipboard

Add support for structured logging

Open jsturtevant opened this issue 2 years ago • 1 comments

If https://github.com/containerd/rust-extensions/pull/212 goes in and we adopt it we can clean up our logging story so we have more metadata for logs.

For instance, write now our logs:

INFO] waiting for instance: df03285ac14ced6475f603924a4d2da31314bfb0f5056322d50b22a0f90e2a92
[INFO] calling start function
[INFO] redirect stdio
[INFO] Create a Store
[INFO] loading module from file "/wasi-demo-app.wasm"
[INFO] Creating `WasiEnv`...: args ["/wasi-demo-app.wasm"], envs: Vars { .. }
[INFO] Creating `WasiEnv`...: args ["/wasi-demo-app.wasm"], envs: Vars { .. }
[INFO] Running "_start"
[[INFO] Creating `WasiEnv`...: args ["/wasi-demo-app.wasm"], envs: Vars { .. }

This is challenging, What which instance is Creating WasiEnv...: args for? It gets harder with more replicates more things happening.

With strucutred logging we could have something like the following so we can distinguish between multiple instances running

time="2023-10-06T21:49:05.767259938Z" level=info instance="aslkdfasdfhasgh09234kl23j4l2k3j42lkj34" msg="Create a Store"
time="2023-10-06T21:49:05.767259938Z" level=info instance="df03285ac14ced6475f603924a4d2da31314bfb0f5056322d50b22a0f90e2a92" msg="Creating `WasiEnv`"
time="2023-10-06T21:49:05.767259938Z" level=info instance="aslkdfasdfhasgh09234kl23j4l2k3j42lkj34" msg="Creating `WasiEnv`"

jsturtevant avatar Oct 06 '23 22:10 jsturtevant

Is this issue resolved? @jsturtevant

Mossaka avatar Apr 18 '24 23:04 Mossaka

Not fully, the code is there to handle this but a wrapper/macro needs to be added to runwasi to add fields like instance="aslkdfasdfhasgh09234kl23j4l2k3j42lkj34"

jsturtevant avatar Sep 27 '24 14:09 jsturtevant