logging: adds memory scope (#1076)
This allows you to specify the memory scope amongst existing logging scopes, both in API and the CLI.
e.g for the CLI.
```bash
$ wazero run --hostlogging=memory,filesystem --mount=.:/:ro cat.wasm
```
e.g. for Go
```go
loggingCtx := context.WithValue(testCtx, experimental.FunctionListenerFactoryKey{},
logging.NewHostLoggingListenerFactory(&log, logging.LogScopeMemory|logging.LogScopeFilesystem))
```
This is helpful for emscripten and gojs which have memory reset
callbacks. This will be much more interesting once #1075 is implemented.
Signed-off-by: Adrian Cole <adrian@tetrate.io>
This commit is contained in:
@@ -41,6 +41,7 @@ const (
|
||||
LogScopeClock LogScopes = 1 << iota
|
||||
LogScopeExit
|
||||
LogScopeFilesystem
|
||||
LogScopeMemory
|
||||
LogScopePoll
|
||||
LogScopeRandom
|
||||
LogScopeAll = LogScopes(0xffffffffffffffff)
|
||||
@@ -54,6 +55,8 @@ func scopeName(s LogScopes) string {
|
||||
return "exit"
|
||||
case LogScopeFilesystem:
|
||||
return "filesystem"
|
||||
case LogScopeMemory:
|
||||
return "memory"
|
||||
case LogScopePoll:
|
||||
return "poll"
|
||||
case LogScopeRandom:
|
||||
|
||||
Reference in New Issue
Block a user