From 56fdd4814b83cf0837835c88784a95673aec18ba Mon Sep 17 00:00:00 2001 From: Mikey Wotton Date: Fri, 12 Feb 2021 14:23:46 +0000 Subject: [PATCH] Revert "Merge pull request #1212 from alecbz/alec/remove-dead-panic" This reverts commit cd4bf4ef8de16b243cce0e062742feb34128648b, reversing changes made to 44d983dbc2c41b2f2184cb5a2da1c9b6ad0dde7e. --- entry.go | 1 + entry_test.go | 22 ---------------------- 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/entry.go b/entry.go index 1e32a64f7..2e87f5f3f 100644 --- a/entry.go +++ b/entry.go @@ -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 diff --git a/entry_test.go b/entry_test.go index df687adee..b98e14ad6 100644 --- a/entry_test.go +++ b/entry_test.go @@ -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"