NullLogger for debug output. (#12)
This commit is contained in:
parent
25b8259e49
commit
85ba6beec7
30
worker/logger.go
Normal file
30
worker/logger.go
Normal file
@ -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{}) {
|
||||||
|
}
|
@ -9,6 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/RichardKnop/machinery/v1"
|
"github.com/RichardKnop/machinery/v1"
|
||||||
"github.com/RichardKnop/machinery/v1/config"
|
"github.com/RichardKnop/machinery/v1/config"
|
||||||
|
"github.com/RichardKnop/machinery/v1/log"
|
||||||
"github.com/go-redis/redis"
|
"github.com/go-redis/redis"
|
||||||
uuid "github.com/satori/go.uuid"
|
uuid "github.com/satori/go.uuid"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
@ -82,6 +83,10 @@ func main() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err.Error())
|
panic(err.Error())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
newNullLogger := NewNullLogger()
|
||||||
|
log.DEBUG = newNullLogger
|
||||||
|
|
||||||
workerID := uuid.NewV4()
|
workerID := uuid.NewV4()
|
||||||
worker := machineryServer.NewWorker(workerID.String(), 200)
|
worker := machineryServer.NewWorker(workerID.String(), 200)
|
||||||
err = worker.Launch()
|
err = worker.Launch()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user