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
earlzo
1893e9a3ed
Fixed: comment
2018-02-20 16:28:12 +08:00
Jay Ching Lim
be569094e9
Make fireHooks() method receive a copy of Entry structure to avoid race conditions
...
Signed-off-by: Jay Ching Lim <imjching@users.noreply.github.com>
2018-02-12 17:26:48 -05:00
Michael Haines
eeb653535c
Lock mutex before formatting to avoid race
2018-02-05 12:44:11 -07: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
Dave Clendenan
40f571805d
Merge branch 'master' of https://github.com/dclendenan/logrus
2017-08-30 15:43:36 -07:00
Dave Clendenan
eab1019f63
Merge branch 'master' of https://github.com/sirupsen/logrus
2017-08-30 15:39:09 -07:00
Aditya Mukerjee
c830992a61
Take lock on mutex when firing hooks
2017-08-17 15:22:06 +01:00
Dave Clendenan
3cb9e18ef9
test updates
...
- add tests for callers accessed directly or via function pointer
(results are unchanged)
- undo unwanted capitalization/export in previous commit
2017-08-02 17:21:18 -07:00
Dave Clendenan
7d48cb786e
Merge branch 'master' of https://github.com/sirupsen/logrus
...
Conflicts:
alt_exit_test.go
formatter.go
json_formatter.go
2017-08-02 13:18:39 -07:00
DmitriyMV
95002bc717
Improve logrus.Entry.Level documentation
2017-07-14 15:04:50 +03:00
DmitriyMV
3bcb09397d
This commit fixes data race using atomics. We switch type of level from uint8 to uint32 but due memory alignment on most platforms it will not result in any additional memory.
2017-03-23 19:13:49 +03:00
Dave Clendenan
88dd8df1f8
responses to code review
...
- field rename to be more properly generic
- drop rewrite of main.main
2016-12-06 12:53:21 -08:00
Dave Clendenan
f08011a10f
merge upstream, add tests, full method context
...
- added benchmarks, and assertions for timeliness
- replaced regex usage in package-name handling with a straight
comparison to a cached value
- log the fullly-qualified method name, to remove ambiguity
eg: github.com/fflintstone/yabba.dabba.doo
- clean up possibly-unsafe assumptions about using the standard logger,
remove global lookup function to enforce safe usage
2016-12-01 10:23:00 -08:00
Dave Clendenan
65f3af38f7
simplify hasCaller check
2016-11-30 15:15:38 -08:00
Dave Clendenan
a5c845c224
responses to review comments
...
- empty string as marker for failure to discover calling function
- tighten up logger usage - don't rely on std logger internally
Also fix ordering of expected/got in logrus_test.go to ensure correct
output form test failures.
2016-11-30 14:07:10 -08:00
Dave Clendenan
4575b7a64d
revert slight added complexity in NewEntry()
2016-11-30 11:36:48 -08:00
Dave Clendenan
348bace269
doc updates, and relabel ReportMethod
...
in the Logrus context it's the caller, so use that internally. Label
stays as 'method' since in the context of the log event that seems more
correct.
2016-11-29 09:35:34 -08:00
Dave Clendenan
1e21450408
push compilation even higher, to reduce to one call
2016-11-28 16:22:33 -08:00
Dave Clendenan
8161d932a1
performance: precompile regex before iterating
2016-11-28 14:47:38 -08:00
Dave Clendenan
93af604ba7
First cut at adding calling method
...
If log.SetReportMethod(true) then method=PACKAGE.FUNCTION will be added
as a field to log lines.
eg: time="2016-11-25T19:04:43-08:00" level=info method=main msg="log
testing"
TODO: documentation, examples
2016-11-25 19:02:56 -08:00
plan
69df0d2ed7
Use Buffer pool to allocate bytes.Buffer for formatter
...
Entry.Reader() seams not necessary, removed
2016-08-11 01:35:34 +08:00
Aaron Greenlee
a7755c5c03
Enhanced fatal calls so exit handlers can be invoked
...
While GO offers the ability to recover from panic there is no way to intercept an os.Exit event. To allow graceful shutdown and clean-up or programs which use Logrus to Fatal out I've borrowed ideas from the `atexit` package and enhanced Logrus.
Usage:
* When setting up the logger one call `RegisterExitHandler( func() {...} )` to add a handler that will be invoked for any `Fatal` call to the logger.
2016-06-24 10:23:56 -04:00
Dimitrij Denissenko
b81f34e70a
Avoid re-allocations
2016-03-15 07:39:40 +00:00
Antoine Grondin
38c9fd2510
Revert "Implement casting of *Entry to error."
...
This reverts commit 756db3cd2d
.
2015-09-07 20:47:46 -04:00
Antoine Grondin
c639bedcac
Merge pull request #179 from yawn/with-error
...
Added WithError(err)
2015-09-06 01:34:49 -04:00
Marcos Lilljedahl
8280b8b9a6
Add comment to log function
...
Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
2015-08-07 18:29:20 -03:00
Marcos Lilljedahl
35f12fb760
Fix panic return type
...
Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
2015-08-06 21:19:22 -03:00
Marcos Lilljedahl
396f8eefaa
Make log method receive a copy of Entry structure to avoid race
...
conditions
Fixes #216
Signed-off-by: Marcos Lilljedahl <marcosnils@gmail.com>
2015-08-06 21:01:47 -03:00
Simon Eskildsen
aa3ad346e4
Revert "Merge pull request #208 from Arkan/master"
...
This reverts commit 7eac5879a5
, reversing
changes made to c79ccaf8c2
.
2015-07-23 21:45:57 -04:00
Arkan
0be4ee004c
Fix Entry log level
2015-07-06 22:27:39 +02:00
Madhav Puri
c0ea7891cd
Fix Fatalf() and Fatalln() to exit irrespective of log level
...
Signed-off-by: Madhav Puri <madhav.puri@gmail.com>
2015-05-26 14:01:33 -07:00