extism / go-pdk

Extism Plug-in Development Kit (PDK) for Go
https://pkg.go.dev/github.com/extism/go-pdk
BSD 3-Clause "New" or "Revised" License
60 stars 11 forks source link

Remove Log.Trace as it is not exposed on the Extism CLI #37

Closed hilaryRope closed 4 months ago

hilaryRope commented 4 months ago

This issue is made of two parts:

//export log_stuff
func logStuff() int32 {
    pdk.Log(pdk.LogInfo, "An info log!")
    pdk.Log(pdk.LogDebug, "A debug log!")
    pdk.Log(pdk.LogWarn, "A warn log!")
    pdk.Log(pdk.LogError, "An error log!")
    pdk.Log(pdk.LogTrace, "A trace log!")
    return 0
}

func main() {}

Compile it onto .wasm:

tinygo build -o plugin.wasm -target wasi main.go

and finally:

extism call plugin.wasm log_stuff --wasi --log-level=trace

2024/07/12 23:48:44 No runtime detected
2024/07/12 23:48:44 Calling function : log_stuff
2024/07/12 23:48:44 An info log!
2024/07/12 23:48:44 A debug log!
2024/07/12 23:48:44 A warn log!
2024/07/12 23:48:44 An error log!
hilaryRope commented 4 months ago

Happy to pick this up and resolve it. Long term solution should be to update every SDK and PDK to support trace. There will be a separate ticket for it

hilaryRope commented 4 months ago

I will pick this up :)

zshipko commented 4 months ago

Thanks! Let us know if you get stuck on anything