Skip to content

Commit

Permalink
add logger when nil
Browse files Browse the repository at this point in the history
Signed-off-by: Pavel Okhlopkov <[email protected]>
  • Loading branch information
Pavel Okhlopkov committed Nov 2, 2024
1 parent 1f0d1f3 commit e2606bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions pkg/shell-operator/operator.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ func NewShellOperator(ctx context.Context, opts ...Option) *ShellOperator {
opt(so)
}

if so.logger == nil {
so.logger = log.NewLogger(log.Options{}).Named("shell-operator")
}

return so
}

Expand Down
4 changes: 2 additions & 2 deletions test/utils/jsonloganalyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ func NewJsonLogAnalyzer() *JsonLogAnalyzer {
}

func (a *JsonLogAnalyzer) AddGroup(analyzers ...*JsonLogMatcher) {
r.Matchers = append(r.Matchers, analyzers)
a.Matchers = append(a.Matchers, analyzers)
}

func (a *JsonLogAnalyzer) OnStop(fn func()) {
r.OnStopFn = fn
a.OnStopFn = fn
}

func (a *JsonLogAnalyzer) Finished() bool {
Expand Down

0 comments on commit e2606bb

Please sign in to comment.