logger

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debugf

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

func EarlierInitLogger

func EarlierInitLogger()

func Errorf

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

func Infof

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

func Printf

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

func Tracef

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

func Warnf

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

func WithContext

func WithContext(ctx context.Context) *logrus.Entry

WithContext creates an entry from the standard logger and adds a context to it.

func WithError

func WithError(err error) *logrus.Entry

WithError creates an entry from the standard logger and adds an error to it, using the value defined in ErrorKey as key.

func WithField

func WithField(key string, value interface{}) *logrus.Entry

WithField creates an entry from the standard logger and adds a field to it. If you want multiple fields, use `WithFields`.

Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.

func WithFields

func WithFields(fields logrus.Fields) *logrus.Entry

WithFields creates an entry from the standard logger and adds multiple fields to it. This is simply a helper for `WithField`, invoking it once for each field.

Note that it doesn't log until you call Debug, Print, Info, Warn, Fatal or Panic on the Entry it returns.

Types

type Base

type Base struct {
	Tag string
	logrus.Fields
}

func (*Base) Debug

func (s *Base) Debug(fmt string, args ...interface{})

func (*Base) Info

func (s *Base) Info(fmt string, args ...interface{})

func (*Base) Print

func (s *Base) Print(args ...interface{})

func (*Base) Printf

func (s *Base) Printf(fmt string, args ...interface{})

func (*Base) Skip

func (s *Base) Skip(level int) *Base

func (*Base) Trace

func (s *Base) Trace(fmt string, args ...interface{})

func (*Base) Warn

func (s *Base) Warn(fmt string, args ...interface{})

func (*Base) With

func (s *Base) With(key string, value interface{}) *Base

With can add key-value pair to logger context and print them later.

~~With could cause race exception, for example: when two or more clients incoming with CONNECT packets, now connectParser parse them ok and print logging info via base.With("sth", sb).Debug(...), here is the race point.~~

NOTE: data race had solved.

Another scene is the multiple clients send pingreq packets.

func (*Base) With2

func (s *Base) With2(key string, value interface{}, key2 string, value2 interface{}) *Base

func (*Base) With3

func (s *Base) With3(key string, value interface{}, key2 string, value2 interface{}, key3 string, value3 interface{}) *Base

func (*Base) Wrong

func (s *Base) Wrong(e error, fmt string, args ...interface{})

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL