Skip to content

Commit

Permalink
Log to file when debugging is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
NamelessOne91 committed Jul 10, 2024
1 parent 9999690 commit 1b1defe
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/bisturi/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@ package main

import (
"log"
"os"

models "github.com/NamelessOne91/bisturi/tui/models"
tea "github.com/charmbracelet/bubbletea"
)

func main() {
if len(os.Getenv("BISTURI_DEBUG")) > 0 {
f, err := tea.LogToFile("bisturi_debug.log", "debug")
if err != nil {
log.Fatal("Failed to setup logging:", err)
}
defer f.Close()
}

p := tea.NewProgram(models.NewBisturiModel(), tea.WithAltScreen())
if _, err := p.Run(); err != nil {
log.Fatal("Error running program:", err)
Expand Down

0 comments on commit 1b1defe

Please sign in to comment.