...
1 package clog
2
3 import (
4 "errors"
5 "os"
6 )
7
8 var errSome = errors.New("some error")
9
10 func ExampleNew() {
11 log := New(To(os.Stdout))
12 log.Info("info message with default options")
13 log.Error(errSome, "error message with default options")
14 log.Info("invalid key", 42, "answer")
15 log.Info("missing value", "answer")
16 log.Info("logging some maps",
17 "map1", map[string]string{"key": "value", "op": "delete"},
18 "map2", map[string]string{"feeling": "less than map1", "key": "value"},
19 )
20 log.WithName("cli").WithName("subcommand").Info("coming from the deep", "kubectx", "ci-infra")
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35 }
36
37 func ExampleNew_withCaller() {
38
39 log := New(To(os.Stdout), WithCaller(All))
40 log.WithName("hello").WithName("world").Info("thanks for the fish")
41
42
43 }
44
View as plain text