-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implementation of logrus as logging library #6
Comments
Its a bad idea, because logrus is huge, slow, complicated and most of the time useless lib. Also it conflicts with modern methodologies, like https://12factor.net/ and specially https://12factor.net/logs. Moreover making logging lib as dependency for transport lib is also not best idea. So you can do it yourself: just write this piece of code somewhere and use import (
"github.com/sirupsen/logrus"
)
type Adapter struct {
*logrus.Logger
}
func (a *Adapter) Log(v ...interface{}) error {
// log how you want, e.g.
a.Logger.Error(v...)
return nil
} Usage: func main() {
lg := Adapter{Logger: logrus.New()}
_ = lg.Log("")
cl := amqp.NewClient(..., amqp.WithLogger{lg})
} |
I agree with you that the logrus it huge and more complex but on the other hands provide hooks for other systems such as ELK or other monitoring systems. |
Logger need for log only errors that happens in goroutines (so cant be returned to caller). |
Implementation of logrus as logging library instead of custom logger.
The text was updated successfully, but these errors were encountered: