Repository navigation
Expand file tree
/
Copy pathdebug_test.go
More file actions
113 lines (102 loc) · 1.82 KB
/
Copy pathdebug_test.go
File metadata and controls
113 lines (102 loc) · 1.82 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
package log
import (
"fmt"
"github.com/jgolang/errors"
"testing"
)
func TestDebug(t *testing.T) {
type args struct {
msg string
args []interface{}
}
tests := []struct {
name string
args args
}{
{
name: "Debug",
args: args{
msg: "HELLO",
args: []interface{}{"Debug message"},
},
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
Debug(tt.args.args...)
})
}
}
// func TestDebugf(t *testing.T) {
// type args struct {
// template string
// args []interface{}
// }
// tests := []struct {
// name string
// args args
// }{
// {
// name: "Debugf",
// args: args{
// template: "Debug message, %v",
// args: []interface{}{"\n\n\nthis complement"},
// },
// },
// }
// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
// Debugf(tt.args.template, tt.args.args...)
// })
// }
// }
// func TestWarn(t *testing.T) {
// type args struct {
// args []interface{}
// }
// tests := []struct {
// name string
// args args
// }{
// {
// name: "Warn",
// args: args{
// args: []interface{}{"This is warn message"},
// },
// },
// }
// for _, tt := range tests {
// t.Run(tt.name, func(t *testing.T) {
// Warn(tt.args.args...)
// })
// }
// }
func TestDebugTesting(t *testing.T) {
Debug("hello")
err := a()
Debug("error", "error", err)
Warn("hello")
Info("hello", "error", err)
err2 := c()
Info("hello", "error", err2)
Error("hello", "error", err2)
Error(err)
}
func a() error {
return b()
}
func b() error {
return errors.New("custom error")
}
func c() error {
return d()
}
func d() error {
return fmt.Errorf("normal error")
}
// buildInfo, _ := debug.ReadBuildInfo()
// slog.Group(
// "info",
// slog.Int("pid", os.Getpid()),
// slog.String("go_version", buildInfo.GoVersion),
// )