Documentation
¶
Overview ¶
Package ginlogr provides log handling using logr package. Code structure based on ginrus package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Ginlogr ¶
func Ginlogr(logger logr.Logger, timeFormat string, utc, addToReqContext bool, withHeaders []string) gin.HandlerFunc
Ginlogr returns a gin.HandlerFunc (middleware) that logs requests using github.com/go-logr/logr.
Requests with errors are logged using logr.Error(). Requests without errors are logged using logr.Info().
It receives:
- A time package format string (e.g. time.RFC3339).
- A boolean stating whether to use UTC time zone or local.
func PanicLogr ¶
func PanicLogr(logger logr.Logger, timeFormat string, utc, stack bool, requestIdCtxKey string) gin.HandlerFunc
PanicLogr returns a gin.HandlerFunc (middleware) that logs requests and panics using uber-go/logr. All errors are logged using logr.Error(). stack means whether output the stack info. The stack info is easy to find where the error occurs but the stack info is too large. This does not consume the panic, the panic is passed up
Types ¶
This section is empty.