forked from mirror/logrus
Addresses @stevvooe's backward compatibility concerns.
This commit is contained in:
parent
ef9d84e9b3
commit
b54cafe5ce
12
logrus.go
12
logrus.go
|
@ -121,7 +121,6 @@ type FieldLogger interface {
|
|||
WithFields(fields Fields) *Entry
|
||||
WithError(err error) *Entry
|
||||
|
||||
Tracef(format string, args ...interface{})
|
||||
Debugf(format string, args ...interface{})
|
||||
Infof(format string, args ...interface{})
|
||||
Printf(format string, args ...interface{})
|
||||
|
@ -131,7 +130,6 @@ type FieldLogger interface {
|
|||
Fatalf(format string, args ...interface{})
|
||||
Panicf(format string, args ...interface{})
|
||||
|
||||
Trace(args ...interface{})
|
||||
Debug(args ...interface{})
|
||||
Info(args ...interface{})
|
||||
Print(args ...interface{})
|
||||
|
@ -141,7 +139,6 @@ type FieldLogger interface {
|
|||
Fatal(args ...interface{})
|
||||
Panic(args ...interface{})
|
||||
|
||||
Traceln(args ...interface{})
|
||||
Debugln(args ...interface{})
|
||||
Infoln(args ...interface{})
|
||||
Println(args ...interface{})
|
||||
|
@ -158,3 +155,12 @@ type FieldLogger interface {
|
|||
// IsFatalEnabled() bool
|
||||
// IsPanicEnabled() bool
|
||||
}
|
||||
|
||||
// Ext1FieldLogger (the first extension to FieldLogger) is superfluous, it is
|
||||
// here for consistancy. Do not use. Use Logger or Entry instead.
|
||||
type Ext1FieldLogger interface {
|
||||
FieldLogger
|
||||
Tracef(format string, args ...interface{})
|
||||
Trace(args ...interface{})
|
||||
Traceln(args ...interface{})
|
||||
}
|
||||
|
|
|
@ -453,9 +453,12 @@ func TestReplaceHooks(t *testing.T) {
|
|||
}
|
||||
|
||||
// Compile test
|
||||
func TestLogrusInterface(t *testing.T) {
|
||||
func TestLogrusInterfaces(t *testing.T) {
|
||||
var buffer bytes.Buffer
|
||||
fn := func(l FieldLogger) {
|
||||
// This verifies FieldLogger and Ext1FieldLogger work as designed.
|
||||
// Please don't use them. Use Logger and Entry directly.
|
||||
fn := func(xl Ext1FieldLogger) {
|
||||
var l FieldLogger = xl
|
||||
b := l.WithField("key", "value")
|
||||
b.Debug("Test")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue