Feat: Update the logger config to show the parent_id

This commit is contained in:
Manendra Pal Singh
2026-01-28 21:29:37 +05:30
parent a42159ddb4
commit 8948479dea
9 changed files with 104 additions and 13 deletions

View File

@@ -17,6 +17,7 @@ import (
type Config struct {
Role string
ContextKeys []string
ParentID string
}
const contextKey = "context"
@@ -58,6 +59,11 @@ func NewPreProcessor(cfg *Config) (func(http.Handler) http.Handler, error) {
log.Debugf(ctx, "adding subscriberId to request:%s, %v", model.ContextKeySubscriberID, subID)
ctx = context.WithValue(ctx, model.ContextKeySubscriberID, subID)
}
if cfg.ParentID != "" {
log.Debugf(ctx, "adding parentID to request:%s, %v", model.ContextKeyParentID, cfg.ParentID)
ctx = context.WithValue(ctx, model.ContextKeyParentID, cfg.ParentID)
}
for _, key := range cfg.ContextKeys {
ctxKey, _ := model.ParseContextKey(key)
if v, ok := reqContext[key]; ok {