Skip to content

Commit

Permalink
Addresses @stevvooe's backward compatibility concerns.
Browse files Browse the repository at this point in the history
  • Loading branch information
Loren Osborn committed Oct 18, 2018
1 parent ef9d84e commit b54cafe
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
12 changes: 9 additions & 3 deletions logrus.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{})
Expand All @@ -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{})
Expand All @@ -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{})
Expand All @@ -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{})
}
7 changes: 5 additions & 2 deletions logrus_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand Down

0 comments on commit b54cafe

Please sign in to comment.