Skip to content

Commit

Permalink
Merge pull request #12 from ZeusWPI/log
Browse files Browse the repository at this point in the history
Use file logging
  • Loading branch information
Topvennie authored Aug 11, 2024
2 parents 27ecb4e + a48a4e7 commit 68fa0ce
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@ tmp.go

config.yaml

# Binary
scc
# Log file
scc.log
10 changes: 10 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
package main

import (
"log"
"os"
"scc/api"
"scc/screen"
)

func main() {
// Logging
logFile, err := os.OpenFile("scc.log", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
log.Fatalf("Error: Failed to open log file: %s", err)
}
log.SetOutput(logFile)
log.SetFlags(log.LstdFlags | log.Lshortfile)

// Data holder for the screen
screenApp := screen.NewScreenApp()

Expand Down

0 comments on commit 68fa0ce

Please sign in to comment.