Skip to content

Commit cb11e52

Browse files
authored
[addon-operator] chore: add module-name in log (#739)
Signed-off-by: Sinelnikov Michail <mikhail.sinelnikov@flant.com>
1 parent 687dcb0 commit cb11e52

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pkg/module_manager/models/modules/helm.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ func NewHelmModule(bm *BasicModule, namespace string, tmpDir string, deps *HelmM
110110
if hm.logger == nil {
111111
hm.logger = log.NewLogger().Named("helm-module")
112112
}
113+
hm.logger = hm.logger.With(slog.String(pkg.LogKeyModule, hm.name))
113114

114115
isHelm, err := hm.isHelmChart()
115116
if err != nil {
@@ -126,7 +127,7 @@ func NewHelmModule(bm *BasicModule, namespace string, tmpDir string, deps *HelmM
126127
}
127128

128129
func (hm *HelmModule) WithLogger(logger *log.Logger) {
129-
hm.logger = logger
130+
hm.logger = logger.With(slog.String(pkg.LogKeyModule, hm.name))
130131
}
131132

132133
// isHelmChart check, could it be considered as helm chart or not

pkg/task/tasks/module-run/task.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ func (s *Task) Handle(ctx context.Context) (res queue.TaskResult) { //nolint:non
137137
res.Status = queue.Fail
138138

139139
s.logger.Error("ModuleRun failed. Requeue task to retry after delay.",
140+
slog.String(pkg.LogKeyModule, hm.ModuleName),
140141
slog.String("phase", string(baseModule.GetPhase())),
141142
slog.Int("count", s.shellTask.GetFailureCount()+1),
142143
log.Err(moduleRunErr))

0 commit comments

Comments
 (0)