api

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2024 License: Apache-2.0 Imports: 2 Imported by: 5

Documentation

Index

Constants

View Source
const Memory = "memory"

Variables

This section is empty.

Functions

This section is empty.

Types

type Closer

type Closer interface {
	// Close releases resources such as any Wasm modules, compiled code, and
	// the runtime.
	Close(context.Context) error
}

type ConsoleLogger

type ConsoleLogger struct{}

ConsoleLogger is a convenience which writes anything above LogLevelInfo to os.Stdout.

func (ConsoleLogger) IsEnabled

func (ConsoleLogger) IsEnabled(level LogLevel) bool

IsEnabled implements the same method as documented on api.Logger.

func (ConsoleLogger) Log

func (ConsoleLogger) Log(_ context.Context, level LogLevel, message string)

Log implements the same method as documented on api.Logger.

type LogLevel

type LogLevel int32

LogLevel controls the volume of logging. The lower the number the more detail is logged.

Note: The most voluminous level, LogLevelDebug is -1 to prevent users from accidentally defaulting to it.

const (
	LogLevelDebug LogLevel = -1
	LogLevelInfo  LogLevel = 0
	LogLevelWarn  LogLevel = 1
	LogLevelError LogLevel = 2
	LogLevelNone  LogLevel = 3
)

type Logger

type Logger interface {
	// IsEnabled returns true if the input level would be logged.
	//
	// Note: Guests may cache this value at requestscope.
	IsEnabled(LogLevel) bool

	// Log logs a message to the host's logs.
	Log(context.Context, LogLevel, string)
}

type NoopLogger

type NoopLogger struct{}

NoopLogger is a convenience which ignores all output.

func (NoopLogger) IsEnabled

func (NoopLogger) IsEnabled(level LogLevel) bool

IsEnabled implements the same method as documented on api.Logger.

func (NoopLogger) Log

Log implements the same method as documented on api.Logger.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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