Updated transaction routers, removed receipts router

This commit is contained in:
2026-05-09 12:04:20 +03:00
parent 2dc8ff01b7
commit a57f918d23
22 changed files with 1376 additions and 752 deletions
+44
View File
@@ -0,0 +1,44 @@
package api
import (
"log"
"time"
"github.com/gin-gonic/gin"
)
func requestLoggingMiddleware() gin.HandlerFunc {
return func(c *gin.Context) {
startedAt := time.Now()
log.Printf(
"request started: method=%s path=%s query=%s client_ip=%s",
c.Request.Method,
c.Request.URL.Path,
c.Request.URL.RawQuery,
c.ClientIP(),
)
c.Next()
finishedAt := time.Since(startedAt)
if len(c.Errors) > 0 {
log.Printf(
"request finished with errors: method=%s path=%s status=%d latency=%s errors=%s",
c.Request.Method,
c.Request.URL.Path,
c.Writer.Status(),
finishedAt,
c.Errors.String(),
)
return
}
log.Printf(
"request finished: method=%s path=%s status=%d latency=%s",
c.Request.Method,
c.Request.URL.Path,
c.Writer.Status(),
finishedAt,
)
}
}