Commit Graph

850 Commits

Author SHA1 Message Date
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
Simon Eskildsen ea8897e799
Merge pull request #758 from dgsb/hook_wiki
Move the hook services list to a wiki page
2018-05-23 03:42:43 -04:00
David Bariod 098a5a7cd7 Move the hook services list to a wiki page 2018-05-19 21:26:32 +02:00
Matej Baćo caed59ec68
Fix Logger.WithField doscription
I was puzzled by function documentation not mentioning it works with Error level, so I had to check it out by creating example before I add logrus as a dependency on the company project. Example confirmed what logic was telling me that Logger.WithFields works with Error level of logs.
This is is a fix of this small documentation oversight.
2018-05-17 11:02:39 +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
Simon Eskildsen 0dad3b6953
Merge pull request #752 from dgsb/bug/751
Fix a race condition in TestLoggingWithHooksRace
2018-05-15 11:40:58 -04:00
Simon Eskildsen bde08903c7
Merge pull request #744 from dbs5/master
added Anexia CloudLog to list of hooks
2018-05-15 00:41:40 -04:00
Simon Eskildsen 7971176ef8
Merge pull request #748 from LyricTian/master
add mysql hook
2018-05-15 00:41:24 -04:00
Simon Eskildsen 620a8739dc
Merge pull request #754 from dgsb/bug/753
Update go versions in travis configuration.
2018-05-15 00:41:04 -04:00
David Bariod b1e82bef65 Update go versions in travis configuration.
We only keep the latest 3 language release.
Fixes #753
2018-05-13 10:29:45 +02:00
David Bariod 8369e2f077 Fix a race condition in TestLoggingWithHooksRace 2018-05-12 15:52:19 +02:00
lyric 507c822874 add mysql hook 2018-04-27 17:53:47 +08:00
dbs5 e63a8df340 added Anexia CloudLog to list of hooks 2018-04-16 20:20:18 +02:00
David Bariod 5513c60034 Improve documentation for Fatal* class functions 2018-04-16 14:16:44 +02:00
Stephen Day 778f2e774c
Merge pull request #407 from roganartu/master
Added option to disable level text truncation in default text formatter
2018-03-29 15:59:52 -07:00
Stephen Day a0285bf3ac
Merge pull request #709 from silverlyra/dynamic-clash
Have prefixFieldClashes respect the JSON FieldMap
2018-03-29 14:32:20 -07:00
Stephen Day 6ecf50095b
Merge pull request #713 from earlzo/hotfix/wrong-comment
Fixed: wrong comment for NewEntry
2018-03-29 14:30:34 -07:00
Stephen Day 7406e22f35
Merge pull request #726 from wla80/master
Fix run-on sentence
2018-03-29 14:30:08 -07:00
Stephen Day 41f384185c
Merge pull request #739 from hondrus/patch-2
delete dead link
2018-03-29 14:22:02 -07:00
Olzhas Ilyubayev 19b9c9e1ff
delete dead link
https://github.com/ripcurld00d/logrus-logzio-hook isn't available now
2018-03-28 12:10:14 +06:00
Wilson b537da569f Fix run-on sentence 2018-03-22 14:05:31 -07:00
Stephen Day 90150a8ed1
Merge pull request #711 from oxgrouby/master
reamde: add logrus-clickhouse-hook
2018-03-14 18:07:03 -07:00
Simon Eskildsen c155da1940 changelog: add 1.0.5 2018-03-11 18:51:37 -04:00
Stephen Day f4ee691250
Merge pull request #722 from dylanmei/add-kafka-rest-proxy-hook
Add Kafka REST Proxy hook to README
2018-02-28 14:01:33 -08:00
Stephen Day 796df9f552
Merge pull request #717 from gracenoah/gopherjs
add gopherjs build tag
2018-02-28 13:44:18 -08:00
Dylan Meissner 91b159d34d Add Kafka REST Proxy hook to README 2018-02-27 16:51:24 -08:00
Grace Noah c840e59446 add gopherjs build tag
it behaves the same way as the appengine tag

fix #716
2018-02-23 21:35:25 +00:00
earlzo 1893e9a3ed Fixed: comment 2018-02-20 16:28:12 +08:00
Andrew Rezcov f4118d2ead reamde: add logrus-clickhouse-hook 2018-02-16 16:50:54 +03: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 #708
2018-02-13 17:49:16 -08:00
Simon Eskildsen 8c0189d9f6
Merge pull request #707 from imjching/logger-with-hooks-race
Fix race condition in entry fireHooks() method
2018-02-13 09:31:10 -05: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
Stephen Day 9f91ab2ef9
Merge pull request #704 from phillipj/patch-1
Fix typo in README.md
2018-02-07 10:27:17 -08:00
Stephen Day dcf2d47dfb
Merge pull request #697 from jjcollinge/patch-1
Add Application Insights hook to README
2018-02-06 17:40:45 -08:00
Phillip Johnsen 178041e53c
Fix typo in README.md 2018-02-05 21:59:23 +01:00
Michael Haines 828a649ef2 rename fieldLogger to entry 2018-02-05 12:52:11 -07:00
Michael Haines eeb653535c Lock mutex before formatting to avoid race 2018-02-05 12:44:11 -07:00
Michael Haines efbfdb5f09 Add failing test for using a FieldLogger with hooks inside goroutines 2018-02-05 12:42:00 -07:00
Joni Collinge 0cf9f0bff9
Made text consistent with other hooks 2018-01-30 16:00:33 +00:00
Joni Collinge 516f6c178d
Add Application Insights hook to README
Adds README link to Application Insights hook
2018-01-30 15:58:49 +00:00
Antoine Grondin 768a92a026
Merge pull request #695 from mauricio/master
Fix deadlock on panics at Entry.log
2018-01-29 20:18:52 +02:00
Tony Lee 269eab0f22
Merge branch 'master' into master 2018-01-23 23:04:29 -05: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
Dennis de Reus 92aece568b TextFormatter behaviour aligned with stdlib log (fixes #167)
stdlib `log` adds a newline at the end of a message if none is present,
otherwise does not. Before this change logrus would always add
a newline, resulting in inconsistent behaviour if stdlib log was
replaced with logrus, and a user would e.g. use 'log.printf("test\n")'
2017-12-29 20:26:35 +01:00
conor eb156905d7 remove .gitignore changes and update AddHook 2017-12-21 14:16:49 -05:00
conor 20cc8e2bc3 remove .gitignore changes 2017-12-21 14:10:48 -05:00
conor 0c03a05a0e mirror and wrap Logger instance methods in exported.go 2017-12-21 14:04:49 -05:00
Simon Eskildsen d682213848 changelog: 1.0.4 2017-12-05 15:32:29 -05:00
Simon Eskildsen 49f0a85ee5
Merge pull request #635 from ernestoalejo/master
Split terminal check to add build tags to support App Engine.
2017-12-05 15:30:37 -05:00