Skip to content

Commit

Permalink
Use non-global logger to avoid unexpected global log discarding
Browse files Browse the repository at this point in the history
Reported in GoogleContainerTools/kaniko#1955

Changes in
awslabs#309 made it
possible for callers depending on this code as a Go library to redirect
log output to ioutil.Discard to avoid spurious log statements.

Unfortunately, because in that change the logger being used was the
shared global logger.StandardLogger(), redirecting its output to
ioutil.Discard to quiet ecr-login also disabled all logging using the
shared global logger (like Kaniko does).
  • Loading branch information
imjasonh committed Feb 25, 2022
1 parent 3d7835a commit 7b103fe
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ecr-login/ecr.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func WithLogOutput(w io.Writer) Option {
func NewECRHelper(opts ...Option) *ECRHelper {
e := &ECRHelper{
clientFactory: api.DefaultClientFactory{},
logger: logrus.StandardLogger(),
logger: logrus.New(),
}
for _, o := range opts {
o(e)
Expand Down

0 comments on commit 7b103fe

Please sign in to comment.