更新 .gitignore 文件,新增对 .DS_Store、main 和 gateway 的忽略规则;在 main.go 中优化日志记录,修改请求体的日志输出为 ctx.Input.Data(),提升日志的准确性和可读性。

This commit is contained in:
danial
2025-05-05 17:44:07 +08:00
parent b6808ce241
commit 9620330c32
2 changed files with 4 additions and 1 deletions

3
.gitignore vendored
View File

@@ -7,3 +7,6 @@
.DS_Store
.DS_Store?
/gateway.exe
.DS_Store
main
gateway

View File

@@ -23,7 +23,7 @@ import (
)
func logRequest(ctx *context.Context) {
otelTrace.Logger.WithContext(otelTrace.InitCtx).Info("Request", zap.String("method", ctx.Input.Method()), zap.String("uri", ctx.Input.URI()), zap.String("ip", ctx.Input.IP()), zap.Any("params", ctx.Input.Params()), zap.Any("body", ctx.Input.RequestBody))
otelTrace.Logger.WithContext(otelTrace.InitCtx).Info("Request", zap.String("method", ctx.Input.Method()), zap.String("uri", ctx.Input.URI()), zap.String("ip", ctx.Input.IP()), zap.Any("params", ctx.Input.Params()), zap.Any("body", ctx.Input.Data()))
}
func main() {