This allows you to specify multiple logging scopes, both in API and the CLI.
e.g for the CLI.
```bash
$ wazero run --hostlogging=crypto --hostlogging=filesystem --mount=.:/:ro cat.wasm
```
e.g. for Go
```go
loggingCtx := context.WithValue(testCtx, experimental.FunctionListenerFactoryKey{},
logging.NewHostLoggingListenerFactory(&log, logging.LogScopeCrypto|logging.LogScopeFilesystem))
```
Signed-off-by: Edoardo Vacchi <evacchi@users.noreply.github.com>
Signed-off-by: Adrian Cole <adrian@tetrate.io>
Co-authored-by: Adrian Cole <adrian@tetrate.io>
913 B
913 B
AssemblyScript example
This example runs a WebAssembly program compiled using AssemblyScript, built
with npm install && npm run build.
AssemblyScript program exports two functions, hello_world which executes
simple math, and goodbye_world, which throws an error that is logged using
AssemblyScript abort built-in function.
This demo configures AssemblyScript imports for errors and trace messages.
$ go run assemblyscript.go 7
hello_world returned: 10
sad sad world at index.ts:7:3
Note: index.ts avoids use of JavaScript functions that use
I/O, such as console.log. If your code uses these, compile your code with
the wasi-shim and configure in wazero using
wasi_snapshot_preview1.Instantiate.