@@ -19,8 +19,9 @@ func PanicTracer() io.Writer {
19
19
return tracer .Panic .Tracer ()
20
20
}
21
21
22
- // LogTracer returns current io.Writer for try.Out().Logf().
23
- // The default value is nil.
22
+ // LogTracer returns a current io.Writer for the explicit try.Result.Logf
23
+ // function and automatic logging used in err2.Handle and err2.Catch. The
24
+ // default value is nil.
24
25
func LogTracer () io.Writer {
25
26
return tracer .Log .Tracer ()
26
27
}
@@ -32,7 +33,7 @@ func LogTracer() io.Writer {
32
33
// func CopyFile(src, dst string) (err error) {
33
34
// defer err2.Handle(&err) // <- error trace print decision is done here
34
35
//
35
- // Remember that you can overwrite these with Flag package support. See
36
+ // Remember that you can reset these with Flag package support. See
36
37
// documentation of err2 package's flag section.
37
38
func SetErrorTracer (w io.Writer ) {
38
39
tracer .Error .SetTracer (w )
@@ -45,32 +46,35 @@ func SetErrorTracer(w io.Writer) {
45
46
// handler, e.g:
46
47
//
47
48
// func CopyFile(src, dst string) (err error) {
48
- // defer err2.Handle(&err) // <- error trace print decision is done here
49
+ // defer err2.Handle(&err) // <- panic trace print decision is done here
49
50
//
50
- // Remember that you can overwrite these with Flag package support. See
51
+ // Remember that you can reset these with Flag package support. See
51
52
// documentation of err2 package's flag section.
52
53
func SetPanicTracer (w io.Writer ) {
53
54
tracer .Panic .SetTracer (w )
54
55
}
55
56
56
- // SetLogTracer sets a io.Writer for try.Out().Logf() function. The default is
57
- // nil and then err2 uses std log package for logging.
57
+ // SetLogTracer sets a current io.Writer for the explicit try.Result.Logf
58
+ // function and automatic logging used in err2.Handle and err2.Catch. The
59
+ // default is nil and then err2 uses std log package for logging.
58
60
//
59
- // You can use that to redirect packages like glog and have proper logging. For
60
- // glog, add this line at the beginning of your app:
61
+ // You can use the std log package to redirect other logging packages like glog
62
+ // to automatically work with the err2 package. For the glog, add this line at
63
+ // the beginning of your app:
61
64
//
62
65
// glog.CopyStandardLogTo("INFO")
63
66
//
64
- // Remember that you can overwrite these with Flag package support. See
67
+ // Remember that you can reset these with Flag package support. See
65
68
// documentation of err2 package's flag section.
66
69
func SetLogTracer (w io.Writer ) {
67
70
tracer .Log .SetTracer (w )
68
71
}
69
72
70
- // SetTracers a convenient helper to set a io.Writer for error and panic stack
71
- // tracing. More information see SetErrorTracer and SetPanicTracer functions.
73
+ // SetTracers a helper to set a io.Writer for error and panic stack tracing, the
74
+ // log tracer is set as well. More information see SetErrorTracer,
75
+ // SetPanicTracer, and SetLogTracer functions.
72
76
//
73
- // Remember that you can overwrite these with Flag package support. See
77
+ // Remember that you can reset these with Flag package support. See
74
78
// documentation of err2 package's flag section.
75
79
func SetTracers (w io.Writer ) {
76
80
tracer .Error .SetTracer (w )
0 commit comments