If DEBUG is enabled and DEBUG_FILE is provided and contains path tokens, emit logfile on console

pull/236/head
Simon Roberts 3 years ago
parent 8c976d3c0f
commit d004dd4633
No known key found for this signature in database
GPG Key ID: 0F30F99E6B771FD4

@ -1,6 +1,7 @@
package cointop
import (
"fmt"
"os"
"github.com/cointop-sh/cointop/pkg/pathutil"
@ -12,6 +13,9 @@ func (ct *Cointop) initlog() {
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 {

Loading…
Cancel
Save