Messages now sending/loading and populating on message dropdown
This commit is contained in:
26
internal/http/middleware/errorlog.go
Normal file
26
internal/http/middleware/errorlog.go
Normal file
@@ -0,0 +1,26 @@
|
||||
// internal/http/middleware/errorlog.go
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"synlotto-website/internal/logging"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
func ErrorLogger() gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
start := time.Now()
|
||||
c.Next()
|
||||
|
||||
if len(c.Errors) == 0 {
|
||||
return
|
||||
}
|
||||
for _, e := range c.Errors {
|
||||
logging.Info("❌ %s %s -> %d in %v: %v",
|
||||
c.Request.Method, c.FullPath(), c.Writer.Status(),
|
||||
time.Since(start), e.Err)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user