-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (34 loc) · 932 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"os"
"github.com/apex/log"
"github.com/sqrthree/debugfmt"
)
func main() {
log.SetLevel(log.DebugLevel)
log.SetHandler(debugfmt.New(os.Stdout))
log.Debug("start")
log.Info("start")
log.Warn("start")
log.Error("start")
log.WithField("address", "http://localhost:3000").Debug("listening")
log.WithField("address", "http://localhost:3000").Info("listening")
log.WithField("address", "http://localhost:3000").Warn("listening")
log.WithField("address", "http://localhost:3000").Error("listening")
log.WithFields(log.Fields{
"user": "foo",
"file": "bar.png",
"type": "image/png",
}).Info("upload")
log.WithFields(log.Fields{
"user": "foo",
"file": "bar.png",
"type": "image/png",
}).Warn("upload")
log.WithFields(log.Fields{
"user": "foo",
"file": "bar.png",
"type": "image/png",
}).Error("upload")
log.WithField("address", "http://localhost:3000").Fatal("listening")
}