Skip to content

Commit

Permalink
starting logging sooner
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Collins <[email protected]>
  • Loading branch information
clcollins committed Dec 6, 2023
1 parent c072dc4 commit 201f12d
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ to be a full-featured PagerDuty client, or kitchen sink,
but rather a simple tool to make on-call tasks easier.`,

Run: func(cmd *cobra.Command, args []string) {
f, err := tea.LogToFile("debug.log", "debug")
if err != nil {
fmt.Println("fatal:", err)
os.Exit(1)
}
defer f.Close()

if debug {
for k, v := range viper.GetViper().AllSettings() {
if k == "token" {
Expand All @@ -74,13 +81,7 @@ but rather a simple tool to make on-call tasks easier.`,
}
}

f, err := tea.LogToFile("debug.log", "debug")
m, _ := tui.InitialModel(token, teams, silentuser, ignoredusers, editor)
if err != nil {
fmt.Println("fatal:", err)
os.Exit(1)
}
defer f.Close()

p := tea.NewProgram(m, tea.WithAltScreen())
_, err = p.Run()
Expand Down

0 comments on commit 201f12d

Please sign in to comment.