diff --git a/formatter.go b/formatter.go index f42fe86..d6888fb 100644 --- a/formatter.go +++ b/formatter.go @@ -15,7 +15,7 @@ type simpleFormatter struct { } // Format implements log.Formatter -func (f simpleFormatter) Format(level Level, msg string, logger *Logger) []byte { +func (f *simpleFormatter) Format(level Level, msg string, logger *Logger) []byte { time := time.Now().Format("15:04:05.000") return []byte(fmt.Sprintf("%s %s %s\n", time, level.String(), msg)) } diff --git a/formatters/json_formatter.go b/formatters/json_formatter.go index ae05d4e..9f362db 100644 --- a/formatters/json_formatter.go +++ b/formatters/json_formatter.go @@ -23,7 +23,7 @@ type JSONFormatter struct { } // Format implements log.Formatter -func (f JSONFormatter) Format(level log.Level, msg string, logger *log.Logger) []byte { +func (f *JSONFormatter) Format(level log.Level, msg string, logger *log.Logger) []byte { // output fields: time level host app pid file line msg f.init.Do(func() { diff --git a/formatters/text_formatter.go b/formatters/text_formatter.go index a332f7c..33b0cb7 100644 --- a/formatters/text_formatter.go +++ b/formatters/text_formatter.go @@ -32,7 +32,7 @@ type TextFormatter struct { } // Format implements log.Formatter -func (f TextFormatter) Format(level log.Level, msg string, logger *log.Logger) []byte { +func (f *TextFormatter) Format(level log.Level, msg string, logger *log.Logger) []byte { // output format: DATE LEVEL HOST APP PID file:line message // 2001-10-10T12:00:00,000+0800 INFO web-1 app 1234 main/main.go:1234 message ...