labstack / gommon

Common packages for Go
MIT License
539 stars 101 forks source link

Make the Panic and the Fatal functions behave similar to the rest #19

Closed alexandrestein closed 6 years ago

alexandrestein commented 6 years ago

It's a very small and quite dirty change. I did not take the time to understand all the internal logic of this package.

But I think it could be nice to keep the same nice display when you hit Panic or Fatal.

Tell me what you think.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+0.2%) to 69.686% when pulling 27b566bd5ecde7b81f3ba4b8029e6470ed02567c on alexandreStein:master into 6fe1405d73ec4bd4cd8a4ac8e2a2b2bf95d03954 on labstack:master.

vishr commented 6 years ago

Can you show me the output of panic/fatal?

alexandrestein commented 6 years ago

As now:

{"time":"2018-03-16T09:33:06.071499779+01:00","level":"-","prefix":"test","file":"log.go","line":"190","message":"fatal"}
{"time":"2018-03-16T09:33:06.075327295+01:00","level":"-","prefix":"test","file":"log.go","line":"195","message":"fatal-f"}

After the update:

{"time":"2018-03-16T09:29:51.372949036+01:00","level":"FATAL","prefix":"test","file":"log_test.go","line":"68","message":"fatal"}
{"time":"2018-03-16T09:29:51.376687921+01:00","level":"FATAL","prefix":"test","file":"log_test.go","line":"71","message":"fatal-f"}

This display the level. But the most import thing is that keeps the initiator file and line and not the line inside the log package.

Sorry, I should have told you this in first step.

vishr commented 6 years ago

@alexandreStein thanks for your contribution 🎉