forked from caarlos0/log
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
26 lines (23 loc) · 755 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
package main
import (
"errors"
"github.com/caarlos0/log"
)
func main() {
log.SetLevel(log.DebugLevel)
log.WithField("foo", "bar").Debug("debug")
log.WithField("foo", "bar").Info("info")
log.WithField("foo", "bar").Warn("warn")
log.WithFields(log.Fields{
"multiple": "fields",
"yes": true,
}).Info("a longer line in this particular log")
log.IncreasePadding()
log.WithField("foo", "bar").Info("info with increased padding")
log.IncreasePadding()
log.WithoutPadding().WithField("foo", "bar").Info("info without padding")
log.WithField("foo", "bar").Info("info with a more increased padding")
log.ResetPadding()
log.WithError(errors.New("some error")).Error("error")
log.WithError(errors.New("some fatal error")).Fatal("fatal")
}