go-logging icon indicating copy to clipboard operation
go-logging copied to clipboard

Logger as interface, not struct?

Open elgris opened this issue 10 years ago • 5 comments

Hello guys! I'm just wondering if you're considering to make Logger interface instead of struct. This can allow to switch between logger implementations.

Even PHP-world decided to develop convenient logger interface :)

elgris avatar Jul 11 '14 10:07 elgris

I've been thinking about it before and sure. It does make sense.

Why do you need this though?

op avatar Jul 12 '14 10:07 op

I just do not like to make my code library-dependent :). At the moment I'm using go-logging library, but my clients may want to use something else.

Btw, I can send a pull request for this feature so we can discuss.

Regards.

elgris avatar Jul 16 '14 09:07 elgris

@op interfaces are much more flexible to work with. strong +1 the context is a wonderful example of using interfaces for what would otherwise be concrete types: http://godoc.org/code.google.com/p/go.net/context

jbenet avatar Sep 19 '14 21:09 jbenet

I agree too. Thanks for this lib, by the way.

mrsinham avatar Oct 09 '14 09:10 mrsinham

I also agree. And again, thanks very much for this library!

JamesHaskell avatar Jan 28 '16 18:01 JamesHaskell