-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
44 lines (38 loc) · 775 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package main
import (
"fmt"
"os"
tea "github.com/charmbracelet/bubbletea"
"github.com/charmbracelet/lipgloss"
log "github.com/charmbracelet/log"
tui "github.com/mikemehl/dripper/tui"
)
type errMsg error
func main() {
if err := setupLogging(); err != nil {
os.Exit(1)
}
IntroLog()
log.Debug("Calling Run()")
err := tui.Run()
if err != nil {
log.Error(err)
} else {
log.Info("Exiting Dripper")
}
}
func setupLogging() error {
f, err := tea.LogToFile("dripper.log", "debug")
log.SetLevel(log.DebugLevel)
if err != nil {
fmt.Println(err)
return err
}
log.SetOutput(f)
return nil
}
func IntroLog() {
hr := lipgloss.NewStyle().Border(lipgloss.DoubleBorder(), false, false, true).Width(20)
log.Info(hr.Render())
log.Info("Starting Dripper")
}