gin-contrib / Zap
Licence: mit
Alternative logging through zap
Stars: ✭ 139
Programming Languages
go
31211 projects - #10 most used programming language
Labels
Projects that are alternatives of or similar to Zap
Gin Cors
Cross Origin Resource Sharing middleware for gin-gonic
Stars: ✭ 107 (-23.02%)
Mutual labels: gin
Go Http Metrics
Go modular http middleware to measure HTTP requests independent of metrics backend (with Prometheus and OpenCensus as backend implementations) and http framework/library
Stars: ✭ 128 (-7.91%)
Mutual labels: gin
Gin Web
由gin + gorm + jwt + casbin组合实现的RBAC权限管理脚手架Golang版, 搭建完成即可快速、高效投入业务开发
Stars: ✭ 107 (-23.02%)
Mutual labels: gin
Ultimate Go
This repo contains my notes on working with Go and computer systems.
Stars: ✭ 1,530 (+1000.72%)
Mutual labels: gin
Zendea
A free, open-source, self-hosted forum software written in Go 官方QQ群:656868
Stars: ✭ 116 (-16.55%)
Mutual labels: gin
Gzip
💾 Golang gzip middleware for Gin and net/http | Golang gzip中间件,支持Gin和net/http,开箱即用同时可定制
Stars: ✭ 113 (-18.71%)
Mutual labels: gin
Ugin
UGin is an API boilerplate written in Go (Golang) with Gin Framework.
Stars: ✭ 110 (-20.86%)
Mutual labels: gin
Gin
Gin is a HTTP web framework written in Go (Golang). It features a Martini-like API with much better performance -- up to 40 times faster. If you need smashing performance, get yourself some Gin.
Stars: ✭ 53,971 (+38728.06%)
Mutual labels: gin
Golang Gin Realworld Example App
Exemplary real world application built with Golang + Gin
Stars: ✭ 1,780 (+1180.58%)
Mutual labels: gin
Gin Swagger
gin middleware to automatically generate RESTful API documentation with Swagger 2.0.
Stars: ✭ 2,001 (+1339.57%)
Mutual labels: gin
zap
Alternative logging through zap. Thanks for Pull Request from @yezooz
Usage
Start using it
Download and install it:
$ go get github.com/gin-contrib/zap
Import it in your code:
import "github.com/gin-contrib/zap"
Example
See the example.
package main
import (
"fmt"
"time"
"github.com/gin-contrib/zap"
"github.com/gin-gonic/gin"
"go.uber.org/zap"
)
func main() {
r := gin.New()
logger, _ := zap.NewProduction()
// Add a ginzap middleware, which:
// - Logs all requests, like a combined access and error log.
// - Logs to stdout.
// - RFC3339 with UTC time format.
r.Use(ginzap.Ginzap(logger, time.RFC3339, true))
// Logs all panic to error log
// - stack means whether output the stack info.
r.Use(ginzap.RecoveryWithZap(logger, true))
// Example ping request.
r.GET("/ping", func(c *gin.Context) {
c.String(200, "pong "+fmt.Sprint(time.Now().Unix()))
})
// Example when panic happen.
r.GET("/panic", func(c *gin.Context) {
panic("An unexpected error happen!")
})
// Listen and Server in 0.0.0.0:8080
r.Run(":8080")
}
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].