diff --git a/worker/logger.go b/worker/logger.go new file mode 100644 index 0000000..234cd43 --- /dev/null +++ b/worker/logger.go @@ -0,0 +1,30 @@ +package main + +// NullLogger : Null logger for debug output +type NullLogger struct { +} + +// NewNullLogger : Create Nulllogger +func NewNullLogger() *NullLogger { + var newNullLogger NullLogger + return &newNullLogger +} + +func (l *NullLogger) Print(v ...interface{}) { +} +func (l *NullLogger) Printf(format string, v ...interface{}) { +} +func (l *NullLogger) Println(v ...interface{}) { +} +func (l *NullLogger) Fatal(v ...interface{}) { +} +func (l *NullLogger) Fatalf(format string, v ...interface{}) { +} +func (l *NullLogger) Fatalln(v ...interface{}) { +} +func (l *NullLogger) Panic(v ...interface{}) { +} +func (l *NullLogger) Panicf(format string, v ...interface{}) { +} +func (l *NullLogger) Panicln(v ...interface{}) { +} diff --git a/worker/worker.go b/worker/worker.go index 36d2dea..a33e3a3 100644 --- a/worker/worker.go +++ b/worker/worker.go @@ -9,6 +9,7 @@ import ( "github.com/RichardKnop/machinery/v1" "github.com/RichardKnop/machinery/v1/config" + "github.com/RichardKnop/machinery/v1/log" "github.com/go-redis/redis" uuid "github.com/satori/go.uuid" "github.com/spf13/viper" @@ -82,6 +83,10 @@ func main() { if err != nil { panic(err.Error()) } + + newNullLogger := NewNullLogger() + log.DEBUG = newNullLogger + workerID := uuid.NewV4() worker := machineryServer.NewWorker(workerID.String(), 200) err = worker.Launch()