Saving off entry string for use in panic

as the reader is not seekable and without this the panic string is
always empty 🙀
This commit is contained in:
Dan Buch
2014-11-05 13:49:58 -05:00
parent 6ebb4e7b3c
commit ced531341e
2 changed files with 19 additions and 5 deletions
+14 -3
View File
@@ -12,6 +12,17 @@ func init() {
}
func main() {
defer func() {
err := recover()
if err != nil {
log.WithFields(logrus.Fields{
"omg": true,
"err": err,
"number": 100,
}).Fatal("The ice breaks!")
}
}()
log.WithFields(logrus.Fields{
"animal": "walrus",
"size": 10,
@@ -23,7 +34,7 @@ func main() {
}).Warn("The group's number increased tremendously!")
log.WithFields(logrus.Fields{
"omg": true,
"number": 100,
}).Fatal("The ice breaks!")
"animal": "orca",
"size": 9009,
}).Panic("It's over 9000!")
}