MCPcopy Create free account
hub / github.com/codehamr/codehamr / dbgWriteMessage

Function dbgWriteMessage

internal/tui/debuglog.go:150–168  ·  view source on GitHub ↗

dbgWriteMessage records a chmctx.Message readably: content and tool calls each get a labeled section. No-op when logging is off, so callers needn't guard.

(category string, msg chmctx.Message)

Source from the content-addressed store, hash-verified

148// dbgWriteMessage records a chmctx.Message readably: content and tool calls
149// each get a labeled section. No-op when logging is off, so callers needn't guard.
150func dbgWriteMessage(category string, msg chmctx.Message) {
151 if !dbgEnabled() {
152 return
153 }
154 var b strings.Builder
155 if msg.Content != "" {
156 b.WriteString("CONTENT:\n")
157 b.WriteString(msg.Content)
158 b.WriteString("\n")
159 }
160 for _, tc := range msg.ToolCalls {
161 args, _ := json.Marshal(tc.Arguments)
162 fmt.Fprintf(&b, "TOOL_CALL %s id=%s args=%s\n", tc.Name, tc.ID, args)
163 }
164 if msg.ToolCallID != "" {
165 fmt.Fprintf(&b, "tool=%s id=%s\n", msg.ToolName, msg.ToolCallID)
166 }
167 dbgWritef(category, "%s", strings.TrimRight(b.String(), "\n"))
168}

Callers 2

updateMethod · 0.85
applyDoneMethod · 0.85

Calls 3

dbgEnabledFunction · 0.85
dbgWritefFunction · 0.85
StringMethod · 0.80

Tested by

no test coverage detected