Skip to content

Commit

Permalink
Revert "Merge pull request sirupsen#1212 from alecbz/alec/remove-dead…
Browse files Browse the repository at this point in the history
…-panic"

This reverts commit cd4bf4e, reversing
changes made to 44d983d.
  • Loading branch information
mikewotton committed Feb 12, 2021
1 parent b8d7df0 commit 56fdd48
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 22 deletions.
1 change: 1 addition & 0 deletions entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ func (entry *Entry) Fatal(args ...interface{}) {

func (entry *Entry) Panic(args ...interface{}) {
entry.Log(PanicLevel, args...)
panic(fmt.Sprint(args...))
}

// Entry Printf family functions
Expand Down
22 changes: 0 additions & 22 deletions entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,28 +167,6 @@ func TestEntryPanicf(t *testing.T) {
entry.WithField("err", errBoom).Panicf("kaboom %v", true)
}

func TestEntryPanic(t *testing.T) {
errBoom := fmt.Errorf("boom again")

defer func() {
p := recover()
assert.NotNil(t, p)

switch pVal := p.(type) {
case *Entry:
assert.Equal(t, "kaboom", pVal.Message)
assert.Equal(t, errBoom, pVal.Data["err"])
default:
t.Fatalf("want type *Entry, got %T: %#v", pVal, pVal)
}
}()

logger := New()
logger.Out = &bytes.Buffer{}
entry := NewEntry(logger)
entry.WithField("err", errBoom).Panic("kaboom")
}

const (
badMessage = "this is going to panic"
panicMessage = "this is broken"
Expand Down

0 comments on commit 56fdd48

Please sign in to comment.