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

Feature: add ability to configure logger file provider #97

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

nmiyake
Copy link
Contributor

@nmiyake nmiyake commented Jul 25, 2019

Adds new concepts like a FileWriterProvider which provides a
mechanism for a witchcraft.Server and invoking code to share
common io.Writer objects for performing logging operations.

Fixes #96


This change is Reviewable

Adds new concepts like a FileWriterProvider which provides a
mechanism for a witchcraft.Server and invoking code to share
common io.Writer objects for performing logging operations.

Fixes #96
@nmiyake nmiyake requested review from jdhenke and bmoylan July 25, 2019 18:32
@nmiyake
Copy link
Contributor Author

nmiyake commented Jul 25, 2019

Would like to get some feedback on usability/API in addition to the underlying issue.

The main trade-off I see is between keeping the API generic/raw versus making it more specialized.

The current approach is quite generic in that it provides a mechanism to return an io.Writer. However, this means that consumers need to create loggers themselves, and also need to provide the path to the logger files themselves (var/log/service.log, etc.).

Another possible approach would be to have a function that returns a set of loggers (service1log, metric1log, etc.). This would remove the need for callers constructing their own loggers and providing path to output. However, this makes the API a bit more fragile (if any of the logger types change in the future, the function would need to change), and for things like the service logger we would need to take extra parameters to specify things like the logger level. We would also want to make it clear that the returned logger doesn't update by default, and that if that behavior is desired the client would need to implement it.

Let me know if you guys have thoughts on this.

@nmiyake
Copy link
Contributor Author

nmiyake commented Jul 25, 2019

I've put up an alternate implementation at #99. I think I may prefer that alternate approach as one that has better balance/trade-offs, but open to feedback.

blakehawkins pushed a commit to blakehawkins/witchcraft-go-server that referenced this pull request Feb 13, 2020
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.

Provide mechanism to share logger output locations
1 participant