Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removes "wall of shas" #98

Merged
merged 1 commit into from
Mar 28, 2019
Merged

removes "wall of shas" #98

merged 1 commit into from
Mar 28, 2019

Conversation

ekcasey
Copy link
Member

@ekcasey ekcasey commented Mar 27, 2019

  • temporarily set output destination for standard logger to discard before writing a remote image
  • surpresses ggcr output

[buildpacks/roadmap#45]

@ekcasey ekcasey force-pushed the no-more-wall-of-shas branch from ba52b1c to b9e1d57 Compare March 27, 2019 00:00
@ekcasey ekcasey requested a review from sclevine March 27, 2019 00:00
image/remote.go Outdated
@@ -258,6 +261,8 @@ func (r *remote) Save() (string, error) {
return "", err
}

log.SetOutput(ioutil.Discard)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mixed feelings about this.

Upside:

  • Probably no other way to do this without an upstream PR
  • log.SetOutput is re-entrant, so a global data race isn't possible

Downside:

  • This temporarily disables logging for any functions running in parallel that use the global logger (and the global logger is designed to be used in parallel). This could introduce a very surprising bug: some unrelated logs could occasionally disappear.

Would it make more sense to move this logic into a main package? If naively moving it up the stack would disable too many logs, could we fix this by inverting control?

image/remote.go Outdated
@@ -258,6 +261,8 @@ func (r *remote) Save() (string, error) {
return "", err
}

log.SetOutput(ioutil.Discard)
defer log.SetOutput(os.Stdout)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The default value for the global logger is os.Stderr (and it doesn't appear to be possible to determine the current global io.Writer in the log package). Might be better to use os.Stderr here, but this also makes me feel like pushing this into the main package might be better.

* NOTE: we are silencing the standard logger
* all lifecycle phases must create and use their own logger

[buildpacks/roadmap#45]

Signed-off-by: Emily Casey <[email protected]>
Signed-off-by: Danny Joyce <[email protected]>
@ekcasey ekcasey force-pushed the no-more-wall-of-shas branch from b9e1d57 to b58cbda Compare March 28, 2019 19:08
@ekcasey ekcasey requested a review from sclevine March 28, 2019 19:12
@ekcasey ekcasey merged commit 80cf345 into master Mar 28, 2019
@ekcasey ekcasey deleted the no-more-wall-of-shas branch July 29, 2019 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants