Log to STDOUT if running as HTTP service

This commit is contained in:
Thomas Buckley-Houston 2018-06-18 18:04:15 +08:00
parent c70083958f
commit ffbb182678

View file

@ -60,6 +60,9 @@ func Log(msg string) {
if !*isDebug {
return
}
if *IsHTTPServer {
fmt.Println(msg)
} else {
f, oErr := os.OpenFile(logfile, os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0600)
if oErr != nil {
Shutdown(oErr)
@ -70,6 +73,7 @@ func Log(msg string) {
if _, wErr := f.WriteString(msg); wErr != nil {
Shutdown(wErr)
}
}
}
func initialise() {