Skip to content

Commit

Permalink
Disabled default logging
Browse files Browse the repository at this point in the history
  • Loading branch information
int3rlop3r committed Feb 19, 2022
1 parent 21d1e80 commit b9464ca
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
1 change: 0 additions & 1 deletion game.go
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,6 @@ func (g *Game) Stop() {
func (g *Game) IncrScoreAndTicker() {
g.ticker.Incr()
g.score += 50
//log.Println("changed duration to:", g.ticker.Dur())
}

func (g *Game) DisplayScore() {
Expand Down
16 changes: 9 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,21 +62,23 @@ func shutDown(stdinFd int, state *term.State, err error) {
fmt.Println(err)
}

func init() {
clearScreen(mStart)
stdinFd = int(os.Stdout.Fd())
state, initError = term.MakeRaw(stdinFd)
exitError = new(ExitError)

func enableLogging() {
// called in 'init' if required
var fErr error
f, fErr = os.OpenFile("/tmp/snake.log", os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
if fErr != nil {
log.Fatalf("error opening file: %v", fErr)
}

log.SetOutput(f)
}

func init() {
clearScreen(mStart)
stdinFd = int(os.Stdout.Fd())
state, initError = term.MakeRaw(stdinFd)
exitError = new(ExitError)
}

func processKeyPress() (chan error, chan byte) {
out := make(chan error)
keyChan := make(chan byte)
Expand Down

0 comments on commit b9464ca

Please sign in to comment.