logging

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package logging provides the kit's structured JSON logging base (FR-050).

Every log line carries a correlation ID plus the standard chain-context fields; secret material (private keys, mnemonics, sign-doc bytes) must never be logged — TestNoSecretFields enforces the field-name blocklist.

Index

Constants

View Source
const (
	FieldChainID       = "chain_id"
	FieldHeight        = "height"
	FieldTxHash        = "tx_hash"
	FieldAddress       = "address"
	FieldWithdrawalID  = "withdrawal_id"
	FieldDepositID     = "deposit_id"
	FieldSweepID       = "sweep_id"
	FieldSequence      = "sequence"
	FieldErrorCode     = "error_code"
	FieldNodeEndpoint  = "node_endpoint"
	FieldCorrelationID = "correlation_id"
	FieldService       = "service"
)

Standard field keys (FR-050). Use these constants — ad-hoc keys defeat log aggregation and the secret-field lint.

Variables

View Source
var ForbiddenFieldSubstrings = []string{
	"private_key", "privkey", "mnemonic", "seed_phrase", "sign_doc_bytes", "signature_secret",
}

ForbiddenFieldSubstrings are field-name fragments that must never appear in a log call: they indicate secret material. internal/logging tests and the export-pipeline sanitization scan both consume this list.

Functions

func From

func From(ctx context.Context) *slog.Logger

From extracts the correlation-bound logger from ctx, falling back to a service-less root logger.

func New

func New(service string) *slog.Logger

New returns the kit's root JSON logger for a named service.

func WithCorrelation

func WithCorrelation(ctx context.Context, logger *slog.Logger, correlationID string) (context.Context, *slog.Logger)

WithCorrelation returns a context carrying a correlation ID and a logger bound to it. All work items (blocks, withdrawals, sweeps) get one at entry.

Types

This section is empty.

Jump to

Keyboard shortcuts

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