Commit Graph

16 Commits

Author SHA1 Message Date
Alisdair MacLeod e76a5c4450 create test to prove issue sirupsen/logrus#954 2020-03-19 09:29:19 +00:00
Mark Phelps 77ab282a06
Merge pull request #1047 from lwsanty/fix-race-conditions-on-entry
fix race conditions on entry
2020-02-26 18:44:58 -05:00
Taylor Wrobel 8fbaf3dbd0 Make Entry WithContext and WithTime copy tests more clear
Clarifies the data used in the EntryWithContextCopiesData test and
adds an equivalent test to verify the behavior of WithTime.
2019-12-03 13:50:59 -08:00
Taylor Wrobel bcc146f96b Fix entity data bleed when using WithContext and WithTime
Creates a copy of the data map when using WithContext to create a
child entity.  Without this, the data map of the parent entitiy,
which is exposed in the entity struct, is shared between a parent
and all children instances.

This can create bugs of shared or overwritten data when a parent
entity is used to make children in differing contexts, and behaves
differently than `WithField` and its diritivites which does make
a copy of the data.

Additionally implements the same logic for WithTime, for API
consistency in behavior.
2019-11-27 20:20:42 -08:00
lwsanty c7278b2d7a fix race conditions on entry
closes #1046
2019-10-23 20:55:57 +03:00
Adam Renberg Tamm 68e41f673a Add WithContext 2019-03-11 15:38:19 +01:00
Gavin Cabbage c4e4882020 prevent string formatting in Entry.Logf when log level is not enabled 2019-02-06 14:51:33 -05:00
David Bariod 9abefb94aa do not clear error formatting informative field 2018-12-14 17:01:34 +01:00
Maxim Sukharev 08e8d6501d Skip func pointer type value in fields
Before there was introduced a fix for JSONFormatter when func type value
passed as Field. This commit does the same but for pointer to func.

Ref:
https://github.com/sirupsen/logrus/issues/642
https://github.com/sirupsen/logrus/pull/832
2018-12-05 19:14:19 +01:00
Maurício Linhares 977e03308a
Fix deadlock on panics at Entry.log
When calling Entry.log a panic inside some of the
locking blocks could cause the whole logger to deadlock.

One of the ways this could happen is for a hook to cause
a panic, when this happens the lock is never unlocked and
the library deadlocks, causing the code that is calling
it to deadlock as well.

This changes how locking happens with unlocks at defer
blocks so even if a panic happens somewhere along the log
call the library will still unlock and continue to function.
2018-01-22 10:52:46 -05:00
Antoine Grondin 38c9fd2510 Revert "Implement casting of *Entry to error."
This reverts commit 756db3cd2d.
2015-09-07 20:47:46 -04:00
Joern Barthel 756db3cd2d Implement casting of *Entry to error. 2015-05-19 20:20:59 +02:00
Joern Barthel e3e5de11c4 Implement WithError(err) in exported, fixed doco. 2015-05-19 19:50:55 +02:00
Joern Barthel c24d0555d7 Added WithError(err). 2015-05-13 13:35:03 +02:00
Dan Buch 5164671bc6 Making panic level assertions more helpful 2014-11-06 08:42:52 -05:00
Dan Buch 9836f1ba0e Adding tests for PanicLevel behavior, plus changing behavior! 🙀 2014-11-05 20:39:35 -05:00