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
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
Patrick Hemmer
e2dff63faa
Add missing `(*Entry) Warning()` function
2015-01-12 17:20:11 -05:00
Dan Buch
9836f1ba0e
Adding tests for PanicLevel behavior, plus changing behavior! 🙀
2014-11-05 20:39:35 -05:00
Dan Buch
f302a46d2a
Switching to io.MultiWriter for clarity
2014-11-05 14:07:40 -05:00
Dan Buch
ced531341e
Saving off entry string for use in panic
...
as the reader is not seekable and without this the panic string is
always empty 🙀
2014-11-05 13:49:58 -05:00
Antoine Grondin
938dffa0e0
hooks: lock on the logger before printing to stderr, printf args
2014-10-21 19:26:29 -04:00
Markus Zimmermann
5573f97efc
fix some typos
2014-10-16 14:43:18 +02:00
Simon Eskildsen
3b5af9a6dc
entry: add comment to panic comparison in log()
2014-09-25 03:08:26 +00:00
Simon Eskildsen
51ca046ebf
Merge pull request #65 from pquerna/remove_unused_string
...
Only convert []bytes into a String() when needed for a panic
2014-09-24 23:06:38 -04:00
Paul Querna
f96066e3bf
Only convert []bytes into a String() when needed for a panic, and not on other log levels
2014-09-23 17:05:07 -07:00
Antoine Grondin
c4cc714937
fix duplication of msg/time/level keys, add benchmarks.
2014-09-16 20:19:42 -04:00
Antoine Grondin
d35b1c983e
text-formatter: assume that IsTerminal doesn't change during execution
2014-09-16 17:19:03 -04:00
Simon Eskildsen
cfddc66325
entry: document entry and methods
2014-07-26 21:37:06 -04:00
Simon Eskildsen
40069a98d6
entry: break out time, level and message from data
2014-07-26 21:34:29 -04:00
Simon Eskildsen
f0cb18fc85
entry: use level string helper
2014-07-26 21:03:20 -04:00
Antoine Grondin
e5621dca87
Export package func to a standard logger.
2014-07-21 21:19:55 -04:00
Shuhao Wu
7a3a90cb3d
Added test
2014-06-09 11:54:10 -04:00
Shuhao Wu
511792f912
Added support to chain withfields
...
`WithField` and `WithFields` right now doesn't chain properly. Meaning
that if you do something like:
localLog := logger.WithField("tag", "value")
localLog.WithField("v1", "value").Info("message1")
localLog.Info("message2")
The `v1` will be carried over to `message2`.
With this patch, each WithField/WithFields call are isolated.
2014-06-09 11:32:20 -04:00
Simon Eskildsen
13600d2325
text_formatter: move relative time logic from entry
2014-05-03 20:43:55 -04:00
Simon Eskildsen
11a9ddab08
entry: remove duplicate hook for debug level
2014-05-03 20:42:28 -04:00
Simon Eskildsen
d85ac80aa9
entry: log with spaces between all operands on *ln #25
2014-05-03 20:20:07 -04:00
Simon Eskildsen
eeed235659
entry: fire hook before obtaining reader #24 #13
2014-05-02 10:08:54 -04:00
Simon Eskildsen
b73d08314f
entry: make logger on entry public
2014-04-23 16:54:53 +00:00
Sarah Adams
3719c88c8f
code builds -- fixes incorrect use of entry.Info, change to entry.Infof
2014-03-25 22:51:40 -07:00
Anthony Bishopric
9f6da0e77c
Defer formatting of log values in Levelf(), Levelln()
...
The Level() family of log methods defer formatting of log
values until it is confident that the log level needs them.
This change allows that deferral to happen at the Levelf()
and Levelln() levels too.
This commit also adds benchmarks to demonstrate the improved
performance of these functions
2014-03-25 14:54:31 -07:00
Simon Eskildsen
1e8a799618
entry: move hook firing to entry.log
2014-03-12 10:10:22 -04:00
Simon Eskildsen
ec306913da
Fix example
2014-03-10 19:59:18 -04:00
Simon Eskildsen
afde6aea11
levels: add to logger type
2014-03-10 19:52:39 -04:00
Simon Eskildsen
53371e3664
Add features from README
2014-03-10 19:22:08 -04:00
Simon Eskildsen
f803b61ca1
entry: keys colored by severity
2014-03-06 09:56:52 -05:00
Burke Libbey
e3978aa87c
morehax
2014-03-04 11:44:09 -05:00
Burke Libbey
ce9bacf7b3
quickhax
2014-03-04 11:38:21 -05:00
Simon Eskildsen
3ef01c6291
entry: don't panic
2014-03-03 17:35:32 -05:00
Simon Eskildsen
b7027167d5
entry: add basic coloring if tty is a terminal
2014-03-03 17:33:35 -05:00
Simon Eskildsen
11dbaff352
Code review fixes
2014-02-24 06:34:12 -05:00
Simon Eskildsen
0bd36d372c
code cleanup
2014-02-23 19:53:50 -05:00
Simon Eskildsen
6c895096e8
split into multiple files
2014-02-23 19:50:42 -05:00