benthosdev / benthos

Fancy stream processing made operationally mundane

Home Page:https://www.benthos.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[QUERY] How to access Benthos log system from WASM?

webfrank opened this issue · comments

Hi,
I've written a simple WASM module and I'm using it within benthos pipeline.
Now I would like to log some information, fmt.Print does not work. How can I access benthos logger?

Hey @webfrank 👋 I think that won't work because here the code would have to look something like r.InstantiateWithConfig(ctx, p.wasmBinary, wazero.NewModuleConfig().WithStdout(os.Stdout)) and there might be more changes required, dunno. Currently, Benthos just registers 4 functions which can be used to read / alter the message as it gets processed by the wasm module: v0_msg_set_bytes, v0_msg_as_bytes, v0_msg_set_meta, v0_msg_get_meta.