8000 Abstract out logging function from weave api package by bboreham · Pull Request #2024 · weaveworks/weave · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Jun 20, 2024. It is now read-only.

Abstract out logging function from weave api package #2024

Merged
merged 1 commit into from
Mar 9, 2016
Merged

Conversation

bboreham
Copy link
Contributor
@bboreham bboreham commented Mar 7, 2016

To reduce dependencies for other projects who decide to use the Weave Net API. With this change, you have to pass in the logger you want to use when you create the Client object.

The Logger interface here is a bit arbitrary; the only function we are actually using is Debugf, but it seemed a bit weird to just have that one line.

@rade
Copy link
Member
rade commented Mar 7, 2016

@peterbourgon I would like to get your take on this. I haven't seen any go libraries where logging is configured the way proposed here. Have you? Do you reckon it's ok to do this? Are there better approaches?

@peterbourgon
Copy link
Contributor

Loggers are dependencies, so a strong 👍 from me to pass a logger into your constructors.

Plenty of other packages do this or something like it; the only improvement I could suggest is making it optional, but in order to do that in this usage, we'd need to complect the API, either using multiple constructors or introducing a config object with a usable zero value. In either case, probably not worth it.

rade added a commit that referenced this pull request Mar 9, 2016
Abstract out logging function from weave api package
@rade rade merged commit 52552b5 into master Mar 9, 2016
@rade rade added this to the 1.5.0 milestone Mar 19, 2016
@rade rade deleted the abstract-api-log branch March 19, 2016 16:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
0