logging

package
Version: v0.0.0-...-5af8586 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PanicLevel = Level(logrus.PanicLevel)
	FatalLevel = Level(logrus.FatalLevel)
	ErrorLevel = Level(logrus.ErrorLevel)
	WarnLevel  = Level(logrus.WarnLevel)
	InfoLevel  = Level(logrus.InfoLevel)
	DebugLevel = Level(logrus.DebugLevel)
)

Variables

View Source
var (
	DefaultLogger = newServiceLogger()
	NilLogger     = newServiceLogger()
)

Functions

func ContextWithFields

func ContextWithFields(parent context.Context, fields Fields) context.Context

ContextWithFields adds logger fields to fields in context.

func Debug

func Debug(args ...interface{})

func Debugf

func Debugf(format string, args ...interface{})

func Debugln

func Debugln(args ...interface{})

func Error

func Error(args ...interface{})

func Errorf

func Errorf(format string, args ...interface{})

func Errorln

func Errorln(args ...interface{})

func Fatal

func Fatal(args ...interface{})

func Fatalf

func Fatalf(format string, args ...interface{})

func Fatalln

func Fatalln(args ...interface{})

func Info

func Info(args ...interface{})

func Infof

func Infof(format string, args ...interface{})

func Infoln

func Infoln(args ...interface{})

func Panic

func Panic(args ...interface{})

func Panicf

func Panicf(format string, args ...interface{})

func Panicln

func Panicln(args ...interface{})

func Print

func Print(args ...interface{})

func Printf

func Printf(format string, args ...interface{})

func Println

func Println(args ...interface{})

func SetDefaultFields

func SetDefaultFields(fields Fields)

func SetFormatter

func SetFormatter(ftype Formatter)

func SetLevel

func SetLevel(level Level)

func SetOutput

func SetOutput(writer io.Writer)

func Warn

func Warn(args ...interface{})

func Warnf

func Warnf(format string, args ...interface{})

func Warnln

func Warnln(args ...interface{})

Types

type Fields

type Fields map[string]interface{}

type Formatter

type Formatter string
const (
	FormatterText Formatter = "text"
	FormatterJSON Formatter = "json"
)

type Level

type Level int

func GetLevel

func GetLevel() Level

func ParseLevel

func ParseLevel(lvl string) (Level, error)

func (Level) String

func (l Level) String() string

type Logger

type Logger interface {
	WithField(key string, value interface{}) *ServiceLogger
	WithFields(fields Fields) *ServiceLogger
	WithError(err error) *ServiceLogger
	WithContext(ctx context.Context) *ServiceLogger

	Debugf(format string, args ...interface{})
	Infof(format string, args ...interface{})
	Printf(format string, args ...interface{})
	Warnf(format string, args ...interface{})
	Errorf(format string, args ...interface{})
	Fatalf(format string, args ...interface{})
	Panicf(format string, args ...interface{})

	Debug(args ...interface{})
	Info(args ...interface{})
	Print(args ...interface{})
	Warn(args ...interface{})
	Error(args ...interface{})
	Fatal(args ...interface{})
	Panic(args ...interface{})

	Debugln(args ...interface{})
	Infoln(args ...interface{})
	Println(args ...interface{})
	Warnln(args ...interface{})
	Errorln(args ...interface{})
	Fatalln(args ...interface{})
	Panicln(args ...interface{})
}

type ServiceLogger

type ServiceLogger struct {
	// contains filtered or unexported fields
}

func WithContext

func WithContext(ctx context.Context) *ServiceLogger

func WithError

func WithError(err error) *ServiceLogger

func WithField

func WithField(key string, value interface{}) *ServiceLogger

func WithFields

func WithFields(fields Fields) *ServiceLogger

func (*ServiceLogger) Debug

func (l *ServiceLogger) Debug(args ...interface{})

func (*ServiceLogger) Debugf

func (l *ServiceLogger) Debugf(format string, args ...interface{})

func (*ServiceLogger) Debugln

func (l *ServiceLogger) Debugln(args ...interface{})

func (*ServiceLogger) Error

func (l *ServiceLogger) Error(args ...interface{})

func (*ServiceLogger) Errorf

func (l *ServiceLogger) Errorf(format string, args ...interface{})

func (*ServiceLogger) Errorln

func (l *ServiceLogger) Errorln(args ...interface{})

func (*ServiceLogger) Fatal

func (l *ServiceLogger) Fatal(args ...interface{})

func (*ServiceLogger) Fatalf

func (l *ServiceLogger) Fatalf(format string, args ...interface{})

func (*ServiceLogger) Fatalln

func (l *ServiceLogger) Fatalln(args ...interface{})

func (*ServiceLogger) GetLevel

func (l *ServiceLogger) GetLevel() Level

func (*ServiceLogger) Info

func (l *ServiceLogger) Info(args ...interface{})

func (*ServiceLogger) Infof

func (l *ServiceLogger) Infof(format string, args ...interface{})

func (*ServiceLogger) Infoln

func (l *ServiceLogger) Infoln(args ...interface{})

func (*ServiceLogger) Panic

func (l *ServiceLogger) Panic(args ...interface{})

func (*ServiceLogger) Panicf

func (l *ServiceLogger) Panicf(format string, args ...interface{})

func (*ServiceLogger) Panicln

func (l *ServiceLogger) Panicln(args ...interface{})

func (*ServiceLogger) Print

func (l *ServiceLogger) Print(args ...interface{})

func (*ServiceLogger) Printf

func (l *ServiceLogger) Printf(format string, args ...interface{})

func (*ServiceLogger) Println

func (l *ServiceLogger) Println(args ...interface{})

func (*ServiceLogger) SetFormatter

func (l *ServiceLogger) SetFormatter(ftype Formatter)

func (*ServiceLogger) SetLevel

func (l *ServiceLogger) SetLevel(level Level)

func (*ServiceLogger) SetOutput

func (l *ServiceLogger) SetOutput(writer io.Writer)

func (*ServiceLogger) Warn

func (l *ServiceLogger) Warn(args ...interface{})

func (*ServiceLogger) Warnf

func (l *ServiceLogger) Warnf(format string, args ...interface{})

func (*ServiceLogger) Warnln

func (l *ServiceLogger) Warnln(args ...interface{})

func (*ServiceLogger) WithContext

func (l *ServiceLogger) WithContext(ctx context.Context) *ServiceLogger

func (*ServiceLogger) WithError

func (l *ServiceLogger) WithError(err error) *ServiceLogger

func (*ServiceLogger) WithField

func (l *ServiceLogger) WithField(key string, value interface{}) *ServiceLogger

func (*ServiceLogger) WithFields

func (l *ServiceLogger) WithFields(fields Fields) *ServiceLogger

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL