logging

package
v1.0.0-pre.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 31, 2022 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package logging includes utilities used to log function calls. This is in an independent package to avoid dependency cycles.

Index

Constants

View Source
const (
	ValueTypeI32                 = api.ValueTypeI32
	ValueTypeI64                 = api.ValueTypeI64
	ValueTypeF32                 = api.ValueTypeF32
	ValueTypeF64                 = api.ValueTypeF64
	ValueTypeV128      ValueType = 0x7b // same as wasm.ValueTypeV128
	ValueTypeFuncref   ValueType = 0x70 // same as wasm.ValueTypeFuncref
	ValueTypeExternref           = api.ValueTypeExternref

	// ValueTypeMemI32 is a non-standard type which writes ValueTypeI32 from the memory offset.
	ValueTypeMemI32 = 0xfd
	// ValueTypeMemH64 is a non-standard type which writes 64-bits fixed-width hex from the memory offset.
	ValueTypeMemH64 = 0xfe
	// ValueTypeString is a non-standard type describing an offset/len pair of a string.
	ValueTypeString = 0xff
)

Variables

This section is empty.

Functions

func ValueLoggers

func ValueLoggers(fnd api.FunctionDefinition) (paramLoggers []ParamLogger, resultLoggers []ResultLogger)

func WriteOOM

func WriteOOM(w Writer, offset uint32, byteCount uint32)

func WriteStringOrOOM

func WriteStringOrOOM(mem api.Memory, w Writer, offset, byteCount uint32)

Types

type LoggerKey

type LoggerKey struct{}

LoggerKey is a context.Context Value key with a FunctionLogger value.

type ParamLogger

type ParamLogger func(ctx context.Context, mod api.Module, w Writer, params []uint64)

func NewParamLogger

func NewParamLogger(idx uint32, name string, t ValueType) ParamLogger

type ParamSampler

type ParamSampler func(ctx context.Context, mod api.Module, params []uint64) bool

type ResultLogger

type ResultLogger func(ctx context.Context, mod api.Module, w Writer, params, results []uint64)

func NewResultLogger

func NewResultLogger(idx uint32, name string, t ValueType) ResultLogger

type ValWriter

type ValWriter func(ctx context.Context, mod api.Module, w Writer, i uint32, vals []uint64)

ValWriter formats an indexed value. For example, if `vals[i]` is a ValueTypeI32, this would format it by default as signed. If a ValueTypeString, it would read `vals[i+1]` and write the string from memory.

func ValWriterForType

func ValWriterForType(vt ValueType) ValWriter

type ValueType

type ValueType = api.ValueType

ValueType is an extended form of api.ValueType, used to control logging in cases such as bitmasks or strings.

type Writer

type Writer interface {
	io.Writer
	io.StringWriter
	io.ByteWriter
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL