Commit 04d93dd6 authored by Cloud User's avatar Cloud User

log output

parent 46de9e87
......@@ -981,7 +981,7 @@ func main() {
// baseAttributes := []slog.Attr{}
// baseAttributes = append(baseAttributes, slog.String(TaskIdAtrr, taskId))
newAttributes := append(baseAttributes, slog.Int("resAsPb.TaskResultCode", int(res.TaskResultCode)), slog.String("TaskResultHeader", string(res.TaskResultHeader)))
newAttributes := append(baseAttributes, slog.Int("resAsPb.TaskResultCode", int(res.TaskResultCode)), slog.String("TaskResultHeader", string(res.TaskResultHeader)), slog.String("TaskResultBody", string(res.TaskResultBody)))
slog.LogAttrs(c.UserContext(), slog.LevelInfo, "getAsyncRes", newAttributes...)
......@@ -1274,7 +1274,7 @@ func syncModeF(c *fiber.Ctx, taskid string) error {
baseAttributes := []slog.Attr{}
baseAttributes = append(baseAttributes, slog.String(TaskIdAtrr, taskid))
newAttributes := append(baseAttributes, slog.Int("resAsPb.TaskResultCode", int(resAsPb.TaskResultCode)), slog.String("TaskResultHeader", string(resAsPb.TaskResultHeader)))
newAttributes := append(baseAttributes, slog.Int("resAsPb.TaskResultCode", int(resAsPb.TaskResultCode)), slog.String("TaskResultHeader", string(resAsPb.TaskResultHeader)), slog.String("TaskResultBody", string(resAsPb.TaskResultBody)))
slog.LogAttrs(c.UserContext(), slog.LevelInfo, "syncModeF", newAttributes...)
......@@ -1310,16 +1310,36 @@ func syncOrAsyncReturn(c *fiber.Ctx, resAsPb pbUpstream.TaskResponse, reqTaskId
for _, v := range vs {
if k == "Content-Encoding" {
newAttributes := append(baseAttributes,
slog.String(k, v),
)
slog.LogAttrs(c.UserContext(), slog.LevelInfo, "http Content-Encoding header in body", newAttributes...)
c.Response().Header.SetContentEncoding(v)
}
if k == "Content-Type" {
newAttributes := append(baseAttributes,
slog.String(k, v),
)
slog.LogAttrs(c.UserContext(), slog.LevelInfo, "http Content-Type header in body", newAttributes...)
c.Response().Header.SetContentType(v)
}
if redirectCode {
if k == "Location" {
newAttributes := append(baseAttributes,
slog.String(k, v),
slog.Int("resAsPb.TaskResultCode", int(resAsPb.TaskResultCode)),
)
slog.LogAttrs(c.UserContext(), slog.LevelInfo, "http location header in body", newAttributes...)
c.Redirect(v, int(resAsPb.TaskResultCode))
//c.Response().Header.SetL
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment