Commit Graph

44 Commits

Author SHA1 Message Date
Sébastien Lavoie 131eba2470
Merge pull request from CodeLingoBot/rewrite
Fix error formatting based on best practices from Code Review Comments
2019-03-11 10:33:21 -04:00
David Bariod 5c2b39a4f8 Remove debug trace 2019-03-03 11:52:04 +01:00
David Bariod 5e9b246bea Add a CallerPrettyfier callback to the json formatter 2019-02-27 13:02:20 +01:00
CodeLingo Bot 774bb8e43f Fix error formatting based on best practices from Code Review Comments
Signed-off-by: CodeLingo Bot <bot@codelingo.io>
2019-02-05 05:52:27 +00:00
David Bariod d2654b752f add file and line number in output when report caller is enabled 2018-10-28 17:39:39 +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 64d5b7e66c Merge branch 'master' into caller_feature 2018-10-27 15:10:52 +02: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 
2018-09-30 22:51:02 +02:00
David Bariod f3df9aeffd Merge branch 'master' of git://github.com/mariannefeng/logrus into mariannefeng-master 2018-09-08 11:18:16 +02:00
David Bariod 87dfa988d1 Merge branch 'json_use_buf_pool' of git://github.com/taylorchu/logrus into taylorchu-json_use_buf_pool 2018-07-28 11:01:11 +02:00
Przemyslaw Wegrzyn 2ce6c0cb44 Support for Entry data under nested JSON dictionary. 2018-06-19 14:31:57 +02:00
taylorchu aa6766adfe PERF: use buffer pool in json formatter
benchmark             old ns/op     new ns/op     delta
BenchmarkLogrus-8     4163          4369          +4.95%

benchmark             old allocs     new allocs     delta
BenchmarkLogrus-8     36             31             -13.89%

benchmark             old bytes     new bytes     delta
BenchmarkLogrus-8     3027          2163          -28.54%
2018-05-15 16:46:37 -07:00
Marianne Feng 723dd3cd1f changed prettyprinting to use spaces as opposed to /t 2018-03-20 18:20:51 -07:00
Lyra Naeseth efab7f37b7 Have prefixFieldClashes respect the JSON FieldMap
Currently, it will fix clashes that don't exist and miss clashes that
do exist due to field remapping.

Fixes 
2018-02-13 17:49:16 -08:00
Marianne Feng 639325f81a added pretty print option for json logs 2017-11-06 16:19:47 -08: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
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
dmathieu 325575f181 fix golint issues in formatters 2017-07-26 14:26:30 +02:00
Simon Eskildsen acfabf31db logrus: use lower-case in comments and examples 2017-05-12 15:21:58 -04:00
Mattias Lundell e3715134c9 Fixed small typo in example. 2017-05-05 14:18:10 +02: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 5840194571 Merge branch 'master' of https://github.com/Sirupsen/logrus
Conflicts:
	alt_exit_test.go
	json_formatter_test.go
2016-12-02 09:38:12 -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
Simon Eskildsen 42b84f9ec6 Merge pull request from mnzt/master
Renaming upper-case 'Sirupsen' to 'sirupsen'
2016-11-30 15:35:45 -05: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 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
Andrew Burian 1d329ad042 Added option to disable JSON timestamp
Tests verify both the default and disabled case.
2016-11-21 10:09:59 -08:00
Ryan Canty fcf4b8f229
Added comment documentation for FieldMap 2016-11-18 11:02:11 -08:00
Ryan Canty d5ca23f998
Added FieldMap to reduce potential struct bloat 2016-11-17 15:16:46 -08:00
Ryan Canty b2c6f8aa8b Added resolve method to clean up Format 2016-11-17 11:28:41 -08:00
Ryan Canty 2173899f8f Added customizable keys to JSON formatter 2016-11-16 21:56:00 -08:00
Toby a5dbcc756c
Renaming 'Sirupsen' to 'sirupsen' 2016-07-18 16:36:46 +01:00
Simon Eskildsen f1addc2972 formatter/json: fix possible race 2015-05-26 09:02:45 -04:00
Stephen J Day e14471f8f2 Allow configuration of timestamp layout
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2015-04-06 12:18:40 -07:00
Anton Tiurin 98fd21de2c [JSON] Use type-switch for error field 2015-03-10 19:04:57 +03:00
Simon Eskildsen 8287db7934 json_formatter: always cast errors to strings
Fixes 
2015-03-09 15:15:08 +00:00
Antoine Grondin 2835e150d9 fixes 2014-12-09 21:57:50 -05:00
Antoine Grondin c4cc714937 fix duplication of msg/time/level keys, add benchmarks. 2014-09-16 20:19:42 -04:00
Simon Eskildsen 2c0db7c868 formatter: drop internalFormatter 2014-07-26 22:22:39 -04:00
Simon Eskildsen 40069a98d6 entry: break out time, level and message from data 2014-07-26 21:34:29 -04:00
Simon Eskildsen 53371e3664 Add features from README 2014-03-10 19:22:08 -04:00