Documentation ¶
Index ¶
- Constants
- func CopyRequestTrace(sourceRequest *rest.Request, destinationRequest *http.Request) error
- func GetRequestLogger(request *rest.Request) log.Logger
- func GetRequestTraceRequest(request *rest.Request) string
- func GetRequestTraceSession(request *rest.Request) string
- func QuoteIfString(interfaceValue interface{}) interface{}
- type AccessLogMiddleware
- type Context
- type Error
- type Errors
- type JSONResponse
- type LoggerMiddleware
- type Meta
- type RecoverMiddleware
- type Source
- type Standard
- func (s *Standard) Logger() log.Logger
- func (s *Standard) Request() *rest.Request
- func (s *Standard) RespondWithError(err *Error)
- func (s *Standard) RespondWithInternalServerFailure(message string, failure ...interface{})
- func (s *Standard) RespondWithStatusAndErrors(statusCode int, errors []*Error)
- func (s *Standard) Response() rest.ResponseWriter
- type Trace
- type TraceMiddleware
Constants ¶
View Source
const ( LogErrors = "errors" LogMethod = "method" LogProto = "proto" LogRefererer = "referrer" LogRemoteAddress = "remote-address" LogRemoteUser = "remote-user" LogRequestURI = "request-uri" LogResponseBytes = "response-bytes" LogResponseDuration = "response-duration" LogStartTime = "start-time" LogStatusCode = "status-code" LogUserAgent = "user-agent" RequestEnvBytesWritten = "BYTE_WRITTEN" RequestEnvElapsedTime = "ELAPSED_TIME" RequestEnvErrors = "ERRORS" RequestEnvRemoteUser = "REMOTE_USER" RequestEnvStartTime = "START_TIME" RequestEnvStatusCode = "STATUS_CODE" )
View Source
const ( HTTPHeaderTraceRequest = "X-Tidepool-Trace-Request" HTTPHeaderTraceSession = "X-Tidepool-Trace-Session" LogTraceRequest = "trace-request" LogTraceSession = "trace-session" RequestEnvTraceRequest = "trace-request" RequestEnvTraceSession = "trace-session" TraceSessionMaximumLength = 64 )
View Source
const (
RequestEnvLogger = "logger"
)
Variables ¶
This section is empty.
Functions ¶
func CopyRequestTrace ¶
func GetRequestTraceRequest ¶
func GetRequestTraceSession ¶
func QuoteIfString ¶ added in v1.20.0
func QuoteIfString(interfaceValue interface{}) interface{}
Types ¶
type AccessLogMiddleware ¶
type AccessLogMiddleware struct{}
func NewAccessLogMiddleware ¶
func NewAccessLogMiddleware() (*AccessLogMiddleware, error)
func (*AccessLogMiddleware) MiddlewareFunc ¶
func (l *AccessLogMiddleware) MiddlewareFunc(handler rest.HandlerFunc) rest.HandlerFunc
type Error ¶
type Error struct { Code string `json:"code,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` Status int `json:"status,string,omitempty"` Source *Source `json:"source,omitempty"` Meta interface{} `json:"meta,omitempty"` }
func ErrorInternalServerFailure ¶
func ErrorInternalServerFailure() *Error
func (*Error) WithSourceParameter ¶
func (*Error) WithSourcePointer ¶
type Errors ¶
type Errors struct {
// contains filtered or unexported fields
}
func (*Errors) AppendError ¶
type JSONResponse ¶
type LoggerMiddleware ¶
func NewLoggerMiddleware ¶
func NewLoggerMiddleware(logger log.Logger) (*LoggerMiddleware, error)
func (*LoggerMiddleware) MiddlewareFunc ¶
func (l *LoggerMiddleware) MiddlewareFunc(handler rest.HandlerFunc) rest.HandlerFunc
type RecoverMiddleware ¶
type RecoverMiddleware struct{}
func NewRecoverMiddleware ¶
func NewRecoverMiddleware() (*RecoverMiddleware, error)
func (*RecoverMiddleware) MiddlewareFunc ¶
func (r *RecoverMiddleware) MiddlewareFunc(handler rest.HandlerFunc) rest.HandlerFunc
type Standard ¶
type Standard struct {
// contains filtered or unexported fields
}
func NewStandard ¶
func NewStandard(response rest.ResponseWriter, request *rest.Request) *Standard
func (*Standard) RespondWithError ¶
func (*Standard) RespondWithInternalServerFailure ¶
func (*Standard) RespondWithStatusAndErrors ¶
func (*Standard) Response ¶
func (s *Standard) Response() rest.ResponseWriter
type TraceMiddleware ¶
type TraceMiddleware struct{}
func NewTraceMiddleware ¶
func NewTraceMiddleware() (*TraceMiddleware, error)
func (*TraceMiddleware) MiddlewareFunc ¶
func (l *TraceMiddleware) MiddlewareFunc(handler rest.HandlerFunc) rest.HandlerFunc
Click to show internal directories.
Click to hide internal directories.