19 lines
267 B
Go
19 lines
267 B
Go
package logging
|
|
|
|
import (
|
|
"fmt"
|
|
tea "github.com/charmbracelet/bubbletea"
|
|
"os"
|
|
)
|
|
|
|
func EnableLogging() (closeFn func()) {
|
|
f, err := tea.LogToFile("debug.log", "debug")
|
|
if err != nil {
|
|
fmt.Println("fatal:", err)
|
|
os.Exit(1)
|
|
}
|
|
return func() {
|
|
f.Close()
|
|
}
|
|
}
|