Skip to content

Commit

Permalink
defer oldLevel
Browse files Browse the repository at this point in the history
  • Loading branch information
tammy-baylis-swi committed Apr 25, 2024
1 parent 21e9cbd commit a376779
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,12 @@ func TestInvalidConfigFile(t *testing.T) {
writers = append(writers, os.Stderr)

log.SetOutput(io.MultiWriter(writers...))
oldLevel := log.Level
log.SetLevel(log.INFO)

defer func() {
log.SetOutput(os.Stderr)
log.SetLevel(oldLevel())
}()

ClearEnvs()
Expand Down
2 changes: 2 additions & 0 deletions internal/host/host_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,12 @@ func TestConfiguredHostname(t *testing.T) {
writers = append(writers, &buf)

log.SetOutput(io.MultiWriter(writers...))
oldLevel := log.Level
log.SetLevel(log.INFO)

defer func() {
log.SetOutput(os.Stderr)
log.SetLevel(oldLevel())
}()

var old string
Expand Down

0 comments on commit a376779

Please sign in to comment.