Skip to content
This repository has been archived by the owner on Sep 14, 2024. It is now read-only.
/ echozap Public archive

zap logger interface for use with echo http server

License

Notifications You must be signed in to change notification settings

theopenlane/echozap

Quality Gate Status Build status

echo zap

Middleware for Golang Echo framework that provides integration with Uber´s Zap logging library for logging HTTP requests

Usage

package main

import (
	"net/http"

	"github.com/theopenlane/echozap"
	"github.com/labstack/echo/v4"
	"go.uber.org/zap"
)

func main() {
	e := echo.New()

	zapLogger, _ := zap.NewProduction()

	e.Use(echozap.ZapLogger(zapLogger))

	e.GET("/", func(c echo.Context) error {
		return c.String(http.StatusOK, "Hello, World!")
	})
	e.Logger.Fatal(e.Start(":1323"))
}

Logged details

The following information is logged:

  • Status Code
  • Time
  • URI
  • Method
  • Hostname
  • Remote IP Address

About

zap logger interface for use with echo http server

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages