merp/main.go

37 lines
691 B
Go
Raw Normal View History

2019-10-03 19:30:04 +00:00
//3456789112345676892123456789312345678941234567895123456789612345678971234567898
package main
import "github.com/sirupsen/logrus"
var Version string
var Buildtime string
var Builduser string
var Buildarch string
var log *logrus.Logger
func main() {
initLogging()
serve()
}
func initLogging() {
log = logrus.New()
log.SetReportCaller(true)
log.SetLevel(logrus.DebugLevel)
log.SetFormatter(UTCFormatter{&logrus.JSONFormatter{}})
}
func serve() {
server := setupHttpServer()
log.Fatal(server.ListenAndServe())
}
type UTCFormatter struct {
logrus.Formatter
}
func (u UTCFormatter) Format(e *logrus.Entry) ([]byte, error) {
e.Time = e.Time.UTC()
return u.Formatter.Format(e)
}