From bd0617b2a3c3109bba8f2c0d9eacf33bbbdb6a46 Mon Sep 17 00:00:00 2001 From: Wenkai Yin Date: Tue, 15 Mar 2016 13:31:08 +0800 Subject: [PATCH] remove duplicate implements --- log/logger.go | 58 +++++++++------------------------------------------ 1 file changed, 10 insertions(+), 48 deletions(-) diff --git a/log/logger.go b/log/logger.go index 26c2d852d..aff231569 100644 --- a/log/logger.go +++ b/log/logger.go @@ -186,90 +186,52 @@ func (l *Logger) Fatalf(format string, v ...interface{}) { // Debug ... func Debug(v ...interface{}) { - if logger.lvl <= DebugLevel { - line := line(2) - record := NewRecord(time.Now(), fmt.Sprint(v...), line, DebugLevel) - logger.output(record) - } + logger.Debug(v...) } // Debugf ... func Debugf(format string, v ...interface{}) { - if logger.lvl <= DebugLevel { - line := line(2) - record := NewRecord(time.Now(), fmt.Sprintf(format, v...), line, DebugLevel) - logger.output(record) - } + logger.Debugf(format, v...) } // Info ... func Info(v ...interface{}) { - if logger.lvl <= InfoLevel { - record := NewRecord(time.Now(), fmt.Sprint(v...), "", InfoLevel) - logger.output(record) - } + logger.Info(v...) } // Infof ... func Infof(format string, v ...interface{}) { - if logger.lvl <= InfoLevel { - record := NewRecord(time.Now(), fmt.Sprintf(format, v...), "", InfoLevel) - logger.output(record) - } + logger.Infof(format, v...) } // Warning ... func Warning(v ...interface{}) { - if logger.lvl <= WarningLevel { - record := NewRecord(time.Now(), fmt.Sprint(v...), "", WarningLevel) - logger.output(record) - } + logger.Warning(v...) } // Warningf ... func Warningf(format string, v ...interface{}) { - if logger.lvl <= WarningLevel { - record := NewRecord(time.Now(), fmt.Sprintf(format, v...), "", WarningLevel) - logger.output(record) - } + logger.Warningf(format, v...) } // Error ... func Error(v ...interface{}) { - if logger.lvl <= ErrorLevel { - line := line(2) - record := NewRecord(time.Now(), fmt.Sprint(v...), line, ErrorLevel) - logger.output(record) - } + logger.Error(v...) } // Errorf ... func Errorf(format string, v ...interface{}) { - if logger.lvl <= ErrorLevel { - line := line(2) - record := NewRecord(time.Now(), fmt.Sprintf(format, v...), line, ErrorLevel) - logger.output(record) - } + logger.Errorf(format, v...) } // Fatal ... func Fatal(v ...interface{}) { - if logger.lvl <= FatalLevel { - line := line(2) - record := NewRecord(time.Now(), fmt.Sprint(v...), line, FatalLevel) - logger.output(record) - } - os.Exit(1) + logger.Fatal(v...) } // Fatalf ... func Fatalf(format string, v ...interface{}) { - if logger.lvl <= FatalLevel { - line := line(2) - record := NewRecord(time.Now(), fmt.Sprintf(format, v...), line, FatalLevel) - logger.output(record) - } - os.Exit(1) + logger.Fatalf(format, v...) } func line(calldepth int) string {