-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change Logger.Log specification to "should not actually panic or exit" #168
Conversation
Updated #161 to use this, to resolve its prior note on Fatal and Panic |
b977ece
to
0de710d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would appreciate the small wording changes noted, but otherwise looks great.
@@ -50,6 +50,11 @@ type Logger interface { | |||
|
|||
// Log a message at the given level. Messages include any context that's | |||
// accumulated on the logger, as well as any fields added at the log site. | |||
// | |||
// Calling Panic should panic(), calling Fatal() should terminate the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: "...should panic() and calling Fatal()..."
assert.Panics(t, func() { logger.Log(PanicLevel, "foo") }, "Expected logging at Panic level to panic.") | ||
assert.Equal(t, `{"level":"panic","msg":"foo"}`, buf.Stripped(), "Unexpected output from panic-level Log.") | ||
}) | ||
func TestJSONLoggerLog_panic(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think that we're using this underscore convention in the rest of the test suite; purely for consistency, can we call these TestJSONLoggerLogPanic
and ...Fatal
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, I lied - we're using this in the bark wrapper code. Mea culpa, do as you wish.
lgtm, merge away. |
Towards #166