Documentation
¶
Index ¶
- func DisableConsoleColor()
- func ErrorLogger() gin.HandlerFunc
- func ErrorLoggerT(typ gin.ErrorType) gin.HandlerFunc
- func ForceConsoleColor()
- func Logger(conf ...LoggerConfig) gin.HandlerFunc
- func LoggerWithConfig(conf LoggerConfig) gin.HandlerFunc
- func LoggerWithFormatter(f LogFormatter) gin.HandlerFunc
- func LoggerWithWriter(out io.Writer, notlogged ...string) gin.HandlerFunc
- func Recovery() gin.HandlerFunc
- func RecoveryWithWriter(out io.Writer) gin.HandlerFunc
- type CustomResponseWriter
- type LogFormatter
- type LogFormatterParams
- type LoggerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableConsoleColor ¶
func DisableConsoleColor()
func ErrorLogger ¶
func ErrorLogger() gin.HandlerFunc
func ErrorLoggerT ¶
func ErrorLoggerT(typ gin.ErrorType) gin.HandlerFunc
func ForceConsoleColor ¶
func ForceConsoleColor()
func Logger ¶
func Logger(conf ...LoggerConfig) gin.HandlerFunc
func LoggerWithConfig ¶
func LoggerWithConfig(conf LoggerConfig) gin.HandlerFunc
func LoggerWithFormatter ¶
func LoggerWithFormatter(f LogFormatter) gin.HandlerFunc
func LoggerWithWriter ¶
func LoggerWithWriter(out io.Writer, notlogged ...string) gin.HandlerFunc
func Recovery ¶
func Recovery() gin.HandlerFunc
func RecoveryWithWriter ¶
func RecoveryWithWriter(out io.Writer) gin.HandlerFunc
Types ¶
type CustomResponseWriter ¶
type CustomResponseWriter struct {
gin.ResponseWriter
// contains filtered or unexported fields
}
func (CustomResponseWriter) Unwrap ¶
func (w CustomResponseWriter) Unwrap() http.ResponseWriter
func (CustomResponseWriter) WriteString ¶
func (w CustomResponseWriter) WriteString(s string) (int, error)
type LogFormatter ¶
type LogFormatter func(params LogFormatterParams) string
type LogFormatterParams ¶
type LogFormatterParams struct {
Request *http.Request
TimeStamp time.Time
StatusCode int
Latency time.Duration
ClientIP string
Method string
Path string
ErrorMessage string
BodySize int
Keys map[string]interface{}
// contains filtered or unexported fields
}
func (*LogFormatterParams) IsOutputColor ¶
func (p *LogFormatterParams) IsOutputColor() bool
func (*LogFormatterParams) MethodColor ¶
func (p *LogFormatterParams) MethodColor() string
func (*LogFormatterParams) ResetColor ¶
func (p *LogFormatterParams) ResetColor() string
func (*LogFormatterParams) StatusCodeColor ¶
func (p *LogFormatterParams) StatusCodeColor() string
type LoggerConfig ¶
type LoggerConfig struct {
Formatter LogFormatter
Output io.Writer
PrintAccessLog func() bool
PrintBodyPaths func() map[string]struct{}
SkipPaths []string
}
func (*LoggerConfig) ContainsPath ¶
func (c *LoggerConfig) ContainsPath(path string) bool
Click to show internal directories.
Click to hide internal directories.