-
-
Notifications
You must be signed in to change notification settings - Fork 20
/
custom.go
60 lines (44 loc) · 893 Bytes
/
custom.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package main
import (
"errors"
"github.com/sirupsen/logrus"
"github.com/snwfdhmp/errlog"
)
var (
debug = errlog.NewLogger(&errlog.Config{
PrintFunc: logrus.Errorf,
LinesBefore: 6,
LinesAfter: 3,
PrintError: true,
PrintSource: true,
PrintStack: false,
ExitOnDebugSuccess: true,
})
)
func main() {
logrus.Print("Start of the program")
wrapingFunc()
logrus.Print("End of the program")
}
func wrapingFunc() {
someBigFunction()
}
func someBigFunction() {
someDumbFunction()
someSmallFunction()
someDumbFunction()
if err := someNastyFunction(); debug.Debug(err) {
return
}
someSmallFunction()
someDumbFunction()
}
func someSmallFunction() {
logrus.Print("I do things !")
}
func someNastyFunction() error {
return errors.New("I'm failing for no reason")
}
func someDumbFunction() bool {
return false
}