Commit Graph

987 Commits

Author SHA1 Message Date
noushavandijk 4f5fd631f1 Fix infinite recursion on unknown Level.String()
Using `%q` in the error string causes `MarshalText` to recurse (by calling String()).
2019-02-20 09:22:53 -08:00
David Bariod cdb2f3857c
Merge pull request #897 from antonfisher/patch-1
Add nested-logrus-formatter to README.md
2019-02-10 14:00:17 +01:00
David Bariod 1261c1f8a1
Merge pull request #903 from gavincabbage/entry-logf-level
prevent string formatting in Entry.Logf when log level is not enabled
2019-02-10 13:38:47 +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
Georgi Dimitrov 4ea4861398 Add a DeferExitHandler function
Useful for running exit handlers in the same order as defer statements
2019-01-29 10:29:38 -08:00
Anton Fisher 68a2b575f1
Add nested-logrus-formatter to README.md
Hi,
I'd like to propose another one third-party formatter for logrus (https://github.com/antonfisher/nested-logrus-formatter).
Thanks.
2019-01-26 14:16:28 -08:00
Richard Poirier 7d8d63893b
Merge pull request #893 from jiangxin/jx/fix-warningln
logger: fix wrong callback method
2019-01-22 11:28:20 -08:00
Jiang Xin f61e48bb8e logger: fix wrong callback method
Fix wrong callback in `logger.go`, and add test cases:

1. `logger.Warningln` should call `logger.Warnln`, not `logger.Warn`.

2. It's ok for `logger.Print` to call `entry.Info`, but calling `entry.Print`
   is better.

Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
2019-01-22 20:46:10 +08:00
David Bariod 659e47340e
Merge pull request #890 from sirupsen/hook_fire_order_test
Add a unit test to ensure hook are called in their registration order
2019-01-17 13:59:11 +01:00
David Bariod 0f544bf278 Add a unit test to ensure hook are called in their registration order 2019-01-17 13:42:39 +01:00
David Bariod 11dad09cee
Merge pull request #889 from sirupsen/default_field_hook
Add an example hook which adds default fields
2019-01-17 09:42:32 +01:00
David Bariod a99ca4776d Add an example hook which adds default fields 2019-01-17 09:37:03 +01:00
Sergey Romanov 78fb3852d9 Remove unused variables in TextFormatter 2019-01-11 11:22:21 -08:00
Rich Poirier eef6b768ab Update Changelog for 1.3.0 2019-01-04 17:46:35 -08: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 bd9534b799 Test Log 2019-01-02 14:59:36 -05:00
Lisa Ugray e8fd0ba609 Remove sensitivity to file line changes 2019-01-02 14:58:51 -05:00
David Bariod 6180652bb0
Merge pull request #878 from sirupsen/json_level_marshalling
Implement TextUnmarshaller interface for Level type
2018-12-26 17:51:57 +01:00
David Bariod ff695daa36 Implement TextUnmarshaller interface for Level type
Since the implementation of the TextMarshaller interface
we could not unmarshal previously json marshalled Level value.
Fixes #873
2018-12-26 17:43:14 +01:00
Lisa Ugray a6668e7a60 Add Generic Log functions with level via argument 2018-12-20 15:49:25 -05:00
David Bariod 2067ea4241
Merge pull request #874 from sirupsen/fieldErrorBugFix
do not clear error formatting informative field
2018-12-15 16:21:19 +01:00
David Bariod 9abefb94aa do not clear error formatting informative field 2018-12-14 17:01:34 +01:00
David Bariod 9f049671f1
Merge pull request #864 from ceriath/patch-1
Remove colored output on windows
2018-12-10 09:02:29 +01:00
Ceriath d962013756 respect ForceColor and environment variables over OS check 2018-12-09 21:47:44 +01:00
David Bariod 93ebe33ece
Merge pull request #870 from smacker/skip_func_pointer_type_value_in_fields
Skip func pointer type value in fields
2018-12-09 15:03:58 +01:00
David Bariod 3f1910655c
Merge pull request #868 from dolmen/fix-travis-import-path
Travis: fix checkout dir to help contributors run Travis on their fork
2018-12-07 06:46:55 +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
Olivier Mengué 0c5e33c7e0 Travis: fix checkout dir to help contributors run Travis on their fork
Set the Travis-CI checkout path to allow contributors running Travis-CI
on their fork to have Travis-CI launching using the canonical import
path instead of the path of the fork.
2018-11-25 23:15:12 +01:00
David Bariod 29d7eb25e8
Merge pull request #857 from h12w/master
fix race condition caused by writing to entry.Data
2018-11-22 07:14:47 +01:00
ceriath f1b98e4006
ignore expected color on windows 2018-11-16 15:19:37 +01:00
ceriath e9026580bf
Disable colored output on windows entirely
Currently the textformatter on windows outputs 

``←[31mERRO←[0m[0000] test windows``

when coloring is not disabled explicitly.
However, windows up to windows 8.1 does not support colored output on cmd entirely. Windows 10 added support for it, which is off by default and has to be enabled via registry or environment variable. Therefore i suggest removing colored output on windows entirely to make the output usable again.
2018-11-16 15:17:01 +01:00
David Bariod 91da99df23
Merge pull request #860 from xrstf/master
Fix hook example
2018-11-16 14:29:20 +01:00
David Bariod b0e671819e
Merge pull request #841 from sirupsen/fix_aix_build
Attempt to fix build break on aix
2018-11-16 14:26:04 +01:00
xrstf eab2c444ac fix hook example 2018-11-09 13:34:45 +01:00
Hǎi-Liàng "Hal" Wáng c7183bf629 fix missing parameter 2018-11-06 10:01:28 +00:00
Hǎi-Liàng "Hal" Wáng 2cafb78db2 fix race condition caused by writing to entry.Data, using the same technique as JSONFormatter 2018-11-05 12:35:02 +00:00
David Bariod 44067abb19 Merge remote-tracking branch 'upstream/master' 2018-11-03 07:28:19 +01:00
David Bariod 7eeb7b7cbd
Merge pull request #849 from FabienM/add-gelf-formatter
Add GELF to third party formatters
2018-11-01 08:55:17 +01:00
David Bariod bcd833dfe8 v1.2.0 changelog 2018-11-01 08:39:56 +01:00
David Bariod fd2308367e
Merge pull request #854 from sirupsen/fix_panic_text_formatter
fix panic in text formatter
2018-10-31 07:17:07 +01:00
David Bariod d10c2f9e3c fix panic in text formatter
The panic was caused to a nil pointer access when report
caller was activated with output coloring disabled

Fixes #852
2018-10-31 07:08:09 +01:00
David Bariod 566a5f6908
Merge pull request #845 from yanana/make-level-implement-text-unmarshaler
Make logrus.Level implement encoding.TextUnmarshaler
2018-10-29 07:08:39 +01:00
David Bariod 251d6bf713
Merge pull request #850 from sirupsen/caller_feature
Add optional log field with calling method
2018-10-28 18:17:14 +01:00
David Bariod 5a78c38d0e make file name comparison os independant 2018-10-28 18:12:32 +01: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 fa01b53097 move test functions and test utils functions in their own package 2018-10-28 14:22:33 +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 5fcd19eae6 add a SetReportCaller on Logger object 2018-10-27 15:19:06 +02:00
David Bariod 64d5b7e66c Merge branch 'master' into caller_feature 2018-10-27 15:10:52 +02:00