Skip to content

Commit ff0f65c

Browse files
committed
SetLogTrace docs: setting affects to all logging supporting function
1 parent 1b8c72d commit ff0f65c

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

tracer.go

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,9 @@ func PanicTracer() io.Writer {
1919
return tracer.Panic.Tracer()
2020
}
2121

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.
2425
func LogTracer() io.Writer {
2526
return tracer.Log.Tracer()
2627
}
@@ -32,7 +33,7 @@ func LogTracer() io.Writer {
3233
// func CopyFile(src, dst string) (err error) {
3334
// defer err2.Handle(&err) // <- error trace print decision is done here
3435
//
35-
// Remember that you can overwrite these with Flag package support. See
36+
// Remember that you can reset these with Flag package support. See
3637
// documentation of err2 package's flag section.
3738
func SetErrorTracer(w io.Writer) {
3839
tracer.Error.SetTracer(w)
@@ -45,32 +46,35 @@ func SetErrorTracer(w io.Writer) {
4546
// handler, e.g:
4647
//
4748
// 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
4950
//
50-
// Remember that you can overwrite these with Flag package support. See
51+
// Remember that you can reset these with Flag package support. See
5152
// documentation of err2 package's flag section.
5253
func SetPanicTracer(w io.Writer) {
5354
tracer.Panic.SetTracer(w)
5455
}
5556

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.
5860
//
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:
6164
//
6265
// glog.CopyStandardLogTo("INFO")
6366
//
64-
// Remember that you can overwrite these with Flag package support. See
67+
// Remember that you can reset these with Flag package support. See
6568
// documentation of err2 package's flag section.
6669
func SetLogTracer(w io.Writer) {
6770
tracer.Log.SetTracer(w)
6871
}
6972

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.
7276
//
73-
// Remember that you can overwrite these with Flag package support. See
77+
// Remember that you can reset these with Flag package support. See
7478
// documentation of err2 package's flag section.
7579
func SetTracers(w io.Writer) {
7680
tracer.Error.SetTracer(w)

0 commit comments

Comments
 (0)