logger

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RequestUUID contextKey = iota

	MetadataMapKey contextKey = iota

	// Construction identifies construction check
	Construction CheckType = "construction"
	// Data identifies data check
	Data CheckType = "data"
)

Variables

This section is empty.

Functions

func AddMetadata added in v0.10.2

func AddMetadata(msg string, metadataMap map[string]string) string

AddMetadata k-v pairs to the tip

func AddMetadataMapFromContext added in v0.10.2

func AddMetadataMapFromContext(ctx context.Context, msg string) string

Add InfoMetaData k-v pairs to the tip

func AddMetadataMapToContext added in v0.10.2

func AddMetadataMapToContext(ctx context.Context, metadataMap map[string]string) context.Context

AddMetadataMapToContext will add InfoMetaData to the context, and return the new context

func AddRequestUUIDToMap added in v0.10.2

func AddRequestUUIDToMap(metadataMap map[string]string, requestUUID string) map[string]string

add requesrUUID to metadataMap

func ConvertMapToString added in v0.10.2

func ConvertMapToString(metadataMap map[string]string) string

convert metadataMap to a string, aims to support fmt.Errorf

func ConvertStringToMap added in v0.10.2

func ConvertStringToMap(metadata string) map[string]string

ConvertStringToMap is used to convert a string to map by split , and ;

func LogMemoryStats added in v0.5.5

func LogMemoryStats(ctx context.Context)

LogMemoryStats logs memory usage information.

func LogTransactionCreated added in v0.5.0

func LogTransactionCreated(
	transactionIdentifier *types.TransactionIdentifier,
)

LogTransactionCreated logs the hash of created transactions.

Types

type CheckType added in v0.7.4

type CheckType string

type Logger

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

Logger contains all logic to record validator output and benchmark a Rosetta Server.

func NewLogger

func NewLogger(
	logDir string,
	logBlocks bool,
	logTransactions bool,
	logBalanceChanges bool,
	logReconciliation bool,
	checkType CheckType,
	network *types.NetworkIdentifier,
	logMetadataMap map[string]string,
	fields ...zap.Field,
) (*Logger, error)

NewLogger constructs a new Logger.

func (*Logger) AddBlockStream

func (l *Logger) AddBlockStream(
	ctx context.Context,
	block *types.Block,
) error

AddBlockStream writes the next processed block to the end of the blockStreamFile output file.

func (*Logger) BalanceStream

func (l *Logger) BalanceStream(
	ctx context.Context,
	balanceChanges []*parser.BalanceChange,
) error

BalanceStream writes a slice of storage.BalanceChanges to the balanceStreamFile.

func (*Logger) Debug added in v0.7.4

func (l *Logger) Debug(msg string, fields ...zap.Field)

Debug logs at Debug level

func (*Logger) Error added in v0.7.4

func (l *Logger) Error(msg string, fields ...zap.Field)

Error logs at Error level

func (*Logger) Fatal added in v0.7.4

func (l *Logger) Fatal(msg string, fields ...zap.Field)

Fatal logs at Fatal level

func (*Logger) GetMetadata added in v0.10.2

func (l *Logger) GetMetadata() string

return a string of metadata

func (*Logger) GetMetadataMap added in v0.10.2

func (l *Logger) GetMetadataMap() map[string]string

return a map of metadatMap

func (*Logger) Info added in v0.7.4

func (l *Logger) Info(msg string, fields ...zap.Field)

Info logs at Info level

func (*Logger) LogConstructionStatus added in v0.5.6

func (l *Logger) LogConstructionStatus(
	ctx context.Context,
	status *results.CheckConstructionStatus,
)

LogConstructionStatus logs results.CheckConstructionStatus.

func (*Logger) LogDataStatus added in v0.5.6

func (l *Logger) LogDataStatus(ctx context.Context, status *results.CheckDataStatus)

LogDataStatus logs results.CheckDataStatus.

func (*Logger) Panic added in v0.7.4

func (l *Logger) Panic(msg string, fields ...zap.Field)

Panic logs at Panic level

func (*Logger) ReconcileFailureStream

func (l *Logger) ReconcileFailureStream(
	ctx context.Context,
	reconciliationType string,
	account *types.AccountIdentifier,
	currency *types.Currency,
	computedBalance string,
	liveBalance string,
	block *types.BlockIdentifier,
) error

ReconcileFailureStream logs all reconciliation checks performed during syncing.

func (*Logger) ReconcileSuccessStream

func (l *Logger) ReconcileSuccessStream(
	ctx context.Context,
	reconciliationType string,
	account *types.AccountIdentifier,
	currency *types.Currency,
	balance string,
	block *types.BlockIdentifier,
) error

ReconcileSuccessStream logs all reconciliation checks performed during syncing.

func (*Logger) RemoveBlockStream

func (l *Logger) RemoveBlockStream(
	ctx context.Context,
	block *types.BlockIdentifier,
) error

RemoveBlockStream writes the next processed block to the end of the blockStreamFile output file.

func (*Logger) TransactionStream

func (l *Logger) TransactionStream(
	ctx context.Context,
	block *types.Block,
) error

TransactionStream writes the next processed block's transactions to the end of the transactionStreamFile.

func (*Logger) Warn added in v0.7.4

func (l *Logger) Warn(msg string, fields ...zap.Field)

Warn logs at Warn level

Jump to

Keyboard shortcuts

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