Documentation
¶
Index ¶
Constants ¶
View Source
const HeaderRequestID = "X-Request-Id"
View Source
const Prefix = "/api/v1"
Variables ¶
This section is empty.
Functions ¶
func LoggerMiddleware ¶
func LoggerMiddleware(logger logrus.FieldLogger, now func() time.Time, timeFormat string, utc bool) gin.HandlerFunc
LoggerMiddleware returns a gin.HandlerFunc (middleware) that logs requests using logrus.
Requests with errors are logged using logrus.Error(). Requests without errors are logged using logrus.Info().
It receives:
- A time package format string (e.g. time.RFC3339).
- A boolean stating whether to use UTC time zone or local.
Types ¶
type HTTPErrorResponse ¶
type HTTPErrorResponse struct { Code int `json:"code"` Message string `json:"message"` Details interface{} `json:"details,omitempty"` }
func (*HTTPErrorResponse) Error ¶
func (er *HTTPErrorResponse) Error() string
Click to show internal directories.
Click to hide internal directories.