File tree 1 file changed +12
-1
lines changed
1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change 7
7
"sync"
8
8
9
9
tracer "github.com/ipfs/go-log/tracer"
10
+ lwriter "github.com/ipfs/go-log/writer"
10
11
11
12
colorable "github.com/mattn/go-colorable"
12
13
opentrace "github.com/opentracing/opentracing-go"
@@ -36,7 +37,8 @@ const (
36
37
envLogging = "IPFS_LOGGING"
37
38
envLoggingFmt = "IPFS_LOGGING_FMT"
38
39
39
- envLoggingFile = "GOLOG_FILE" // /path/to/file
40
+ envLoggingFile = "GOLOG_FILE" // /path/to/file
41
+ envTracingFile = "GOLOG_TRACING_FILE" // /path/to/file
40
42
)
41
43
42
44
// ErrNoSuchLogger is returned when the util pkg is asked for a non existant logger
@@ -93,6 +95,15 @@ func SetupLogging() {
93
95
opentrace .SetGlobalTracer (lgblTracer )
94
96
95
97
SetAllLoggers (lvl )
98
+
99
+ if tracingfp := os .Getenv (envTracingFile ); len (tracingfp ) > 0 {
100
+ f , err := os .Create (tracingfp )
101
+ if err != nil {
102
+ log .Error ("failed to create tracing file: %s" , tracingfp )
103
+ } else {
104
+ lwriter .WriterGroup .AddWriter (f )
105
+ }
106
+ }
96
107
}
97
108
98
109
// SetDebugLogging calls SetAllLoggers with logging.DEBUG
You can’t perform that action at this time.
0 commit comments