Skip to content
This repository has been archived by the owner on Jun 23, 2023. It is now read-only.

Replace logger by logrus or equivalent #35

Open
asdine opened this issue Jan 10, 2019 · 2 comments
Open

Replace logger by logrus or equivalent #35

asdine opened this issue Jan 10, 2019 · 2 comments

Comments

@asdine
Copy link
Contributor

asdine commented Jan 10, 2019

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.

@asdine asdine added this to the v0.3.0 milestone Jan 10, 2019
@tealeg
Copy link
Contributor

tealeg commented Jan 10, 2019

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
Copy link
Contributor Author

asdine commented Jan 10, 2019

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:

  • select the log level
  • select the output (io.Writer)
  • add hooks

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?

@asdine asdine removed this from the v0.3.0 milestone Jun 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants