Commit Graph

120 Commits

Author SHA1 Message Date
David Bariod 5f8c666a13 Improve Log methods documentation 2021-09-12 16:03:49 +02:00
Qingshan Luo 1818363d79 Add support for the logger private buffer pool. 2021-04-20 10:48:30 +08:00
David Bariod d172886045 fix race condition AddHook and traces 2021-02-17 18:14:05 +01:00
David Bariod 5cb4bf65c6 code and comments clean up 2021-02-16 18:13:03 +01:00
David Bariod ac6e35b4c2 fix for entry data field race condition 2021-02-16 10:31:51 +01:00
Alec Benzer 02fcb16005 Remove dead panic in Entry.Panic
[Entry.log itself panics][0] when the log level is set to PanicLevel, (and
PanicLevel is always eneabled) so this second panic will never be reached.

[0]: 8ae478eb8a/entry.go (L253)
2020-12-15 18:25:34 -05:00
David Bariod e328a4e3f4 fix linter errors 2020-11-08 07:07:05 +01:00
David Bariod 64a59449f3 Add an API to plug a custom buffer free item mangement system 2020-05-28 10:47:50 +02:00
Mark Phelps 03155c5499 Revert #1047 2020-04-16 11:13:51 -04:00
Mark Phelps d417be0fe6
Merge pull request #1108 from cirelli94/fix-wrong-caller
Fix wrong caller
2020-03-22 09:43:59 -04:00
Alisdair MacLeod e3e40605a2 remove errant whitespace 2020-03-19 10:02:20 +00:00
Alisdair MacLeod ba670baee1 fix deadlock in previous entry race condition fix 2020-03-19 10:01:29 +00:00
Alisdair MacLeod b28acda22d fix race condition in entry 2020-03-19 09:32:08 +00:00
Fabrizio Cirelli af6ac8cee6 Fix wrong caller 2020-03-09 12:39:00 +01:00
Alex S 86a84a9d18 Get right logrus package name 2020-03-02 21:47:38 +08: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
Sébastien Lavoie 24566a3fc4
Merge pull request #924 from bunyk/master
Add hook to send logs to custom writer #678
2020-02-26 17:31:00 -05: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
David Bariod b77b626665 run golangci-lint on travis 2019-10-25 14:49:48 +02:00
lwsanty c7278b2d7a fix race conditions on entry
closes #1046
2019-10-23 20:55:57 +03:00
Edward Muller 60320cbc2c
return early
This makes it easier to read / understand and is more idiomatic.
2019-09-05 16:09:16 -07:00
tbunyk 8b0b8a88f2 Merge remote-tracking branch 'upstream/master' 2019-09-03 15:29:19 +03:00
Haoran Xu 38bc297a3d return new entry for Entry.WithContext 2019-03-29 14:04:26 +08:00
tbunyk c88f8de1fe Add Bytes() method to Entry, and use it to avoid double type cast 2019-03-18 16:07:31 +02:00
Adam Renberg Tamm 68e41f673a Add WithContext 2019-03-11 15:38:19 +01:00
David Bariod cf1b9fd15e fix sync.Once usage instead of adding a mutex lock 2019-03-06 14:08:02 +01:00
georlav b9d451406d fix ReportCaller race condition 2019-03-04 20:58:21 +02:00
David Bariod 5e9b246bea Add a CallerPrettyfier callback to the json formatter 2019-02-27 13:02:20 +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
Richard Poirier e1e72e9de9
Merge pull request #863 from lugray/generic_log
Add Generic Log functions with level via argument
2019-01-02 14:40:11 -08:00
Lisa Ugray a6668e7a60 Add Generic Log functions with level via argument 2018-12-20 15:49:25 -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
David Bariod ec57031db1 store a runtime.Frame in Entry instead of the caller function name 2018-10-28 14:21:49 +01:00
David Bariod 975c406ddb Use a sync.Once to init the reportCaller data 2018-10-27 15:21:30 +02:00
David Bariod 64d5b7e66c Merge branch 'master' into caller_feature 2018-10-27 15:10:52 +02:00
Maxim Korolyov ef9d84e9b3 Added trace log level. 2018-10-17 19:42:01 -07:00
drampull 4981d8161c Added TRACE level logging. 2018-10-17 18:22:00 -07:00
Albert Salim 2be620216a Add option to panic in `test.NewNullLogger` to allow testing of
calls to `Fatal*`

See #813
2018-10-06 18:08:19 +08:00
David Bariod 7b467df697 Skip func type value in fields.
We skip those unprintable fields and an error field
instead of dropping the whole trace.

Fixes #642
2018-09-30 22:51:02 +02:00
William Huang 88eb166d31
Fix spelling in Entry.Buffer comment 2018-09-06 21:11:16 -05:00
Logan HAUSPIE 90bf2e7f39
feat(LogLevel): taking in account code review from David Bariod 2018-08-27 00:16:06 +02:00
Logan HAUSPIE 0ab534bf6c
Merge remote-tracking branch 'upstream/master' 2018-08-26 23:36:08 +02:00
David Bariod c108f5553c Merge branch 'field-logger-with-hooks-race' of git://github.com/thundercat1/logrus into master 2018-07-23 13:53:07 +02:00
David Bariod 3e01752db0 Merge branch 'moriyoshi/refix-707' of git://github.com/moriyoshi/logrus into fix_firehooks 2018-07-21 09:00:01 +02:00
Simon Brisson 725f3be199 Adds WithTime to Logger and Entry types, as well as a pure module-level function. 2018-07-12 13:25:17 -04:00
Simon Brisson 52b92f5b89 Allows overriding Entry.Time. 2018-07-03 11:38:02 -04:00
Logan HAUSPIE 4225d694ba
feat: new methods to check enabled log level
Adding 6 methods on 'exported', 'logger' and 'entry':
- IsDebugEnabled() bool
- IsInfoEnabled() bool
- IsWarnEnabled() bool
- IsErrorEnabled() bool
- IsFatalEnabled() bool
- IsPanicEnabled() bool

Replace duplicated 'if logger.level() >= XxxxLevel' by a call to the new methods in 'logger' and 'entry'

Closes #761
2018-06-06 22:45:35 +02:00
Moriyoshi Koizumi 070c81def3 Revert the change introduced in #707 and do the proper fix. Fixes #729 2018-05-30 09:50:59 +00:00
Dave Clendenan c74e39f432
Merge branch 'master' into master 2018-03-08 15:53:25 -08:00