feat: added logging and some routes with fmt

This commit is contained in:
Cereska
2026-02-18 12:40:10 -05:00
parent 150f95ee0b
commit 9a0e8d46c8
21 changed files with 204 additions and 123 deletions

View File

@@ -1,15 +1,15 @@
package middleware
import (
"time"
// "time"
"github.com/charmbracelet/log"
// "github.com/charmbracelet/log"
"github.com/labstack/echo/v5"
)
func ServerHandler(next echo.HandlerFunc) echo.HandlerFunc {
return func(c *echo.Context) error {
start := time.Now()
// start := time.Now()
// Process the request
err := next(c)
@@ -17,16 +17,16 @@ func ServerHandler(next echo.HandlerFunc) echo.HandlerFunc {
c.Logger().Error(err.Error())
}
stop := time.Now()
req := c.Request()
// stop := time.Now()
// req := c.Request()
// Log using charmbracelet
log.Info("Request handled",
"method", req.Method,
"path", req.URL.Path,
"latency", stop.Sub(start),
"ip", c.RealIP(),
)
// // Log using charmbracelet
// log.Info("Request handlers",
// "method", req.Method,
// "path", req.URL.Path,
// "latency", stop.Sub(start),
// "ip", c.RealIP(),
// )
return nil
}