You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
461 B
Go
21 lines
461 B
Go
7 years ago
|
package log
|
||
|
|
||
|
import (
|
||
|
"fmt"
|
||
|
"time"
|
||
|
)
|
||
|
|
||
|
// Formatter is a interface used to implement a custom Formatter
|
||
|
type Formatter interface {
|
||
|
Format(level Level, msg string, logger *Logger) []byte
|
||
|
}
|
||
|
|
||
|
// simpleFormatter is default formmatter
|
||
|
type simpleFormatter struct {
|
||
|
}
|
||
|
|
||
|
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))
|
||
|
}
|