redpanda-data / connect

Fancy stream processing made operationally mundane
https://docs.redpanda.com/redpanda-connect/about/
8.13k stars 831 forks source link

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

Open webfrank opened 7 months ago

webfrank commented 7 months ago

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?

mihaitodor commented 7 months ago

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.