Documentation
¶
Overview ¶
Package log sends guest output to the logging context supplied by the host. Each call passes one formatted string to LoggingContext.AddLog.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Print ¶
func Print(ctx LoggingContext, v ...any)
Print writes the arguments formatted by fmt.Sprint to ctx.
func Printf ¶
func Printf(ctx LoggingContext, format string, v ...any)
Printf formats the message with fmt.Sprintf and writes it to ctx.
Example ¶
package main
import (
"fmt"
"github.com/andreyvit/evm/evmruntime/log"
)
type messageLog []string
func (l *messageLog) AddLog(s string) { *l = append(*l, s) }
func main() {
var messages messageLog
log.Printf(&messages, "processed %d orders", 3)
fmt.Println(messages[0])
}
Output: processed 3 orders
func Println ¶
func Println(ctx LoggingContext, v ...any)
Println writes one line formatted by fmt.Sprintln to ctx.
Types ¶
type LoggingContext ¶
type LoggingContext interface {
AddLog(str string)
}
LoggingContext receives one formatted message per guest log call.