MCPcopy Create free account
hub / github.com/docker/model-test / LogError

Method LogError

services/request_logger.go:79–97  ·  view source on GitHub ↗

LogError logs a failed request

(testCase string, iteration int, requestParams openai.ChatCompletionNewParams, err error, baseURL string)

Source from the content-addressed store, hash-verified

77
78// LogError logs a failed request
79func (rl *RequestLogger) LogError(testCase string, iteration int, requestParams openai.ChatCompletionNewParams, err error, baseURL string) error {
80 entry := LogEntry{
81 Timestamp: time.Now().UTC().Format(time.RFC3339),
82 TestCase: testCase,
83 Iteration: iteration,
84 Request: LogRequest{
85 Method: "POST",
86 URL: fmt.Sprintf("%s/chat/completions", baseURL),
87 Body: requestParams,
88 },
89 Response: LogResponse{
90 StatusCode: 0, // Unknown status code for errors
91 Body: nil,
92 },
93 Error: err.Error(),
94 }
95
96 return rl.writeLogEntry(entry)
97}
98
99// writeLogEntry writes a log entry to the file
100func (rl *RequestLogger) writeLogEntry(entry LogEntry) error {

Callers 1

ProcessChatMessageMethod · 0.80

Calls 1

writeLogEntryMethod · 0.95

Tested by

no test coverage detected