Add context logging constructor #252

Open
opened 2025-01-06 07:49:35 +01:00 by lash · 0 comments
Owner

For convenience, add a logger wrapper that adds the context keys to include in slog output.

e.g. something like (not tested):

package logging

type ContextLogger logging.Logger

func NewContextLogger(domain string) logging.Logger{
   var logg ContextLogger 
   logg = logging.NewVanilla().WithDomain(domain).WithContextKey("SessionId").WithContextKey("ATSessionId")
   return logg
}
For convenience, add a logger wrapper that adds the context keys to include in slog output. e.g. something like (not tested): ``` package logging type ContextLogger logging.Logger func NewContextLogger(domain string) logging.Logger{ var logg ContextLogger logg = logging.NewVanilla().WithDomain(domain).WithContextKey("SessionId").WithContextKey("ATSessionId") return logg } ```
lash added the Kind/Enhancement
Priority
Low
refactorsupport
Activity
Proposal
labels 2025-01-06 07:49:49 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: urdt/ussd#252