Documentation
¶
Index ¶
- Constants
- func ContextWith(ctx context.Context, area string) (context.Context, *slog.Logger)
- func Err(ctx context.Context, message string, err error, atts ...any) error
- func FromContext(ctx context.Context) *slog.Logger
- func NatsMessageLoggingEntrypoint(ctx context.Context, subsystem string, hdr nats.Header) (context.Context, *slog.Logger)
- func NewContext(ctx context.Context, logger *slog.Logger) context.Context
- type ContextKey
Constants ¶
View Source
const ( // CorrelationHeader is the name of the nats message header for transporting the correlationID. CorrelationHeader = "cid" // CorrelationContextKey is the name of the context key used to store the correlationID. CorrelationContextKey = ContextKey("cid") // EcoSystemLoggingKey is the name of the logging key used to store the current ecosystem. EcoSystemLoggingKey = "eco" // SubsystemLoggingKey is the name of the logging key used to store the current subsystem. SubsystemLoggingKey = "sub" // CorrelationLoggingKey is the name of the logging key used to store the correlation id. CorrelationLoggingKey = "cid" // AreaLoggingKey is the name of the logging key used to store the functional area. AreaLoggingKey = "loc" // WfStateLoggingKeyPrefix is the prefix of the logging key used to store useful values from the workflowstate. WfStateLoggingKeyPrefix = "wfState." )
Variables ¶
This section is empty.
Functions ¶
func ContextWith ¶
ContextWith obtains a new logger with an area parameter. Typically it should be used when obtaining a logger within a programmatic boundary.
func FromContext ¶ added in v1.0.472
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.
Types ¶
Click to show internal directories.
Click to hide internal directories.