Skip to content
Myr

Add logging option in simple example

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Rocha · committed by Christian Rocha · parent b720091 · Browse files · 1 file+9 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+9 added−0 removed

  • other:+9 added−0 removed

1 file+9 added−0 removed

modified:examples/simple/main.go+9 added
3 unmodified lines
45import (6 "fmt"7 "log"8 "os"9 "time"1011 tea "github.com/charmbracelet/bubbletea"12)
7 unmodified lines
20// particular one indicates that the timer has ticked.21type tickMsg time.Time2223func main() {24 // Log to a file. Useful in debugging. Not required.25 logfilePath := os.Getenv("TEA_LOG")26 if logfilePath != "" {27 if _, err := tea.LogToFile(logfilePath, "simple"); err != nil {28 log.Fatal(err)29 }30 }3132 // Initialize our program33 p := tea.NewProgram(initialize, update, view)34 if err := p.Start(); err != nil {35 log.Fatal(err)
38 unmodified lines