2017-06-22 03:22:19 +00:00
|
|
|
package main
|
2017-06-22 03:24:23 +00:00
|
|
|
|
2017-06-22 03:22:19 +00:00
|
|
|
import (
|
2017-06-25 00:43:39 +00:00
|
|
|
"github.com/ehlxr/go-utils/log"
|
|
|
|
"github.com/sirupsen/logrus"
|
2017-06-22 03:22:19 +00:00
|
|
|
)
|
|
|
|
|
2017-06-25 00:43:39 +00:00
|
|
|
func init() {
|
|
|
|
log.SetLogLevel(logrus.DebugLevel)
|
|
|
|
// log.SetLogFormatter(&logrus.JSONFormatter{TimestampFormat: "2006-01-02 15:04:05"})
|
|
|
|
// log.SetFn(false)
|
|
|
|
}
|
|
|
|
|
2017-06-22 03:24:23 +00:00
|
|
|
func main() {
|
2017-06-25 00:43:39 +00:00
|
|
|
|
|
|
|
log.Debug("debug text...")
|
|
|
|
log.Info("info text...")
|
|
|
|
log.Error("error text...")
|
|
|
|
// log.Fatal("fatal text...")
|
|
|
|
// log.Panic("panic text...")
|
|
|
|
|
|
|
|
log.DebugWithFields(log.Fields{
|
|
|
|
"id": "test",
|
|
|
|
"name": "jj",
|
|
|
|
}, "debug with fields text...")
|
|
|
|
|
|
|
|
log.InfoWithFields(log.Fields{
|
|
|
|
"id": "test",
|
|
|
|
"name": "jj",
|
|
|
|
}, "info with fields text...")
|
|
|
|
|
|
|
|
log.ErrorWithFields(log.Fields{
|
|
|
|
"id": "test",
|
|
|
|
"name": "jj",
|
|
|
|
}, "error with fields text...")
|
|
|
|
|
|
|
|
log.FatalWithFields(log.Fields{
|
|
|
|
"id": "test",
|
|
|
|
"name": "jj",
|
|
|
|
}, "fatal with fields text...")
|
|
|
|
|
|
|
|
// log.Panic(log.Fields{
|
|
|
|
// "id": "test",
|
|
|
|
// "name": "jj",
|
|
|
|
// }, "fatal with fields text...")
|
2017-06-22 03:22:19 +00:00
|
|
|
}
|