@@ -6,75 +6,75 @@ import (
6
6
"github.com/lainio/err2/internal/tracer"
7
7
)
8
8
9
- // ErrorTracer returns current io.Writer for automatic error stack tracing.
9
+ // ErrorTracer returns current [ io.Writer] for automatic error stack tracing.
10
10
// The default value is nil.
11
11
func ErrorTracer () io.Writer {
12
12
return tracer .Error .Tracer ()
13
13
}
14
14
15
- // PanicTracer returns current io.Writer for automatic panic stack tracing. Note
16
- // that runtime.Error types which are transported by panics are controlled by
17
- // this. The default value is os.Stderr.
15
+ // PanicTracer returns current [ io.Writer] for automatic panic stack tracing. Note
16
+ // that [ runtime.Error] types which are transported by panics are controlled by
17
+ // this. The default value is [ os.Stderr] .
18
18
func PanicTracer () io.Writer {
19
19
return tracer .Panic .Tracer ()
20
20
}
21
21
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
22
+ // LogTracer returns a current [ io.Writer] for the explicit [ try.Result.Logf]
23
+ // function and automatic logging used in [ Handle] and [ Catch] . The
24
24
// default value is nil.
25
25
func LogTracer () io.Writer {
26
26
return tracer .Log .Tracer ()
27
27
}
28
28
29
- // SetErrorTracer sets a io.Writer for automatic error stack tracing. The err2
29
+ // SetErrorTracer sets a [ io.Writer] for automatic error stack tracing. The err2
30
30
// default is nil. Note that the current function is capable to print error
31
31
// stack trace when the function has at least one deferred error handler, e.g:
32
32
//
33
33
// func CopyFile(src, dst string) (err error) {
34
34
// defer err2.Handle(&err) // <- error trace print decision is done here
35
35
//
36
- // Remember that you can reset these with Flag package support. See
36
+ // Remember that you can reset these with [flag] package support. See
37
37
// documentation of err2 package's flag section.
38
38
func SetErrorTracer (w io.Writer ) {
39
39
tracer .Error .SetTracer (w )
40
40
}
41
41
42
- // SetPanicTracer sets a io.Writer for automatic panic stack tracing. The err2
43
- // default is os.Stderr. Note that runtime.Error types which are transported by
42
+ // SetPanicTracer sets a [ io.Writer] for automatic panic stack tracing. The err2
43
+ // default is [ os.Stderr] . Note that [ runtime.Error] types which are transported by
44
44
// panics are controlled by this. Note also that the current function is capable
45
45
// to print panic stack trace when the function has at least one deferred error
46
46
// handler, e.g:
47
47
//
48
48
// func CopyFile(src, dst string) (err error) {
49
49
// defer err2.Handle(&err) // <- panic trace print decision is done here
50
50
//
51
- // Remember that you can reset these with Flag package support. See
51
+ // Remember that you can reset these with [flag] package support. See
52
52
// documentation of err2 package's flag section.
53
53
func SetPanicTracer (w io.Writer ) {
54
54
tracer .Panic .SetTracer (w )
55
55
}
56
56
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
57
+ // SetLogTracer sets a current [ io.Writer] for the explicit [ try.Result.Logf]
58
+ // function and automatic logging used in [ Handle] and [ Catch] . The
59
59
// default is nil and then err2 uses std log package for logging.
60
60
//
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
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
63
// the beginning of your app:
64
64
//
65
65
// glog.CopyStandardLogTo("INFO")
66
66
//
67
- // Remember that you can reset these with Flag package support. See
67
+ // Remember that you can reset these with [flag] package support. See
68
68
// documentation of err2 package's flag section.
69
69
func SetLogTracer (w io.Writer ) {
70
70
tracer .Log .SetTracer (w )
71
71
}
72
72
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.
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.
76
76
//
77
- // Remember that you can reset these with Flag package support. See
77
+ // Remember that you can reset these with [flag] package support. See
78
78
// documentation of err2 package's flag section.
79
79
func SetTracers (w io.Writer ) {
80
80
tracer .Error .SetTracer (w )
0 commit comments