Documentation ¶
Index ¶
- Constants
- func Debug(args ...interface{})
- func DebugWithFields(fields Fields, args ...interface{})
- func DebugWithFieldsf(fields Fields, message string, args ...interface{})
- func Debugf(message string, args ...interface{})
- func Error(args ...interface{})
- func ErrorWithFields(fields Fields, args ...interface{})
- func ErrorWithFieldsf(fields Fields, message string, args ...interface{})
- func Errorf(message string, args ...interface{})
- func Fatal(args ...interface{})
- func FatalWithFields(fields Fields, args ...interface{})
- func FatalWithFieldsf(fields Fields, message string, args ...interface{})
- func Fatalf(message string, args ...interface{})
- func Info(args ...interface{})
- func InfoWithFields(fields Fields, args ...interface{})
- func InfoWithFieldsf(fields Fields, message string, args ...interface{})
- func Infof(message string, args ...interface{})
- func New(isJSONFormatted bool, logLevel string) *logrus.Logger
- func NewError(args ...interface{}) error
- func NewErrorWithFields(fields Fields, args ...interface{}) error
- func NewErrorWithFieldsf(fields Fields, message string, args ...interface{}) error
- func NewErrorf(message string, args ...interface{}) error
- func NewSLogChiMiddleware(l *slog.Logger) func(http.Handler) http.Handler
- func NewSLogGraphQLResponseMiddleware(l *slog.Logger, s VariablesScrubber) graphql.ResponseMiddleware
- func Panic(args ...interface{})
- func PanicWithFields(fields Fields, args ...interface{})
- func PanicWithFieldsf(fields Fields, message string, args ...interface{})
- func Panicf(message string, args ...interface{})
- func PopContextFields(ctx context.Context)
- func PushContextFields(ctx context.Context, fields ...Field)
- func ServerLogger() func(next http.Handler) http.Handler
- func Warn(args ...interface{})
- func WarnWithFields(fields Fields, args ...interface{})
- func WarnWithFieldsf(fields Fields, message string, args ...interface{})
- func Warnf(message string, args ...interface{})
- func WithContext(parent context.Context, fields ...Field) context.Context
- func Writer() *io.PipeWriter
- func WriterLevel(logLevel string) *io.PipeWriter
- type ByteLogs
- type Field
- type Fields
- type Logger
- type PrefixedLogger
- func (l *PrefixedLogger) Debug(args ...interface{})
- func (l *PrefixedLogger) DebugWithFields(fields Fields, args ...interface{})
- func (l *PrefixedLogger) DebugWithFieldsf(fields Fields, message string, args ...interface{})
- func (l *PrefixedLogger) Debugf(message string, args ...interface{})
- func (l *PrefixedLogger) Error(args ...interface{})
- func (l *PrefixedLogger) ErrorWithFields(fields Fields, args ...interface{})
- func (l *PrefixedLogger) ErrorWithFieldsf(fields Fields, message string, args ...interface{})
- func (l *PrefixedLogger) Errorf(message string, args ...interface{})
- func (l *PrefixedLogger) Fatal(args ...interface{})
- func (l *PrefixedLogger) FatalWithFields(fields Fields, args ...interface{})
- func (l *PrefixedLogger) FatalWithFieldsf(fields Fields, message string, args ...interface{})
- func (l *PrefixedLogger) Fatalf(message string, args ...interface{})
- func (l *PrefixedLogger) Info(args ...interface{})
- func (l *PrefixedLogger) InfoWithFields(fields Fields, args ...interface{})
- func (l *PrefixedLogger) InfoWithFieldsf(fields Fields, message string, args ...interface{})
- func (l *PrefixedLogger) Infof(message string, args ...interface{})
- func (l *PrefixedLogger) Panic(args ...interface{})
- func (l *PrefixedLogger) PanicWithFields(fields Fields, args ...interface{})
- func (l *PrefixedLogger) PanicWithFieldsf(fields Fields, message string, args ...interface{})
- func (l *PrefixedLogger) Panicf(message string, args ...interface{})
- func (l *PrefixedLogger) PrefixError(err error, msg string) error
- func (l *PrefixedLogger) Warn(args ...interface{})
- func (l *PrefixedLogger) WarnWithFields(fields Fields, args ...interface{})
- func (l *PrefixedLogger) WarnWithFieldsf(fields Fields, message string, args ...interface{})
- func (l *PrefixedLogger) Warnf(message string, args ...interface{})
- func (l *PrefixedLogger) WrapError(err error) error
- func (l *PrefixedLogger) Writer() *io.PipeWriter
- type VariablesScrubber
Constants ¶
const ContextKeyLogFields logContextType = "nrfta/go-log/Fields"
ContextKeyLogFields is the key for the logging fields context value.
Variables ¶
This section is empty.
Functions ¶
func DebugWithFields ¶
func DebugWithFields(fields Fields, args ...interface{})
func DebugWithFieldsf ¶ added in v0.3.0
func ErrorWithFields ¶
func ErrorWithFields(fields Fields, args ...interface{})
func ErrorWithFieldsf ¶ added in v0.3.0
func FatalWithFields ¶
func FatalWithFields(fields Fields, args ...interface{})
func FatalWithFieldsf ¶ added in v0.3.0
func InfoWithFields ¶
func InfoWithFields(fields Fields, args ...interface{})
func InfoWithFieldsf ¶ added in v0.3.0
func NewErrorWithFields ¶ added in v0.9.0
func NewErrorWithFieldsf ¶ added in v0.9.0
func NewSLogChiMiddleware ¶ added in v0.11.0
NewSLogChiMiddleware is used to log http request information. It takes a pointer to an slog.Logger to use. If `l` is nil, it uses the default logger
func NewSLogGraphQLResponseMiddleware ¶ added in v0.12.0
func NewSLogGraphQLResponseMiddleware(l *slog.Logger, s VariablesScrubber) graphql.ResponseMiddleware
NewSLogGraphQLResponseMiddleware is used to log GraphQL requests and responses.
func PanicWithFields ¶
func PanicWithFields(fields Fields, args ...interface{})
func PanicWithFieldsf ¶ added in v0.3.0
func PopContextFields ¶ added in v0.7.0
PopContextFields pops the last entry off of the logging fields stack.
func PushContextFields ¶ added in v0.7.0
PushContextFields pushes the given fields onto the logging fields stack.
func ServerLogger ¶
ServerLogger is a middleware that logs the start and end of each request, along with some useful data about what was requested, what the response status was, and how long it took to return.
func WarnWithFields ¶
func WarnWithFields(fields Fields, args ...interface{})
func WarnWithFieldsf ¶ added in v0.3.0
func WithContext ¶ added in v0.7.0
WithContext initializes context with a logging fields stack with the given fields. If the given context has already bene initialized, then the fields are pushed onto the existing stack.
func Writer ¶
func Writer() *io.PipeWriter
func WriterLevel ¶ added in v0.5.0
func WriterLevel(logLevel string) *io.PipeWriter
Types ¶
type ByteLogs ¶ added in v0.10.0
func (*ByteLogs) CheckForLogEndMessage ¶ added in v0.10.0
type Field ¶ added in v0.7.0
type Field struct { Name string Value interface{} }
Field represents a logging field.
func FieldsToFieldsArray ¶ added in v0.9.0
type Fields ¶
type Fields map[string]interface{}
Fields Type to pass when we want to call WithFields for structured logging
type Logger ¶
type Logger interface { Info(args ...interface{}) Infof(message string, args ...interface{}) Debug(args ...interface{}) Debugf(message string, args ...interface{}) Error(args ...interface{}) Errorf(message string, args ...interface{}) Warn(args ...interface{}) Warnf(message string, args ...interface{}) Fatal(args ...interface{}) Fatalf(message string, args ...interface{}) Panic(args ...interface{}) Panicf(message string, args ...interface{}) Writer() *io.PipeWriter }
Logger interface
func RequestLogger ¶
RequestLogger creates a logger with the request ID on it
type PrefixedLogger ¶ added in v0.10.0
func NewPrefixedLogger ¶ added in v0.10.0
func NewPrefixedLogger(prefix string, instance Logger) PrefixedLogger
func (*PrefixedLogger) Debug ¶ added in v0.10.0
func (l *PrefixedLogger) Debug(args ...interface{})
func (*PrefixedLogger) DebugWithFields ¶ added in v0.10.0
func (l *PrefixedLogger) DebugWithFields(fields Fields, args ...interface{})
func (*PrefixedLogger) DebugWithFieldsf ¶ added in v0.10.0
func (l *PrefixedLogger) DebugWithFieldsf(fields Fields, message string, args ...interface{})
func (*PrefixedLogger) Debugf ¶ added in v0.10.0
func (l *PrefixedLogger) Debugf(message string, args ...interface{})
func (*PrefixedLogger) Error ¶ added in v0.10.0
func (l *PrefixedLogger) Error(args ...interface{})
func (*PrefixedLogger) ErrorWithFields ¶ added in v0.10.0
func (l *PrefixedLogger) ErrorWithFields(fields Fields, args ...interface{})
func (*PrefixedLogger) ErrorWithFieldsf ¶ added in v0.10.0
func (l *PrefixedLogger) ErrorWithFieldsf(fields Fields, message string, args ...interface{})
func (*PrefixedLogger) Errorf ¶ added in v0.10.0
func (l *PrefixedLogger) Errorf(message string, args ...interface{})
func (*PrefixedLogger) Fatal ¶ added in v0.10.0
func (l *PrefixedLogger) Fatal(args ...interface{})
func (*PrefixedLogger) FatalWithFields ¶ added in v0.10.0
func (l *PrefixedLogger) FatalWithFields(fields Fields, args ...interface{})
func (*PrefixedLogger) FatalWithFieldsf ¶ added in v0.10.0
func (l *PrefixedLogger) FatalWithFieldsf(fields Fields, message string, args ...interface{})
func (*PrefixedLogger) Fatalf ¶ added in v0.10.0
func (l *PrefixedLogger) Fatalf(message string, args ...interface{})
func (*PrefixedLogger) Info ¶ added in v0.10.0
func (l *PrefixedLogger) Info(args ...interface{})
implement logger interface
func (*PrefixedLogger) InfoWithFields ¶ added in v0.10.0
func (l *PrefixedLogger) InfoWithFields(fields Fields, args ...interface{})
func (*PrefixedLogger) InfoWithFieldsf ¶ added in v0.10.0
func (l *PrefixedLogger) InfoWithFieldsf(fields Fields, message string, args ...interface{})
func (*PrefixedLogger) Infof ¶ added in v0.10.0
func (l *PrefixedLogger) Infof(message string, args ...interface{})
func (*PrefixedLogger) Panic ¶ added in v0.10.0
func (l *PrefixedLogger) Panic(args ...interface{})
func (*PrefixedLogger) PanicWithFields ¶ added in v0.10.0
func (l *PrefixedLogger) PanicWithFields(fields Fields, args ...interface{})
func (*PrefixedLogger) PanicWithFieldsf ¶ added in v0.10.0
func (l *PrefixedLogger) PanicWithFieldsf(fields Fields, message string, args ...interface{})
func (*PrefixedLogger) Panicf ¶ added in v0.10.0
func (l *PrefixedLogger) Panicf(message string, args ...interface{})
func (*PrefixedLogger) PrefixError ¶ added in v0.10.0
func (l *PrefixedLogger) PrefixError(err error, msg string) error
func (*PrefixedLogger) Warn ¶ added in v0.10.0
func (l *PrefixedLogger) Warn(args ...interface{})
func (*PrefixedLogger) WarnWithFields ¶ added in v0.10.0
func (l *PrefixedLogger) WarnWithFields(fields Fields, args ...interface{})
func (*PrefixedLogger) WarnWithFieldsf ¶ added in v0.10.0
func (l *PrefixedLogger) WarnWithFieldsf(fields Fields, message string, args ...interface{})
func (*PrefixedLogger) Warnf ¶ added in v0.10.0
func (l *PrefixedLogger) Warnf(message string, args ...interface{})
func (*PrefixedLogger) WrapError ¶ added in v0.10.0
func (l *PrefixedLogger) WrapError(err error) error
func (*PrefixedLogger) Writer ¶ added in v0.10.0
func (l *PrefixedLogger) Writer() *io.PipeWriter