1 parent
5d393da572
commit
47620fa680
11 files changed
+38
-15
No files matched your search
@@ -4,6 +4,7 @@ import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"net"
|
||||
"os"
|
||||
@@ -25,12 +26,16 @@ func run() {
|
||||
screen.EnableMouse()
|
||||
}
|
||||
|
||||
f, err := os.OpenFile(gLogPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
if gLogPath != "" {
|
||||
f, err := os.OpenFile(gLogPath, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0600)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer f.Close()
|
||||
log.SetOutput(f)
|
||||
} else {
|
||||
log.SetOutput(ioutil.Discard)
|
||||
}
|
||||
defer f.Close()
|
||||
log.SetOutput(f)
|
||||
|
||||
log.Print("hi!")
|
||||
|
||||
|
||||
Reference in new issue
Block a user