Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

diptomondal007/echozap

 
 

Repository files navigation

Echozap

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

Build Status Coverage Status Go Report Card License

Pre-requisites

Usage

package main

import (
	"net/http"

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

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

	logger, _ := zap.NewProduction()

	e.Use(echozap.ZapLogger(echozap.WrapSugared(logger.Sugar())))

	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

🤝 Contributing

Contributions, issues and feature requests are welcome!

Show your support

If this project have been useful for you, I would be grateful to have your support.

Give a ⭐️ to the project, or just:

Buy Me A Coffee

📝 License

Copyright © 2019 Dipto Mondal.

This project is MIT licensed.

About

My own customisation for zap sugared logger for echo

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 72.9%
  • Makefile 27.1%