heetch / felice

Felice is a nascent, opinionated Kafka library for Go, in Go
MIT License
20 stars 1 forks source link

Replace logger by logrus or equivalent #35

Open asdine opened 5 years ago

asdine commented 5 years ago

In order to better control the behaviour of the logs and be able for example to send everything that was logged on Error level to Sentry, we need a library that supports log levels. The obvious choice would be Logrus because we already have ready to use hooks in our internal libraries and it's one of the most used logging library in the Go community.

tealeg commented 5 years ago

I'd strongly prefer using an interface rather than a tight binding - there are other compatible loggers (like apex/log) that provide different feature sets. Logrus compatibility is desirable, a hard binding to it less so.

asdine commented 5 years ago

My concern with an interface is that it limits the possibilities and requires too much work. Logrus, Apex, Zerolog etc. use method chaining for building a single log line. Adding an interface to deal with that means in fact adding multiple big interfaces that will be painful to implement.

IMO customizing a logger means being able to:

Also, it must output JSON.

We could simply select any logger that is capable of doing so and use it as is, I don't think it would handicap users in any way as long as they can customize the points above.

I'm just afraid that abstracting the logger would make us write something too big.

WDYT?