log

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: 0BSD Imports: 1 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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.

Jump to

Keyboard shortcuts

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