Documentation ¶
Overview ¶
Package errlog is a library for logging error with logrus more easily.
Index ¶
- func CheckField(err error, key string, f func(v interface{}) bool) bool
- func GetField(err error, key string) (interface{}, bool)
- func HasField(err error, key string) bool
- func HasMsg(err error, msg string) bool
- func New(fields logrus.Fields, msg string, msgs ...string) error
- func Newf(fields logrus.Fields, msg string, a ...interface{}) error
- func Wrap(err error, fields logrus.Fields, msgs ...string) error
- func Wrapf(err error, fields logrus.Fields, msg string, a ...interface{}) error
- type Logger
- func (logger *Logger) Debug(err error, msgs ...string)
- func (logger *Logger) Debugf(err error, msg string, a ...interface{})
- func (logger *Logger) Error(err error, msgs ...string)
- func (logger *Logger) Errorf(err error, msg string, a ...interface{})
- func (logger *Logger) Fatal(err error, msgs ...string)
- func (logger *Logger) Fatalf(err error, msg string, a ...interface{})
- func (logger *Logger) Info(err error, msgs ...string)
- func (logger *Logger) Infof(err error, msg string, a ...interface{})
- func (logger *Logger) Logger() LogrusLogger
- func (logger *Logger) Sdebug(msgs ...string)
- func (logger *Logger) Sdebugf(msg string, a ...interface{})
- func (logger *Logger) Serror(msgs ...string)
- func (logger *Logger) Serrorf(msg string, a ...interface{})
- func (logger *Logger) Sfatal(msgs ...string)
- func (logger *Logger) Sfatalf(msg string, a ...interface{})
- func (logger *Logger) Sinfo(msgs ...string)
- func (logger *Logger) Sinfof(msg string, a ...interface{})
- func (logger *Logger) Swarn(msgs ...string)
- func (logger *Logger) Swarnf(msg string, a ...interface{})
- func (logger *Logger) Warn(err error, msgs ...string)
- func (logger *Logger) Warnf(err error, msg string, a ...interface{})
- func (logger *Logger) WithField(key string, value interface{}) *Logger
- func (logger *Logger) WithFields(fields logrus.Fields) *Logger
- type LogrusLogger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckField ¶ added in v0.5.0
CheckField checks the field's value.
func GetField ¶ added in v0.5.0
GetField returns the field value. If error is nil or doesn't have the field, nil and false are returned.
func HasMsg ¶ added in v0.5.0
HasMsg returns whether error has the message. If err is nil, returns false. If err isn't base, returns err.Error() == msg .
Types ¶
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger is a logger for error object.
func (*Logger) Logger ¶ added in v0.9.0
func (logger *Logger) Logger() LogrusLogger
Logger returns a logger.
type LogrusLogger ¶
type LogrusLogger interface { Debug(args ...interface{}) Debugf(format string, args ...interface{}) Error(args ...interface{}) Errorf(format string, args ...interface{}) Fatal(args ...interface{}) Fatalf(format string, args ...interface{}) Info(args ...interface{}) Infof(format string, args ...interface{}) Warn(args ...interface{}) Warnf(format string, args ...interface{}) WithField(key string, value interface{}) *logrus.Entry WithFields(fields logrus.Fields) *logrus.Entry }
LogrusLogger is an interface for logrus.Logger and logrus.Entry .
Click to show internal directories.
Click to hide internal directories.