fields

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package fields provides blockchain-specific logging field helpers.

These helpers create structured fields with consistent naming for blockchain-related data like transactions, blocks, shards, and timing.

Usage:

import "github.com/JupiterMetaLabs/ion/fields"

logger.Info("transaction routed",
    fields.TxHash("abc123"),
    fields.ShardID(5),
    fields.LatencyMs(12.5),
)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Address

func Address(addr string) ion.Field

Address creates an address field (wallet/contract).

func BlockHash

func BlockHash(hash string) ion.Field

BlockHash creates a block hash field.

func BlockHeight

func BlockHeight(height uint64) ion.Field

BlockHeight creates a block height field.

func ChainID

func ChainID(id string) ion.Field

ChainID creates a chain ID field.

func Component

func Component(name string) ion.Field

Component creates a component name field.

func Count

func Count(n int) ion.Field

Count creates a generic count field.

func DurationMs

func DurationMs(ms float64) ion.Field

DurationMs creates a duration field in milliseconds.

func DurationSec

func DurationSec(sec float64) ion.Field

DurationSec creates a duration field in seconds.

func Enabled

func Enabled(on bool) ion.Field

Enabled creates an enabled boolean field.

func Epoch

func Epoch(epoch uint64) ion.Field

Epoch creates an epoch field.

func ErrorMsg added in v0.1.4

func ErrorMsg(err error) ion.Field

ErrorMsg creates an error message field for non-fatal error logging. Use this when logging at Warn level where the error parameter isn't available. For Error level, prefer using the error parameter: log.Error(ctx, msg, err, ...)

func FromAddress added in v0.1.4

func FromAddress(addr string) ion.Field

FromAddress creates a "from" address field.

func GasLimit added in v0.1.4

func GasLimit(limit uint64) ion.Field

GasLimit creates a gas limit field.

func GasPrice added in v0.1.4

func GasPrice(price uint64) ion.Field

GasPrice creates a gas price field (in smallest unit, e.g., wei).

func GasUsed added in v0.1.4

func GasUsed(used uint64) ion.Field

GasUsed creates a gas used field.

func Host

func Host(host string) ion.Field

Host creates a host field.

func LatencyMs

func LatencyMs(ms float64) ion.Field

LatencyMs creates a latency field in milliseconds.

func Method

func Method(method string) ion.Field

Method creates a method name field (gRPC/HTTP).

func Network

func Network(net string) ion.Field

Network creates a network field (mainnet, devnet, testnet).

func NodeID

func NodeID(id string) ion.Field

NodeID creates a node ID field.

func Nonce added in v0.1.4

func Nonce(n uint64) ion.Field

Nonce creates a transaction nonce field.

func Operation

func Operation(op string) ion.Field

Operation creates an operation name field.

func Pending

func Pending(n int) ion.Field

Pending creates a pending count field.

func Port

func Port(port int) ion.Field

Port creates a port field.

func Reason

func Reason(r string) ion.Field

Reason creates a reason field (for failures/decisions).

func RemoteAddr

func RemoteAddr(addr string) ion.Field

RemoteAddr creates a remote address field.

func ReplicaIndex

func ReplicaIndex(idx int) ion.Field

ReplicaIndex creates a replica index field.

func Score

func Score(s float64) ion.Field

Score creates a score field.

func ShardID

func ShardID(id int) ion.Field

ShardID creates a shard ID field.

func Size

func Size(bytes int64) ion.Field

Size creates a size field in bytes.

func Slot

func Slot(slot uint64) ion.Field

Slot creates a slot number field (Solana).

func Success

func Success(ok bool) ion.Field

Success creates a success boolean field.

func ToAddress added in v0.1.4

func ToAddress(addr string) ion.Field

ToAddress creates a "to" address field.

func Total

func Total(n int) ion.Field

Total creates a total count field.

func TxHash

func TxHash(hash string) ion.Field

TxHash creates a transaction hash field.

func TxSignature

func TxSignature(sig string) ion.Field

TxSignature creates a transaction signature field.

func TxStatus

func TxStatus(status string) ion.Field

TxStatus creates a transaction status field.

func TxType

func TxType(txType string) ion.Field

TxType creates a transaction type field.

func Value added in v0.1.4

func Value(val string) ion.Field

Value creates a transaction value field.

func Weight

func Weight(w float64) ion.Field

Weight creates a weight field.

Types

This section is empty.

Jump to

Keyboard shortcuts

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