Documentation ¶
Overview ¶
nolint: gochecknoinits, gochecknoglobals
Index ¶
- Constants
- func NewContext(ctx context.Context, fields ...interface{}) context.Context
- func NewContextLog(ctx context.Context, l *zap.SugaredLogger) context.Context
- func NewStructuredLogger(logger *zap.SugaredLogger) func(next http.Handler) http.Handler
- func SetLevel(lvl string)
- func WithContext(ctx context.Context) *zap.SugaredLogger
- type StructuredLogger
- type StructuredLoggerEntry
Constants ¶
View Source
const (
TraceIDHeader = "X-B3-TraceId"
)
Variables ¶
This section is empty.
Functions ¶
func NewContext ¶
NewContext creates a new logger with fields.
func NewContextLog ¶
NewContextLog creates a new logger context from another logger instance.
func NewStructuredLogger ¶
func WithContext ¶
func WithContext(ctx context.Context) *zap.SugaredLogger
WithContext gets the existing logger from context. If not present returns the default.
Types ¶
type StructuredLogger ¶
type StructuredLogger struct {
Logger *zap.SugaredLogger
}
func (*StructuredLogger) NewLogEntry ¶
func (l *StructuredLogger) NewLogEntry(r *http.Request) middleware.LogEntry
type StructuredLoggerEntry ¶
type StructuredLoggerEntry struct {
Logger *zap.SugaredLogger
}
func (*StructuredLoggerEntry) Panic ¶
func (l *StructuredLoggerEntry) Panic(v interface{}, stack []byte)
Click to show internal directories.
Click to hide internal directories.