andersfylling / andersfylling/deplog

Please consider simplifing it and adding support for structured logging.

Ouverte
#2 1 commentaire 1 réaction 0 personnes assignées Voir sur GitHub
enhancement question
Langage dominant
Go
Étoiles
3
Forks
0
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

Commenting on this as we recently wanted to find some reasonable interface for logging parameter for some new golang library. I thought our findings might be useful for you as well (:

Definitely std Golang logger is not nice, and some simple interface is what would be useful, so great idea overall. The problem is that this area is not trivial. There might be no good standard that will fit all. And we might end up with https://xkcd.com/927/

**Looking quickly on your interface I can (personally) see two main problems:**
* It is too large. I doubt you need so many log levels. See this great blog post, on how log levels can be limited to only `Info` and `Debug`: https://dave.cheney.net/2015/11/05/lets-talk-about-logging
* [Blocker]: This interface blocks structured logging. If you think about larger applications or swarm of those, you *have* to have proper logging pipleline that will store, index and allow to browse and aggregate them. That's why the log line has to have some kind of structure that will be readable for software. Read more about it here: https://www.client9.com/structured-logging-in-golang/

See those two nice libraries that allow structured logging (and are quite popular):
* https://github.com/sirupsen/logrus (`WithFields`)
* https://github.com/go-kit/kit/tree/master/log (pure forced structure).
and many more.

Also why the whole `Routing` logic? Why not just struct that implements your interface in the way that makes sense for other third party logger? It would be more explicit and clean and less runtime errors. Also what if the 3rd party logger have just `Print` with totally different arguments? (e.g just args ...interface{}), you cannot use routes anyway.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.