summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoradamdottv <[email protected]>2025-05-14 07:47:15 -0500
committeradamdottv <[email protected]>2025-05-14 07:47:15 -0500
commitf7849c2d59d335c91d6ad079cabcda98c8b610f8 (patch)
treecef1c17b4f9291c6daf659375c733ed0eded6c23
parent463002185b18955583af0c8695648c2ae03fe03f (diff)
downloadopencode-f7849c2d59d335c91d6ad079cabcda98c8b610f8.tar.gz
opencode-f7849c2d59d335c91d6ad079cabcda98c8b610f8.zip
fix: log display
-rw-r--r--internal/tui/components/logs/details.go11
-rw-r--r--internal/tui/components/logs/table.go1
2 files changed, 11 insertions, 1 deletions
diff --git a/internal/tui/components/logs/details.go b/internal/tui/components/logs/details.go
index 631bb97b3..701361bb4 100644
--- a/internal/tui/components/logs/details.go
+++ b/internal/tui/components/logs/details.go
@@ -1,6 +1,8 @@
package logs
import (
+ "bytes"
+ "encoding/json"
"fmt"
"strings"
"time"
@@ -96,6 +98,15 @@ func (i *detailCmp) updateContent() {
valueStyle := lipgloss.NewStyle().Foreground(t.Text())
for key, value := range i.currentLog.Attributes {
+ // if value is JSON, render it with indentation
+ if strings.HasPrefix(value, "{") {
+ var indented bytes.Buffer
+ if err := json.Indent(&indented, []byte(value), "", " "); err != nil {
+ indented.WriteString(value)
+ }
+ value = indented.String()
+ }
+
attrLine := fmt.Sprintf("%s: %s",
keyStyle.Render(key),
valueStyle.Render(value),
diff --git a/internal/tui/components/logs/table.go b/internal/tui/components/logs/table.go
index 5632d163c..fa701adee 100644
--- a/internal/tui/components/logs/table.go
+++ b/internal/tui/components/logs/table.go
@@ -81,7 +81,6 @@ func (i *tableCmp) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
return i, i.fetchLogs()
case pubsub.Event[logging.Log]:
- // Only handle created events
if msg.Type == logging.EventLogCreated {
// Add the new log to our list
i.logs = append([]logging.Log{msg.Payload}, i.logs...)