File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright 2025 DataRobot, Inc. and its affiliates.
2+ // All rights reserved.
3+ // DataRobot, Inc. Confidential.
4+ // This is unpublished proprietary source code of DataRobot, Inc.
5+ // and its affiliates.
6+ // The copyright notice above does not evidence any actual or intended
7+ // publication of such source code.
8+
9+ package tui
10+
11+ import (
12+ "fmt"
13+ "os"
14+
15+ tea "github.com/charmbracelet/bubbletea"
16+ )
17+
18+ // DebugLogFile is the filename for TUI debug logs
19+ const DebugLogFile = "dr-tui-debug.log"
20+
21+ // SetupDebugLogging configures debug logging for the TUI if debug mode is enabled.
22+ // It should be called at the start of TUI programs when debug logging is needed.
23+ // Returns a cleanup function that should be deferred to close the log file.
24+ func SetupDebugLogging () (cleanup func (), err error ) {
25+ f , err := tea .LogToFile (DebugLogFile , "debug" )
26+ if err != nil {
27+ fmt .Println ("fatal:" , err )
28+ os .Exit (1 )
29+ }
30+
31+ return func () { f .Close () }, nil
32+ }
You can’t perform that action at this time.
0 commit comments