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 LoggingEntrypoint(ctx context.Context, subsystem string, correlationId string) (context.Context, *slog.Logger)
- func SetDefault(level slog.Level, addSource bool, ecosystem string)
- 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. )
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 LoggingEntrypoint ¶
func LoggingEntrypoint(ctx context.Context, subsystem string, correlationId string) (context.Context, *slog.Logger)
LoggingEntrypoint returns a new logger and a context containing the logger for use during entry points. An entry point is any code location where correlation has been obtained.
Types ¶
Click to show internal directories.
Click to hide internal directories.