logging: extracts utilities to read parameters and results from memory (#938)
This changes the listener signature to accept context and calling module, so that all possible parameters and results can be logged. This also changes the logging listener to make parameters visible when logging results. This infrastructure supports some helpful use cases, such as logging WASI result parameters, such as the prestat path, which is only knowable after the function has been called. The context parameter supposed reading results of gojs functions, which are stored host-side in a go context object. Future pull requests will complete this as well backfill unit tests. This is raised independently mainly to keep the PR size down of the upcoming filesystem logger. Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
package proxy
|
||||
|
||||
import (
|
||||
"io"
|
||||
|
||||
"github.com/tetratelabs/wazero"
|
||||
"github.com/tetratelabs/wazero/api"
|
||||
"github.com/tetratelabs/wazero/experimental"
|
||||
@@ -16,7 +14,7 @@ const proxyModuleName = "internal/testing/proxy/proxy.go"
|
||||
|
||||
// NewLoggingListenerFactory is like logging.NewHostLoggingListenerFactory,
|
||||
// except it skips logging proxying functions from NewModuleBinary.
|
||||
func NewLoggingListenerFactory(writer io.Writer) experimental.FunctionListenerFactory {
|
||||
func NewLoggingListenerFactory(writer logging.Writer) experimental.FunctionListenerFactory {
|
||||
return &loggingListenerFactory{logging.NewHostLoggingListenerFactory(writer)}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user