MCPcopy Create free account
hub / github.com/github/gh-aw / findAgentStdioLogPath

Function findAgentStdioLogPath

pkg/cli/audit_expanded.go:192–213  ·  view source on GitHub ↗
(logsPath string)

Source from the content-addressed store, hash-verified

190}
191
192func findAgentStdioLogPath(logsPath string) string {
193 root := filepath.Join(logsPath, "agent-stdio.log")
194 if fileutil.FileExists(root) {
195 return root
196 }
197
198 var found string
199 walkErr := filepath.Walk(logsPath, func(path string, info os.FileInfo, err error) error {
200 if err != nil || info == nil || info.IsDir() {
201 return nil
202 }
203 if info.Name() == "agent-stdio.log" {
204 found = path
205 return filepath.SkipAll
206 }
207 return nil
208 })
209 if walkErr != nil && !errors.Is(walkErr, filepath.SkipAll) {
210 auditExpandedLog.Printf("Failed while searching for agent-stdio.log in %s: %v", logsPath, walkErr)
211 }
212 return found
213}
214
215func hasUsefulFallbackMetrics(metrics LogMetrics) bool {
216 return metrics.TokenUsage > 0 || metrics.Turns > 0 || len(metrics.ToolCalls) > 0

Callers 1

inferFallbackLogMetricsFunction · 0.85

Calls 2

FileExistsFunction · 0.92
PrintfMethod · 0.45

Tested by

no test coverage detected