4 ms·
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()
by gabereiser 4y ago
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.
- qzio 4y agoCan 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.
- gabereiser 4y agoAh, 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/syslog@go1.19#Priority https://pkg.go.dev/log/syslog@go1.19#Priority