NullLogger for debug output. (#12)

This commit is contained in:
Naoki Kosaka 2019-02-11 20:51:46 +09:00 committed by GitHub
parent 25b8259e49
commit 85ba6beec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 0 deletions

30
worker/logger.go Normal file
View 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{}) {
}

View File

@ -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()