Documentation ¶
Index ¶
- func AsError(err error, target interface{}) bool
- func Debug(v interface{})
- func Debugf(format string, args ...interface{})
- func Error(v interface{})
- func ErrorBadRequest(err error) error
- func ErrorConflict(err error) error
- func ErrorNoContent(err error) error
- func ErrorNotAuthorized(err error) error
- func ErrorNotFound(err error) error
- func ErrorTooManyRequests(err error) error
- func Errorf(format string, args ...interface{})
- func Fatal(v interface{})
- func Fatalf(format string, args ...interface{})
- func Info(v interface{})
- func Infof(format string, args ...interface{})
- func IsBadRequest(err error) bool
- func IsConflict(err error) bool
- func IsError(err error, target error) bool
- func IsFatal(err error) bool
- func IsNoContent(err error) bool
- func IsNotAuthorized(err error) bool
- func IsNotFound(err error) bool
- func IsTooManyRequests(err error) bool
- func NewError(msg string) error
- func NewErrorBadRequest(msg string) error
- func NewErrorConflict(msg string) error
- func NewErrorNoContent(msg string) error
- func NewErrorNotAuthorized(msg string) error
- func NewErrorNotFound(msg string) error
- func NewErrorTooManyRequests(msg string) error
- func NewErrorWithCode(msg string, code int) error
- func NewErrorf(format string, v ...interface{}) error
- func NewTraceMiddleware(version string, withTrailHeader bool) func(next http.Handler) http.Handler
- func OneOff(v interface{})
- func SetVerbosity(level string)
- func Stacktrace(err error) error
- func StatusCode(err error) int
- func Testing()
- func Warn(v interface{})
- func Warnf(format string, args ...interface{})
- type Location
- type Request
- func (r *Request) AddGroups(groupIds ...string)
- func (r *Request) AddResponseHeaders(headers http.Header)
- func (r *Request) Context() context.Context
- func (r *Request) Duration() time.Duration
- func (r *Request) Finish()
- func (r *Request) Groups() []string
- func (r *Request) IP() net.IP
- func (r *Request) Location() *Location
- func (r *Request) Method() string
- func (r *Request) Operations() []Span
- func (r *Request) Origin() *http.Request
- func (r *Request) Profile(v interface{}) error
- func (r *Request) Recover(v interface{})
- func (r *Request) Referrer() string
- func (r *Request) RequestId() string
- func (r *Request) Response(withTrailHeader bool) http.ResponseWriter
- func (r *Request) SetLocation(location *Location)
- func (r *Request) SetProfile(profile interface{})
- func (r *Request) SetStatus(status int)
- func (r *Request) SetUserId(userId string)
- func (r *Request) Status() int
- func (r *Request) Trail() string
- func (r *Request) URL() *url.URL
- func (r *Request) UserAgent() string
- func (r *Request) UserId() string
- func (r *Request) Version() string
- type Span
- type Tags
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf prints a formatted message at debug level
func ErrorBadRequest ¶
ErrorBadRequest creates a bad request error
func ErrorNoContent ¶
ErrorNoContent creates a no content error
func ErrorNotAuthorized ¶ added in v0.1.4
ErrorNotAuthorized creates an unauthorized error
func ErrorTooManyRequests ¶
ErrorTooManyRequests creates a too many requests error
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf prints a formatted message at error level
func Fatalf ¶
func Fatalf(format string, args ...interface{})
Fatalf prints a formatted message at fatal level
func Infof ¶
func Infof(format string, args ...interface{})
Infof prints a formatted message at info level
func IsBadRequest ¶
IsBadRequest checks if an error is a bad request application error
func IsConflict ¶
IsConflict checks if an error is a conflict application error
func IsNoContent ¶
IsNoContent checks if an error is a no content application error
func IsNotAuthorized ¶ added in v0.1.4
IsNotAuthorized checks if an error is an unauthorized application error
func IsNotFound ¶
IsNotFound checks if an error is a not found application error
func IsTooManyRequests ¶
IsTooManyRequests checks if an error is a too many requests application error
func NewErrorBadRequest ¶
NewErrorBadRequest creates a bad request error from a msg
func NewErrorConflict ¶
NewErrorConflict creates a conflict error from a msg
func NewErrorNoContent ¶
NewErrorNoContent creates a no content error from a msg
func NewErrorNotAuthorized ¶ added in v0.1.4
NewErrorNotAuthorized creates an unauthorized error from a msg
func NewErrorNotFound ¶
NewErrorNotFound creates a not found error from a msg
func NewErrorTooManyRequests ¶
NewErrorTooManyRequests creates a too many requests error from a msg
func NewErrorWithCode ¶
NewErrorWithCode creates an error with code from a msg
func NewTraceMiddleware ¶
NewTraceMiddleware constructs a new middleware that handles tracing
Types ¶
type Location ¶ added in v0.1.16
type Location struct { CountryCode string `json:"countryCode,omitempty"` CountryCode3 string `json:"countryCode3,omitempty"` CountryName string `json:"countryName,omitempty"` CityName string `json:"cityName,omitempty"` Latitude float64 `json:"latitude,omitempty"` Longitude float64 `json:"longitude,omitempty"` TimeZone string `json:"timeZone,omitempty"` ContinentCode string `json:"continentCode,omitempty"` SubdivisionCode string `json:"subdivisionCode,omitempty"` }
Location of the origin request
type Request ¶ added in v0.1.16
type Request struct {
// contains filtered or unexported fields
}
Request represents a request with trail trace support enabled
func NewRequest ¶ added in v0.1.16
NewRequest creates a new trail request instance (or continues from a prev one)
func (*Request) AddResponseHeaders ¶ added in v0.1.20
AddResponseHeaders decodes the trail request from a response header
func (*Request) Finish ¶ added in v0.1.16
func (r *Request) Finish()
Finish ends the current request and sends a response
func (*Request) Operations ¶ added in v0.1.16
Operations gets the request operations
func (*Request) Recover ¶ added in v0.1.16
func (r *Request) Recover(v interface{})
Recover from a panic
func (*Request) Response ¶ added in v0.1.16
func (r *Request) Response(withTrailHeader bool) http.ResponseWriter
Response gets the underlying response writer
func (*Request) SetLocation ¶ added in v0.1.16
SetLocation sets a custom location of the request
func (*Request) SetProfile ¶ added in v0.1.16
func (r *Request) SetProfile(profile interface{})
SetProfile sets a custom profile for the request
type Span ¶
type Span struct { SpanId uuid.UUID `json:"spanId"` ParentId *uuid.UUID `json:"parentId,omitempty"` Operation string `json:"operation"` StartTime time.Time `json:"startTime"` EndTime time.Time `json:"endTime"` Tags Tags `json:"tags,omitempty"` *Request `json:"-"` // contains filtered or unexported fields }
Span for tracing instrumentation