actionlog

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 8 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionType

type ActionType string

ActionType classifies an action log entry.

const (
	TypeTx       ActionType = "tx"
	TypeQuery    ActionType = "query"
	TypeWorkflow ActionType = "workflow"
	TypeProvider ActionType = "provider"
	TypeContext  ActionType = "context"
	TypeConsole  ActionType = "console"
	TypeFaucet   ActionType = "faucet"
	TypeError    ActionType = "error"
)

type Entry

type Entry struct {
	Timestamp  time.Time       `json:"ts"`
	Type       ActionType      `json:"type"`
	Action     string          `json:"action"`
	TxHash     string          `json:"tx_hash,omitempty"`
	Height     int64           `json:"height,omitempty"`
	GasUsed    int64           `json:"gas_used,omitempty"`
	ResultCode uint32          `json:"code,omitempty"`
	DSeq       uint64          `json:"dseq,omitempty"`
	GSeq       uint32          `json:"gseq,omitempty"`
	OSeq       uint32          `json:"oseq,omitempty"`
	Provider   string          `json:"provider,omitempty"`
	Account    string          `json:"account,omitempty"`
	Params     json.RawMessage `json:"params,omitempty"`
	DurationMs int64           `json:"duration_ms,omitempty"`
	WorkflowID string          `json:"workflow_id,omitempty"`
	// Step is written unconditionally (SPEC §5.4): with omitempty the first
	// step of every workflow run, index 0, vanished from machine output, so
	// the entry recording where a run started looked like an entry with no
	// step at all.
	Step     int    `json:"step"`
	StepName string `json:"step_name,omitempty"`
	Error    string `json:"error,omitempty"`
	Status   string `json:"status,omitempty"`
}

Entry is a single action log record, serialized as one JSON line.

type Filter

type Filter struct {
	Type    ActionType
	Since   time.Time
	Limit   int
	DSeq    uint64
	Account string
	// WorkflowID isolates the entries of a single workflow run, so two
	// interleaved runs of the same workflow can be read apart.
	WorkflowID string
}

Filter defines criteria for reading log entries.

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is an append-only action log backed by a JSONL file. It is safe for concurrent use.

func Open

func Open(path string) (*Logger, error)

Open opens (or creates) an action log file at the given path.

func (*Logger) Close

func (l *Logger) Close() error

Close flushes and closes the log file.

func (*Logger) Export

func (l *Logger) Export(w io.Writer) error

Export writes all entries to the given writer as JSONL.

func (*Logger) Log

func (l *Logger) Log(entry Entry) error

Log appends an entry to the log. It automatically rotates if needed.

func (*Logger) Read

func (l *Logger) Read(filter Filter) ([]Entry, error)

Read reads entries from the log, most recent first, applying the filter.

Jump to

Keyboard shortcuts

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