Skip to content

Commit 1b1defe

Browse files
committed
Log to file when debugging is enabled
1 parent 9999690 commit 1b1defe

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmd/bisturi/main.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,21 @@ package main
22

33
import (
44
"log"
5+
"os"
56

67
models "github.com/NamelessOne91/bisturi/tui/models"
78
tea "github.com/charmbracelet/bubbletea"
89
)
910

1011
func main() {
12+
if len(os.Getenv("BISTURI_DEBUG")) > 0 {
13+
f, err := tea.LogToFile("bisturi_debug.log", "debug")
14+
if err != nil {
15+
log.Fatal("Failed to setup logging:", err)
16+
}
17+
defer f.Close()
18+
}
19+
1120
p := tea.NewProgram(models.NewBisturiModel(), tea.WithAltScreen())
1221
if _, err := p.Run(); err != nil {
1322
log.Fatal("Error running program:", err)

0 commit comments

Comments
 (0)