Documentation ¶
Index ¶
- Variables
- func AppendFieldsToContext(ctx context.Context, fields ...Field) context.Context
- func CallerSkip(skip int) option
- func Debug(args ...interface{})
- func Debugf(format string, args ...interface{})
- func Debugln(args ...interface{})
- func DefaultZapLogger() *zap.Logger
- func Error(args ...interface{})
- func Errorf(format string, args ...interface{})
- func Errorln(args ...interface{})
- func Formatter(format string) option
- func GetFieldValueFromContext(ctx context.Context, FieldName string) string
- func GetLevel() string
- func Info(args ...interface{})
- func Infof(format string, args ...interface{})
- func Infoln(args ...interface{})
- func Initialize(options ...option) (err error)
- func Level(level string) option
- func Panic(args ...interface{})
- func Panicf(format string, args ...interface{})
- func Panicln(args ...interface{})
- func Print(args ...interface{})
- func Printf(format string, args ...interface{})
- func Println(args ...interface{})
- func SetLevel(level string)
- func Sync() error
- func Warn(args ...interface{})
- func Warnf(format string, args ...interface{})
- func Warnln(args ...interface{})
- type Field
- func Any(key string, val interface{}) Field
- func Bool(key string, val bool) Field
- func Bools(key string, val []bool) Field
- func ByteString(key string, val []byte) Field
- func ByteStrings(key string, val [][]byte) Field
- func Duration(key string, val time.Duration) Field
- func Durationp(key string, val *time.Duration) Field
- func Durations(key string, val []time.Duration) Field
- func Err(err error) Field
- func Float32(key string, val float32) Field
- func Float32p(key string, val *float32) Field
- func Float32s(key string, val []float32) Field
- func Float64(key string, val float64) Field
- func Float64p(key string, val *float64) Field
- func Float64s(key string, val []float64) Field
- func Int(key string, val int) Field
- func Int16(key string, val int16) Field
- func Int16p(key string, val *int16) Field
- func Int16s(key string, val []int16) Field
- func Int32(key string, val int32) Field
- func Int32p(key string, val *int32) Field
- func Int32s(key string, val []int32) Field
- func Int64(key string, val int64) Field
- func Int64p(key string, val *int64) Field
- func Int64s(key string, val []int64) Field
- func Int8(key string, val int8) Field
- func Int8p(key string, val *int8) Field
- func Int8s(key string, val []int8) Field
- func Intp(key string, val *int) Field
- func Ints(key string, val []int) Field
- func Stack(key string) Field
- func String(key string, val string) Field
- func Stringer(key string, val fmt.Stringer) Field
- func Stringp(key string, val *string) Field
- func Strings(key string, val []string) Field
- func Time(key string, val time.Time) Field
- func Timep(key string, val *time.Time) Field
- func Times(key string, val []time.Time) Field
- func Uint(key string, val uint) Field
- func Uint16(key string, val uint16) Field
- func Uint16p(key string, val *uint16) Field
- func Uint16s(key string, val []uint16) Field
- func Uint32(key string, val uint32) Field
- func Uint32p(key string, val *uint32) Field
- func Uint32s(key string, val []uint32) Field
- func Uint64(key string, val uint64) Field
- func Uint64p(key string, val *uint64) Field
- func Uint64s(key string, val []uint64) Field
- func Uint8(key string, val uint8) Field
- func Uint8p(key string, val *uint8) Field
- func Uint8s(key string, val []uint8) Field
- func Uintp(key string, val *uint) Field
- func Uints(key string, val []uint) Field
- type Logger
- func DefaultLogger() *Logger
- func NewLogger(opts ...option) (*Logger, error)
- func With(fields ...Field) *Logger
- func WithContextFields(ctx context.Context) *Logger
- func WithError(err error) *Logger
- func WithField(key string, value interface{}) *Logger
- func WithFields(fields map[string]interface{}) *Logger
- func (logger *Logger) Debug(args ...interface{})
- func (logger *Logger) Debugf(format string, args ...interface{})
- func (logger *Logger) Debugln(args ...interface{})
- func (logger *Logger) Error(args ...interface{})
- func (logger *Logger) Errorf(format string, args ...interface{})
- func (logger *Logger) Errorln(args ...interface{})
- func (logger *Logger) GetLevel() string
- func (logger *Logger) Info(args ...interface{})
- func (logger *Logger) Infof(format string, args ...interface{})
- func (logger *Logger) Infoln(args ...interface{})
- func (logger *Logger) Panic(args ...interface{})
- func (logger *Logger) Panicf(format string, args ...interface{})
- func (logger *Logger) Panicln(args ...interface{})
- func (logger *Logger) Print(args ...interface{})
- func (logger *Logger) Printf(format string, args ...interface{})
- func (logger *Logger) Println(args ...interface{})
- func (logger *Logger) SetLevel(level string)
- func (logger *Logger) Sync() error
- func (logger *Logger) Warn(args ...interface{})
- func (logger *Logger) Warnf(format string, args ...interface{})
- func (logger *Logger) Warnln(args ...interface{})
- func (logger *Logger) With(fields ...Field) *Logger
- func (logger *Logger) WithError(err error) *Logger
- func (logger *Logger) WithField(key string, value interface{}) *Logger
- func (logger *Logger) WithFields(fields map[string]interface{}) *Logger
Constants ¶
This section is empty.
Variables ¶
var LoggerCtxFieldsKey ctxKeyType = "logger.fields"
Functions ¶
func AppendFieldsToContext ¶ added in v0.2.0
AppendFieldsToContext appends the given fields to the context
func CallerSkip ¶
func CallerSkip(skip int) option
CallerSkip add specified skip frames while reporting caller should be used to make caller to appropriate frame if this pkg is not used in vanilla form. Multiple calls are not additive.
func Debug ¶
func Debug(args ...interface{})
Debug logs a message at DEBUG level using the default logger
func Debugf ¶
func Debugf(format string, args ...interface{})
Debugf logs a message at DEBUG level using the default logger
func Debugln ¶
func Debugln(args ...interface{})
Debugln logs a message at DEBUG level using the default logger
func DefaultZapLogger ¶
func Error ¶
func Error(args ...interface{})
Error logs a message at ERROR level using the default logger
func Errorf ¶
func Errorf(format string, args ...interface{})
Errorf logs a message at ERROR level using the default logger
func Errorln ¶
func Errorln(args ...interface{})
Errorln logs a message at ERROR level using the default logger
func Formatter ¶
func Formatter(format string) option
Formatter sets the log format to development friendly text or production friendly JSON based on the config value Allowed values: "text", "json"
func GetFieldValueFromContext ¶ added in v0.3.0
GetFieldValueFromContext returns the string value from the context
func GetLevel ¶
func GetLevel() string
GetLevel returns the current logging level Logging levels can be - "debug", "info", "warning", "error", "fatal"
func Info ¶
func Info(args ...interface{})
Info logs a message at INFO level using the default logger
func Infof ¶
func Infof(format string, args ...interface{})
Infof logs a message at INFO level using the default logger
func Infoln ¶
func Infoln(args ...interface{})
Infoln logs a message at INFO level using the default logger
func Initialize ¶
func Initialize(options ...option) (err error)
Initialize the logger with configuration options Follows the "Functional Options Pattern" for configuration. Described at: https://dave.cheney.net/2014/10/17/functional-options-for-friendly-apis
func Level ¶
func Level(level string) option
Level sets the logging level. Allowed values in decreasing order of verbosity - "debug", "info", "warning", "error", "fatal", "panic" Setting a higher logging level will ignore logs from lower levels in output Default: "info"
func Panic ¶
func Panic(args ...interface{})
Panic logs a message at PANIC level using the default logger
func Panicf ¶
func Panicf(format string, args ...interface{})
Panicf logs a message at PANIC level using the default logger
func Panicln ¶
func Panicln(args ...interface{})
Panicln logs a message at PANIC level using the default logger
func Print ¶
func Print(args ...interface{})
Print logs a message at INFO level using the default logger.
func Printf ¶
func Printf(format string, args ...interface{})
Printf logs a message at INFO level using the default logger.
func Println ¶
func Println(args ...interface{})
Println logs a message at INFO level using the default logger
func Warn ¶
func Warn(args ...interface{})
Warn logs a message at WARNING level using the default logger
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
func DefaultLogger ¶ added in v0.2.0
func DefaultLogger() *Logger
func With ¶
With adds multiple fields to the logger. Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Logger it returns.
func WithContextFields ¶ added in v0.2.0
WithContextFields logs messages with the fields added to the context
func WithError ¶
WithError creates an entry from the standard logger and adds an error to it.
Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.
func WithField ¶
WithField creates an entry from the standard logger and adds a field to it.
Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.
func WithFields ¶
WithFields creates an entry from the standard logger and adds multiple fields to it.
Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.
Note: Use With instead for structured fields for better performance
func (*Logger) Debug ¶
func (logger *Logger) Debug(args ...interface{})
Debug logs a message at DEBUG level using the provided logger
func (*Logger) Debugln ¶
func (logger *Logger) Debugln(args ...interface{})
Debugln logs a message at DEBUG level using the provided logger
func (*Logger) Error ¶
func (logger *Logger) Error(args ...interface{})
Error logs a message at ERROR level using the provided logger
func (*Logger) Errorln ¶
func (logger *Logger) Errorln(args ...interface{})
Errorln logs a message at ERROR level using the provided logger
func (*Logger) GetLevel ¶
GetLevel returns the current logging level Logging levels can be - "debug", "info", "warning", "error", "fatal"
func (*Logger) Info ¶
func (logger *Logger) Info(args ...interface{})
Info logs a message at INFO level using the provided logger
func (*Logger) Infoln ¶
func (logger *Logger) Infoln(args ...interface{})
Infoln logs a message at INFO level using the provided logger
func (*Logger) Panic ¶
func (logger *Logger) Panic(args ...interface{})
Panic logs a message at PANIC level using the provided logger
func (*Logger) Panicln ¶
func (logger *Logger) Panicln(args ...interface{})
Panicln logs a message at PANIC level using the given logger
func (*Logger) Print ¶
func (logger *Logger) Print(args ...interface{})
Print logs a message at INFO level using the provided logger.
func (*Logger) Println ¶
func (logger *Logger) Println(args ...interface{})
Println logs a message at INFO level using the provided logger
func (*Logger) Warn ¶
func (logger *Logger) Warn(args ...interface{})
Warn logs a message at WARNING level using the provided logger
func (*Logger) Warnln ¶
func (logger *Logger) Warnln(args ...interface{})
Warnln logs a message at WARNING level using the provided logger
func (*Logger) With ¶
With adds multiple fields to the logger. Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Logger it returns.
func (*Logger) WithField ¶
WithField creates an entry from the standard logger and adds a field to it.
Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.
func (*Logger) WithFields ¶
WithFields creates an entry from the standard logger and adds multiple fields to it.
Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.
Note: Use With instead for structured fields for better performance