Documentation ¶
Index ¶
- func Debug(ctx context.Context, err error)
- func Debugf(ctx context.Context, format string, args ...interface{})
- func Log(ctx context.Context, err error)
- func Logf(ctx context.Context, format string, args ...interface{})
- func RequestID(ctx context.Context) string
- func SetRequestID(ctx context.Context) context.Context
- func WithDebug(ctx context.Context) context.Context
- func WithField(ctx context.Context, field string, value interface{}) context.Context
- func WithFields(ctx context.Context, fields Fields) context.Context
- func WithLogger(ctx context.Context, l *Logger) context.Context
- type Fields
- type Logger
- func (l *Logger) AddErrorMapper(mapper func(context.Context, error) context.Context)
- func (l *Logger) BackgroundContext() context.Context
- func (l *Logger) DebugError(ctx context.Context, err error)
- func (l *Logger) DebugPrintf(ctx context.Context, format string, args ...interface{})
- func (l *Logger) EnableDebug()
- func (l *Logger) EnableJSON()
- func (l *Logger) EnableStacks()
- func (l *Logger) Error(ctx context.Context, err error)
- func (l *Logger) ErrorsOnly()
- func (l *Logger) Logrus() *logrus.Logger
- func (l *Logger) Printf(ctx context.Context, format string, args ...interface{})
- func (l *Logger) SetOutput(out io.Writer)
- func (l *Logger) Write(p []byte) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetRequestID ¶
SetRequestID will assign a unique ID to the context for tracing.
func WithFields ¶
WithFields will return a context with the provided fields set.
Types ¶
type Fields ¶
type Fields map[string]interface{}
Fields are used to add values in structured logging.
func ContextFields ¶
ContextFields will return the current set of fields associated with a context.
type Logger ¶ added in v0.29.0
type Logger struct {
// contains filtered or unexported fields
}
func FromContext ¶ added in v0.29.0
func (*Logger) AddErrorMapper ¶ added in v0.29.0
func (*Logger) BackgroundContext ¶ added in v0.29.0
func (*Logger) DebugError ¶ added in v0.29.0
func (*Logger) DebugPrintf ¶ added in v0.29.0
func (*Logger) EnableDebug ¶ added in v0.29.0
func (l *Logger) EnableDebug()
If EnableDebug is called, all debug messages will be logged.
func (*Logger) EnableJSON ¶ added in v0.29.0
func (l *Logger) EnableJSON()
EnableJSON sets the output log format to JSON
func (*Logger) EnableStacks ¶ added in v0.29.0
func (l *Logger) EnableStacks()
EnableStacks enables stack information via the Source field.
func (*Logger) ErrorsOnly ¶ added in v0.29.0
func (l *Logger) ErrorsOnly()
ErrorsOnly will disable all log output except errors.
Click to show internal directories.
Click to hide internal directories.