-
Notifications
You must be signed in to change notification settings - Fork 26
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
Adds Info and Debug logger functionality #254
Conversation
This is awesome. Could you add some godoc examples of how a buildpack author can incorporate this logger into their buildpack in practice? The tests sort of show it, but a direct example would be great. |
For sure I could doc up the whole package if that is something we are looking for! |
There's quite a bit of duplication happening here. We've now got 3 different loggers with duplicative implementation APIs and switching logic. I think we can achieve something a bit simpler by just controlling whether or not the writer goes somewhere or is discarded. I've thrown together a simplified example here: https://github.com/paketo-buildpacks/packit/blob/log-levels-alt/scribe/logger.go Take a look and let me know what you think. |
I like the look of that implementation. I am gonna make those changes to my code as well as add documentation! |
- Deprecates Bar as it is currently unused
Moving this to draft until I have the examples written up as well as a package level doc! |
@fg-j @ryanmoran Alrighty took me a little longer than I thought but the docs are up and running. Couple call outs.
Hope this accomplishes everything that y'all are looking for. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I didn't understand your comment @ForestEckhardt about getting a working example with Color, but if possible I'd love to see an example of how to properly use the logger with Debug functionality.
Co-authored-by: Frankie G-J <frankieg@vmware.com>
Co-authored-by: Frankie G-J <frankieg@vmware.com>
My trouble with Color is that the only way I know haw to test the examples is by testing the contents of stdout. The Colors function adds a prefix and a suffix that is interpreted by the terminal and changes the display but seemingly does not make it to standard out. If there is another way of getting the examples working and testing it I am game! I totally forgot that was the feature I added to start this work 🤦 I will add an example ASAP! |
@fg-j So after so discussion with @ryanmoran and a little investigating on his part he discovered that:
So it would appear that it is not possible to test the Color functionality using the Go Examples testing framework. I hope that clears things up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding that debug logging example. LGTM!
Co-authored-by: Ryan Moran <155736+ryanmoran@users.noreply.github.com>
Resolves #252
Checklist