Documentation ¶
Index ¶
- Constants
- func GetRealIPAddr(r *http.Request) string
- func RequestIDCtx(next http.Handler) http.Handler
- func ServiceInfo(name string, version string) func(http.Handler) http.Handler
- func VersionCtx(version string) func(next http.Handler) http.Handler
- type LogFields
- type StructuredLogger
- func (l *StructuredLogger) Debugf(format string, args ...interface{})
- func (l *StructuredLogger) Error(format string)
- func (l *StructuredLogger) Errorf(format string, args ...interface{})
- func (l *StructuredLogger) Infof(format string, args ...interface{})
- func (l *StructuredLogger) NewLogEntry(r *http.Request) middleware.LogEntry
- func (l *StructuredLogger) Warningf(format string, args ...interface{})
- type StructuredLoggerEntry
Constants ¶
View Source
const ( // XRequestID gets name of header XRequestID = "X-Toggly-Request-Id" // XServiceName gets service name in header XServiceName = "X-Toggly-Service-Name" // XServiceVersion gets version XServiceVersion = "X-Toggly-Service-Version" // ContextReqIDKey gets key for request id ContextReqIDKey contextKey = iota // ContextVersionKey gets key for version ContextVersionKey contextKey = iota )
Variables ¶
This section is empty.
Functions ¶
func GetRealIPAddr ¶
GetRealIPAddr gets real IP Addr from request's headers
func RequestIDCtx ¶
RequestIDCtx adds request id to context
func ServiceInfo ¶
ServiceInfo adds service information to the response header
Types ¶
type StructuredLogger ¶
StructuredLogger struct
func (*StructuredLogger) Debugf ¶
func (l *StructuredLogger) Debugf(format string, args ...interface{})
Debugf wraps logger.Debugf
func (*StructuredLogger) Error ¶
func (l *StructuredLogger) Error(format string)
Error wraps logger.Error
func (*StructuredLogger) Errorf ¶
func (l *StructuredLogger) Errorf(format string, args ...interface{})
Errorf wraps logger.Errorf
func (*StructuredLogger) Infof ¶
func (l *StructuredLogger) Infof(format string, args ...interface{})
Infof wraps logger.Infof
func (*StructuredLogger) NewLogEntry ¶
func (l *StructuredLogger) NewLogEntry(r *http.Request) middleware.LogEntry
NewLogEntry method
func (*StructuredLogger) Warningf ¶
func (l *StructuredLogger) Warningf(format string, args ...interface{})
Warningf wraps logger.Warningf
type StructuredLoggerEntry ¶
StructuredLoggerEntry struct
func (*StructuredLoggerEntry) Panic ¶
func (l *StructuredLoggerEntry) Panic(v interface{}, stack []byte)
Panic method
Click to show internal directories.
Click to hide internal directories.