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
- func SetDefault(ecosystem string, hndlr slog.Handler)
- type ContextKey
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 ¶
ContextWith obtains a new logger with an area parameter. Typically it should be used when obtaining a logger within a programmatic boundary.
func Err ¶
Err will output error message to the log and return the error with additional attributes.
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.
func NewContext ¶ added in v1.0.472
NewContext creates a new context with the specified logger
func SetDefault ¶
SetDefault sets the default slog handler
Types ¶
Click to show internal directories.
Click to hide internal directories.