更新 .gitignore 文件,新增对 .DS_Store、main 和 gateway 的忽略规则;在 main.go 中优化日志记录,修改请求体的日志输出为 ctx.Input.Data(),提升日志的准确性和可读性。
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -7,3 +7,6 @@
|
||||
.DS_Store
|
||||
.DS_Store?
|
||||
/gateway.exe
|
||||
.DS_Store
|
||||
main
|
||||
gateway
|
||||
|
||||
2
main.go
2
main.go
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user