logx

package
v1.1.1035 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CorrelationHeader       = "cid"             // CorrelationHeader is the name of the nats message header for transporting the correlationID.
	CorrelationContextKey   = ContextKey("cid") // CorrelationContextKey is the name of the context key used to store the correlationID.
	EcoSystemLoggingKey     = "eco"             // EcoSystemLoggingKey is the name of the logging key used to store the current ecosystem.
	SubsystemLoggingKey     = "sub"             // SubsystemLoggingKey is the name of the logging key used to store the current subsystem.
	CorrelationLoggingKey   = "cid"             // CorrelationLoggingKey is the name of the logging key used to store the correlation id.
	AreaLoggingKey          = "loc"             // AreaLoggingKey is the name of the logging key used to store the functional area.
	WfStateLoggingKeyPrefix = "wfState."        // WfStateLoggingKeyPrefix is the prefix of the logging key used to store useful values from the workflowstate.
)

Variables

This section is empty.

Functions

func ContextWith

func ContextWith(ctx context.Context, area string) (context.Context, *slog.Logger)

ContextWith obtains a new logger with an area parameter. Typically it should be used when obtaining a logger within a programmatic boundary.

func Err

func Err(ctx context.Context, message string, err error, atts ...any) error

Err will output error message to the log and return the error with additional attributes.

func FromContext added in v1.0.472

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

FromContext obtains a logger from the context or takes the default logger.

func NatsMessageLoggingEntrypoint added in v1.0.400

func NatsMessageLoggingEntrypoint(ctx context.Context, subsystem string, hdr nats.Header) (context.Context, *slog.Logger)

NatsMessageLoggingEntrypoint returns a new logger and a context containing the logger for use when a new NATS message arrives.

func NewContext added in v1.0.472

func NewContext(ctx context.Context, logger *slog.Logger) context.Context

NewContext creates a new context with the specified logger

func SetDefault

func SetDefault(ecosystem string, hndlr slog.Handler)

SetDefault sets the default slog handler

Types

type ContextKey

type ContextKey string

ContextKey is a custom type to avoid context collision.

Jump to

Keyboard shortcuts

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