Documentation
¶
Overview ¶
Package ginlion defines functionality to integrate lion with gin.
https://github.com/gin-gonic/gin
Full typical use:
import ( "go.pedge.io/lion/env" "go.pedge.io/lion/gin" ) func setupGin() error { if err := envlion.Setup(); err != nil { return err } engine := ginlion.Default() ... }
Some of the code here is copied from the gin repository. This code is under the MIT License that can be found at https://github.com/gin-gonic/gin/blob/master/LICENSE.
Index ¶
- func Default() *gin.Engine
- func GlobalLoggerAndRecovery() gin.HandlerFunc
- func LoggerAndRecovery(protoLoggerProvider func() protolion.Logger) gin.HandlerFunc
- type Call
- func (*Call) Descriptor() ([]byte, []int)
- func (m *Call) GetClientIp() string
- func (m *Call) GetDuration() string
- func (m *Call) GetError() []string
- func (m *Call) GetMethod() string
- func (m *Call) GetPath() string
- func (m *Call) GetQuery() map[string]string
- func (m *Call) GetRequestForm() map[string]string
- func (m *Call) GetStatusCode() uint32
- func (m *Call) GetUserAgent() string
- func (*Call) ProtoMessage()
- func (m *Call) Reset()
- func (m *Call) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GlobalLoggerAndRecovery ¶
func GlobalLoggerAndRecovery() gin.HandlerFunc
GlobalLoggerAndRecovery returns LoggerAndRecovery on the global proto Logger.
func LoggerAndRecovery ¶
func LoggerAndRecovery(protoLoggerProvider func() protolion.Logger) gin.HandlerFunc
LoggerAndRecovery is the equivalent of both gin's Logger and Recovery middlewares.
Types ¶
type Call ¶
type Call struct { Method string `protobuf:"bytes,1,opt,name=method" json:"method,omitempty"` Path string `protobuf:"bytes,2,opt,name=path" json:"path,omitempty"` Query map[string]string `` /* 130-byte string literal not displayed */ UserAgent string `protobuf:"bytes,4,opt,name=user_agent,json=userAgent" json:"user_agent,omitempty"` RequestForm map[string]string `` /* 161-byte string literal not displayed */ ClientIp string `protobuf:"bytes,6,opt,name=client_ip,json=clientIp" json:"client_ip,omitempty"` StatusCode uint32 `protobuf:"varint,7,opt,name=status_code,json=statusCode" json:"status_code,omitempty"` Duration string `protobuf:"bytes,8,opt,name=duration" json:"duration,omitempty"` Error []string `protobuf:"bytes,9,rep,name=error" json:"error,omitempty"` }
Click to show internal directories.
Click to hide internal directories.