From fcd9816b0b1ffe67dabccb6f605d7d4f4df3a1f1 Mon Sep 17 00:00:00 2001 From: yoge Date: Mon, 9 Mar 2026 22:18:13 +0800 Subject: [PATCH] refact: add log for export --- internal/service/task.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/internal/service/task.go b/internal/service/task.go index 9f3eb2b..d55f0c3 100644 --- a/internal/service/task.go +++ b/internal/service/task.go @@ -9,6 +9,7 @@ import ( "io" "net/http" "strings" + "time" "gitea.com/texpixel/document_ai/internal/model/task" "gitea.com/texpixel/document_ai/internal/storage/dao" @@ -187,8 +188,13 @@ func (svc *TaskService) ExportTask(ctx context.Context, req *task.ExportTaskRequ defer resp.Body.Close() if resp.StatusCode != http.StatusOK { - body, _ := io.ReadAll(resp.Body) - log.Error(ctx, "func", "ExportTask", "msg", "http request failed", "status", resp.StatusCode, "body", string(body)) + respBody, _ := io.ReadAll(resp.Body) + log.Error(ctx, "func", "ExportTask", "msg", "export service returned non-200", + "status", resp.StatusCode, + "body", string(respBody), + "markdown_len", len(markdown), + "filename", filename, + ) return nil, "", fmt.Errorf("export service returned status: %d", resp.StatusCode) }