Skip to content

Commit 436fe23

Browse files
authored
add controller id to the logger correctly (#699)
* add controller id to the logger correctly * add controller_id as additional field to the logger
1 parent 53aac02 commit 436fe23

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

controller/stackset.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,14 @@ func NewStackSetController(
108108
return nil, err
109109
}
110110

111+
logger := log.WithField("controller", "stackset")
112+
113+
if config.ControllerID != "" {
114+
logger = logger.WithField("controller_id", config.ControllerID)
115+
}
116+
111117
return &StackSetController{
112-
logger: log.WithFields(log.Fields{"controller": "stackset"}),
118+
logger: logger,
113119
client: client,
114120
config: config,
115121
stacksetEvents: make(chan stacksetEvent, 1),

0 commit comments

Comments
 (0)