Sirupsen/logrus
Jump to navigation
Jump to search
External
Internal
Overview
Logrus is in maintenance-mode. From the author: I believe Logrus' biggest contribution is to have played a part in today's widespread use of structured logging in Golang. There doesn't seem to be a reason to do a major, breaking iteration into Logrus V2, since the fantastic Go community has built those independently. Many fantastic alternatives have sprung up. Logrus would look like those, had it been re-designed with what we know about structured logging in Go today. Check out, for example, Zerolog, Zap, and Apex.
Idioms
Constant String Logging
if err != nil {
logger.WithError(err).WithFields(logrus.Fields{
"field1": value1,
"field2": value2
}).Error("Constant string error message")
}