2
0
mirror of https://github.com/miguelmota/cointop synced 2024-11-14 18:12:57 +00:00

Log debug output file if DEBUG set

This commit is contained in:
Miguel Mota 2021-11-22 18:53:22 -08:00
parent 6d671b28ae
commit 60de82342d
No known key found for this signature in database
GPG Key ID: 67EC1161588A00F9

View File

@ -20,9 +20,6 @@ func (ct *Cointop) setLogOutputFile() {
debugFile := os.Getenv("DEBUG_FILE")
if debugFile != "" {
filename = pathutil.NormalizePath(debugFile)
if filename != debugFile && os.Getenv("DEBUG") != "" {
fmt.Printf("Writing debug log to %s\n", filename)
}
}
f, err := os.OpenFile(filename, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0600)
if err != nil {
@ -30,4 +27,5 @@ func (ct *Cointop) setLogOutputFile() {
}
log.SetOutput(f)
ct.logfile = f
fmt.Printf("Writing debug log to %s\n", filename)
}