feat: adding params

This commit is contained in:
Samuel Berthe
2024-01-03 20:26:15 +01:00
parent 8d42afb00b
commit 96c9813d0e
2 changed files with 7 additions and 0 deletions
+1
View File
@@ -23,6 +23,7 @@ func (w bodyWriter) Write(b []byte) (int, error) {
w.body.Write(b)
}
}
w.bytes += len(b)
return w.ResponseWriter.Write(b)
}
+6
View File
@@ -104,6 +104,11 @@ func NewWithConfig(logger *slog.Logger, config Config) gin.HandlerFunc {
path := c.Request.URL.Path
query := c.Request.URL.RawQuery
params := map[string]string{}
for _, p := range c.Params {
params[p.Key] = p.Value
}
requestID := uuid.New().String()
if config.WithRequestID {
c.Set(requestIDCtx, requestID)
@@ -138,6 +143,7 @@ func NewWithConfig(logger *slog.Logger, config Config) gin.HandlerFunc {
slog.String("host", host),
slog.String("path", path),
slog.String("query", query),
slog.Any("params", params),
slog.String("route", route),
slog.String("ip", ip),
slog.String("referer", referer),