The Echo integration module for Noa Log, enabling quick integration of Noa into the Echo framework.
go get -u github.com/noa-log/noa-echopackage main
import (
"net/http"
"github.com/labstack/echo/v4"
"github.com/noa-log/noa"
"github.com/noa-log/noa-echo"
)
func main() {
// Create a new logger instance
logger := noa.NewLog()
logger.Errors.CallerSkip = 4
// Create an Echo instance
e := echo.New()
// Replace the default logger with the Noa Echo logger instance
e.Logger = noaecho.New(logger)
e.GET("/", func(c echo.Context) error {
e.Logger.Info("Hello, World!")
return c.String(http.StatusOK, "Hello, World!")
})
if err := e.Start("localhost:1323"); err != nil {
panic(err)
}
}This project is open-sourced under the Apache License 2.0. Please comply with the terms when using it.