-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
28 lines (25 loc) · 750 Bytes
/
main.go
File metadata and controls
28 lines (25 loc) · 750 Bytes
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
package main
import (
"fmt"
"log"
"github.com/vchitai/zapflatencoder"
"go.uber.org/zap"
)
func main() {
l, err := zap.Config{
Level: zap.NewAtomicLevelAt(zap.DebugLevel),
Development: false,
Encoding: zapflatencoder.EncoderName,
EncoderConfig: zapflatencoder.DefaultConfig,
OutputPaths: []string{"stderr"},
ErrorOutputPaths: []string{"stderr"},
}.Build()
if err != nil {
log.Fatal("Cannot init logger", err)
}
l.Info("Hello World")
l.Debug("Hello World")
l.Error("Hello World with error", zap.Error(fmt.Errorf("this is an error")))
l.Warn("Hello World with error", zap.Error(fmt.Errorf("this is an error")))
l.DPanic("Hello World with error", zap.Error(fmt.Errorf("this is an error")))
}