Commit Graph

1158 Commits

Author SHA1 Message Date
tbunyk d8e3add56f Add hook to send logs to custom writer #678 2019-03-15 13:09:11 +02:00
Kirill Motkov 1487633cc3 Rewrite if-else-if-else to switch statements 2019-03-13 12:38:09 +03:00
Adam Renberg Tamm dae0fa8d5b
Merge pull request #920 from sirupsen/changelog-v140
Add CHANGELOG for v1.4.0
2019-03-11 17:20:41 +01:00
Adam Renberg Tamm 02141df9f0 Add CHANGELOG for v1.4.0 2019-03-11 16:27:44 +01:00
David Bariod 5bd5a315a5
Merge pull request #919 from tgwizard/entry-context
Add WithContext
2019-03-11 15:47:26 +01:00
Adam Renberg Tamm 68e41f673a Add WithContext 2019-03-11 15:38:19 +01:00
Sébastien Lavoie 131eba2470
Merge pull request #901 from CodeLingoBot/rewrite
Fix error formatting based on best practices from Code Review Comments
2019-03-11 10:33:21 -04:00
David Bariod d7b6bf5e4d
Merge pull request #916 from sirupsen/fix_race_getcaller
Fix race getcaller
2019-03-06 14:14:08 +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 c9b4f5af6d
Merge pull request #913 from sirupsen/example_caller_prettyfier
Example caller prettyfier
2019-03-03 12:00:21 +01:00
David Bariod 99a5172d62 Add and example for CallerPrettyfier 2019-03-03 11:53:51 +01:00
David Bariod 5c2b39a4f8 Remove debug trace 2019-03-03 11:52:04 +01:00
David Bariod fa3c1df513
Merge pull request #911 from sirupsen/caller_prettyfier_text_formatter
Add a CallerPrettyfier callback to the text formatter
2019-02-27 13:42:49 +01:00
David Bariod ffec2f2e0a Add a CallerPrettyfier callback to the text formatter 2019-02-27 13:35:45 +01:00
David Bariod cbce296565
Merge pull request #909 from sirupsen/caller_prettyfier
Add a CallerPrettyfier callback to the json formatter
2019-02-27 13:13:02 +01:00
David Bariod 5e9b246bea Add a CallerPrettyfier callback to the json formatter 2019-02-27 13:02:20 +01:00
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
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
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