Graphics debug log: also log what is drawn, optionally to a file
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019reK4DUGYqDUjniWYJvwUW
This commit is contained in:
+16
-1
@@ -197,7 +197,22 @@ func New(cfg *config.Config) *App {
|
||||
// helps to find out why a poster is drawn wrongly in some terminal.
|
||||
func (a *App) newGraphics() *kittyGraphics {
|
||||
k := newKittyGraphics(a.writeTerminal)
|
||||
if os.Getenv("ARR_TUI_DEBUG_GFX") != "" {
|
||||
switch v := os.Getenv("ARR_TUI_DEBUG_GFX"); {
|
||||
case v == "":
|
||||
case strings.Contains(v, "/"):
|
||||
// A path: also append to that file, so the lines can be read without
|
||||
// leaving the view that shows the problem.
|
||||
f, err := os.OpenFile(v, os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0o600)
|
||||
if err != nil {
|
||||
a.logs.add(levelWarn, "ARR_TUI_DEBUG_GFX: "+err.Error())
|
||||
k.debug = func(msg string) { a.logs.add(levelInfo, msg) }
|
||||
break
|
||||
}
|
||||
k.debug = func(msg string) {
|
||||
a.logs.add(levelInfo, msg)
|
||||
fmt.Fprintf(f, "%s %s\n", time.Now().Format("15:04:05.000"), msg)
|
||||
}
|
||||
default:
|
||||
k.debug = func(msg string) { a.logs.add(levelInfo, msg) }
|
||||
}
|
||||
return k
|
||||
|
||||
Reference in New Issue
Block a user