feat: complete OCI registry implementation with docker push/pull support
A lightweight OCI (Open Container Initiative) registry implementation written in Go.
This commit is contained in:
31
internal/middleware/logger.go
Normal file
31
internal/middleware/logger.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package middleware
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/gofiber/fiber/v3"
|
||||
)
|
||||
|
||||
// Logger 日志中间件
|
||||
func Logger() fiber.Handler {
|
||||
return func(c fiber.Ctx) error {
|
||||
start := time.Now()
|
||||
err := c.Next()
|
||||
latency := time.Since(start)
|
||||
|
||||
fmt.Printf("%s - [%s] \"%s %s %s %d %s \"%s\" %s\"\n",
|
||||
c.IP(),
|
||||
time.Now().Format(time.RFC1123),
|
||||
c.Method(),
|
||||
c.Path(),
|
||||
c.Protocol(),
|
||||
c.Response().StatusCode(),
|
||||
latency,
|
||||
c.Get("User-Agent"),
|
||||
"",
|
||||
)
|
||||
|
||||
return err
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user