summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAiden Cline <[email protected]>2025-07-24 07:19:00 -0500
committerGitHub <[email protected]>2025-07-24 07:19:00 -0500
commita16554d4458036b1a5affadf30fd4411696099a3 (patch)
tree9521d50592963b78fecfd38fec3ee8adb341c531
parent25531373953f1cff8ed874a5835834b7e7f284ac (diff)
downloadopencode-a16554d4458036b1a5affadf30fd4411696099a3.tar.gz
opencode-a16554d4458036b1a5affadf30fd4411696099a3.zip
fix: slog error log serialization (#1276)
-rw-r--r--packages/tui/internal/util/apilogger.go14
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/tui/internal/util/apilogger.go b/packages/tui/internal/util/apilogger.go
index 4b872597a..a58be6357 100644
--- a/packages/tui/internal/util/apilogger.go
+++ b/packages/tui/internal/util/apilogger.go
@@ -66,12 +66,22 @@ func (h *APILogHandler) Handle(ctx context.Context, r slog.Record) error {
h.mu.Lock()
for _, attr := range h.attrs {
- extra[attr.Key] = attr.Value.Any()
+ val := attr.Value.Any()
+ if err, ok := val.(error); ok {
+ extra[attr.Key] = err.Error()
+ } else {
+ extra[attr.Key] = val
+ }
}
h.mu.Unlock()
r.Attrs(func(attr slog.Attr) bool {
- extra[attr.Key] = attr.Value.Any()
+ val := attr.Value.Any()
+ if err, ok := val.(error); ok {
+ extra[attr.Key] = err.Error()
+ } else {
+ extra[attr.Key] = val
+ }
return true
})