Re:Labstack/echo: High performance, minimalist Go web framework
by Cwizard on Monday August 15, 2022 @04:04AM
(#32466980)
Could you elaborate why logging is a mess in the Go ecosystem?
[ Parent
| on HN ]
Re:Labstack/echo: High performance, minimalist Go web framework
by fredrikholm on Monday August 15, 2022 @04:29AM
(#32467151)
Wouldn't call it a mess, but there is less consensus amongst the community. Logging is one of the areas where there is no established standard.
That said, Zap (by Uber) has proved itself and is a solid choice. We've used it in several projects at [company], handling very high loads.
Re:Labstack/echo: High performance, minimalist Go web framework
by gabereiser on Monday August 15, 2022 @10:43AM
(#32470307)
Didn't the Go team say that there's a logging interface and that's where they are going to leave it. If you want more robust logging, you can add it. log.New() is for that purpose. If you want a struct-log, you'll have to define one for your needs. Logging is very environment specific. What I log to the console locally is different from what I log to, say, AWS CloudWatch in production.
I think the stance on logging by the core Go team is the right way to go about it. Just provide a basic logger, an interface, and let the projects determine how they want to route those logs and what kind of data should it include.
Re:Labstack/echo: High performance, minimalist Go web framework
by qzio on Monday August 15, 2022 @03:17PM
(#32474005)
Can you provide a link to this interface?
The log package in stdlib doesn’t let you specify levels, just a Printf unless Iam mistaken, and it is not an interface I believe.
Re:Labstack/echo: High performance, minimalist Go web framework
by gabereiser on Monday August 15, 2022 @04:39PM
(#32475060)
Ah, it's not an interface but a struct. My mistake. The syslog part of the log package allows you to specify the priority. https://pkg.go.dev/log/[email protected]#Priority