mirror of
https://github.com/haiwen/seafile-server.git
synced 2025-06-27 23:46:48 +00:00
20 lines
408 B
Go
20 lines
408 B
Go
|
package main
|
||
|
|
||
|
import (
|
||
|
log "github.com/sirupsen/logrus"
|
||
|
)
|
||
|
|
||
|
const (
|
||
|
timestampFormat = "2006/01/02 15:04:05 "
|
||
|
)
|
||
|
|
||
|
type LogFormatter struct{}
|
||
|
|
||
|
func (f *LogFormatter) Format(entry *log.Entry) ([]byte, error) {
|
||
|
buf := make([]byte, 0, len(timestampFormat)+len(entry.Message)+1)
|
||
|
buf = entry.Time.AppendFormat(buf, timestampFormat)
|
||
|
buf = append(buf, entry.Message...)
|
||
|
buf = append(buf, '\n')
|
||
|
return buf, nil
|
||
|
}
|