added log defaults

main
Keegan 2 years ago
parent 2f84351945
commit 1195768523

3
.gitignore vendored

@ -18,6 +18,7 @@
# binaries
bin/*
*.tar.gz
# logs
*.log

@ -5,3 +5,4 @@ env GOOS=linux GOARCH=arm GOARM=7 go build -o bin/tui_linux_arm cmd/tui/main.go
env GOOS=linux GOARCH=amd64 go build -o bin/tui_linux_amd64 cmd/tui/main.go
env GOOS=linux GOARCH=amd64 go build -o bin/server_linux_amd64 cmd/server/main.go
tar -czf bins.tar.gz bin/reactor_linux_arm bin/tui_linux_amd64 bin/server_linux_amd64

@ -37,15 +37,17 @@ var debugStart time.Time
var debugVerbosity int
func init() {
filename := time.Now().Format("01-02T15:04:05")
filename += ".log"
f, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0664)
if err != nil {
log.Fatal(err)
}
log.SetOutput(f)
debugVerbosity = getVerbosity()
debugStart = time.Now()
if debugVerbosity > 0 {
filename := time.Now().Format("01-02T15:04:05")
filename += ".log"
f, err := os.OpenFile(filename, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0664)
if err != nil {
log.Fatal(err)
}
log.SetOutput(f)
}
log.SetFlags(log.Flags() &^ (log.Ldate | log.Ltime)) // turns off date and time so we can set manually
}

Loading…
Cancel
Save