Closed cenkalti closed 6 years ago
Thanks for the PR. Could you document Logger and Logger2 in the Config struct? Feel free to vocally complain about Logger and say it should be renamed to Hooks
😅.
For record, this change removes some granularity about log message verbosity. But that's OK since in the worst case scenario (e.g: when debugging) one can just log everything and filter things later.
@nictuku I think Logger2
is really a bad name :) Can I rename it as MessageLogger
?
Perhaps DebugLogger ?
@nictuku done.
@cenkalti the change looks good. I have no further comments.
The CI is broken, sadly, so I'll test it out tomorrow or so, then I'll merge.
Thank you again for this Cenk!
Ref #61
@nictuku This is the smallest interface that I can think of: https://github.com/cenkalti/dht/blob/29206eba2e98f2d7fab5affe38d5655a78b45db7/logging.go#L3-L7
By implementing this interface people can still use
dht
withglog
or any logger they want.I have named it as
Logger2
because there is already an interface named asLogger
: https://github.com/cenkalti/dht/blob/29206eba2e98f2d7fab5affe38d5655a78b45db7/dht.go#L223-L227Of course this name is unacceptable :)
In fact, existing
Logger
interface does not represent a logger actually. I suggest renaming it asHooks
or something else and makeLogger2
->Logger
. However, this is not possible without breaking backwards compatibility. I think it is best to tag the current commit asv1
and include this change inv2
.