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
Custom logging middleware #50
Comments
Hey @nickckaye , It looks like you're replacing the worker logging middleware (which logs information about each and every message processed by your workers). The only logging I see in your output is the processing/quitting log entries from the manager which are logged on startup and shutdown. Line 47 in 571e6b3
If you'd like these to not be logged, you may want to replace type WorkersLogger interface {
Println(...interface{})
Printf(string, ...interface{})
} Something like this would simply remove those log entries (assuming it compiles): type MyLogger struct {
}
func (l *MyLogger) Println(v ...interface{}) {
// noop
}
func (l *MyLogger) Printf(fmt string, v ...interface{}) {
// noop
}
workers.Logger = &MyLogger{} Hope that helps! |
Also note that the default logging middleware uses So, simply replacing |
Thanks @jrallison ! Quote on http://stackoverflow.com/questions/30476990/golang-go-workers-custom-logging-middleware/30493680#30493680 for future wanderers. |
I'm building a Golang app that implements a Sidekiq-compatible jrallison/go-workers work queue and a custom logging wrapper around Sirupsen/logrus for marshaled JSON logs.
Now, all of my app (except for
go-workers
so far) uses my logger-wrapper in a central place to ensure that 100% of its output is JSON compatible.Note that lines #1 and #2 are proper JSON from our central logger, but when
go-workers
initializes we see line #3 come from the wrong logger in plain text.And when we send the signal to close the program, we see first on line #1 the wrong logger in plain text, followed by the proper JSON from our central logger on line #2.
I cannot seem to get this custom MiddlewareLogging to replace the
go-workers
default logging middleware.Is it actually possible to replace the default
go-workers
logging middleware for those lines?The text was updated successfully, but these errors were encountered: