A GoFiber middleware for Charmlog logger.
- Fiber: https://github.com/gofiber/fiber
- charmbracelet/log: https://github.com/charmbracelet/log
package main
import (
"github.com/gofiber/fiber/v2"
"github.com/charmbracelet/log"
"github.com/zcubbs/charmlogfiber"
"os"
)
func main() {
app := fiber.New()
logger := log.New(os.Stderr)
// Create a new logger
fiberLogger := charmlogfiber.New(logger)
// Use the logger in the Fiber app
app.Use(fiberLogger)
app.Get("/", func(c *fiber.Ctx) error {
// Log a message
logger.Info("Hello, World!")
return c.SendString("Hello, World!")
})
app.Listen(":3000")
}