andersfylling / andersfylling/deplog

Please consider simplifing it and adding support for structured logging.

Abierto
#2 1 comentario 1 reacción 0 asignados Ver en GitHub
enhancement question
Lenguaje dominante
Go
Estrellas
3
Forks
0
Métricas de merge de PR
Sin PR fusionados en 30 d

Descripción

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.

Guía de contribución

No hay ninguna guía de contribución indexada para este repositorio

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.