Feat: Update the logger config to show the parent_id
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user