Commit Graph

526 Commits

Author SHA1 Message Date
Aaron Lehmann f76d643702 Fix formatting of wrapped errors when colors are used
There are two different code paths for rendering a key/value pair. The
non-color version uses a type switch that handles specific types such as
"error", and the color version uses the %+v printf format specifier.
This causes an inconsistency between the two formats. In particular,
errors created using the github.com/pkg/errors package will include a
stack trace of where the error was created when printed to the terminal,
but not to a file. Printing the stack trace as part of the log field is
probably not the right behavior.

The output is also inconsistent between the two forms because strings
are not quoted/escaped when colors are used. This can make log output
unparseable.

Fix this by making both code paths use the type switch and escaping
rules. Fix the escaping code to pass the error value to Fprintf, not the
error itself, which seems to be necessary to avoid blank output with
errors created by github.com/pkg/errors.
2016-09-28 13:48:28 +01:00
Simon Eskildsen 3ec0642a7f Merge pull request #343 from kaneshin/appengine-support
terminal: Include appengine tag to compile for GAE
2016-08-29 16:23:21 -04:00
Aaron Greenlee 08a8a7c27e Merge pull request #370 from frostyplanet/bufferpool
Optimise speed
2016-08-13 11:40:05 -04:00
Aaron Greenlee 58d2a6a703 Merge pull request #358 from gpolaert/patch-1
Add new hook for Logmatic.io
2016-08-13 11:39:25 -04:00
plan 53cbb9dc6d Reuse entry from the same logger 2016-08-11 01:51:00 +08:00
plan 4c4ffbea17 Add document for logger.SetNoLock() 2016-08-11 01:51:00 +08:00
plan bc35b026f0 Provide logger.SetNoLock() to remove locking during log output
Locking is enabled by default. When file is opened with appending mode,
it's safe to write concurrently to a file. In this case user can
choose to disable the lock.
2016-08-11 01:35:34 +08:00
plan cb2bda2c54 Add benchmark for logger 2016-08-11 01:35:34 +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 a283a10442 Improved documentation of Fatal Handlers 2016-07-15 22:56:31 -04:00
Aaron Greenlee 1d4b5462f8 Merge pull request #375 from powerchordinc/master
Added Support to Call Handlers on Fatal
2016-07-15 22:42:55 -04:00
Aaron Greenlee fcebd8de86 Merge pull request #356 from tevino/patch-1
Corrected a comment's typo
2016-07-15 22:20:23 -04:00
Simon Eskildsen 32055c351e Merge pull request #382 from lpetre/remove_logstash_formatter
Removing logstash formatter
2016-07-12 20:17:32 -04:00
Luke Petre 4ee95f9462 Removing logstash formatter 2016-07-12 21:23:56 +01:00
Aaron Greenlee 357c4eae02 Revised import path of logrus for pull-request CI 2016-06-24 10:49:02 -04:00
Aaron Greenlee ff52e76f67 Go fmt alt exit addition 2016-06-24 10:24:56 -04: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
Simon Eskildsen f3cfb454f4 readme: fix example 2016-06-01 07:32:10 -04:00
Simon Eskildsen 6d9ae300aa Merge pull request #360 from morenoh149/patch-1
change 'log' -> 'logrus'
2016-05-24 09:24:53 -04:00
Harry Moreno 67fb1f35e6 change 'log' -> 'logrus'
Change 'log' -> 'logrus' to fix syntax error
2016-05-23 19:54:24 -04:00
Guillaume Polaert 93985e4b77 Add new hook for Logmatic.io
Logmatic.io is Saas-based log management solution.
We develop a simple hook in order to send your Logrus logs straight to Logmatic.io
2016-05-17 17:38:10 +02:00
Tevin Zhang 18073362a7 Fix comment 2016-05-06 11:48:51 +08:00
Antoine Grondin cd7d1bbe41 Merge pull request #350 from apriendeau/update-travis
add go 1.6 to travis
2016-04-25 11:32:37 +02:00
Austin Riendeau 621d3983b3 add go 1.6 to travis 2016-04-18 11:14:45 -06:00
Antoine Grondin 081307d9bc Merge pull request #348 from Sirupsen/semantic-match-func-name
match name to semantic in `needsQuoting`
2016-04-16 13:51:37 +05:30
Antoine Grondin 754bfa9e83 match name to semantic in `needsQuoting`
fixes #196
2016-04-16 13:48:56 +05:30
Antoine Grondin 2b673abc1e Merge pull request #347 from Sirupsen/level-writer
Add WriterLevel() function to the logger
2016-04-16 12:50:33 +05:30
Antoine Grondin 218981bef4 use constant InfoLevel instead of 255 2016-04-16 12:46:11 +05:30
Damien Radtke 1d1fd2d9ce Add WriterLevel() function to the logger
This commit adds a variant of the logger's Writer() function that
accepts a log level. When the variant is used, any messages written to
the returned pipe will be written with the provided level. The original
Writer() function uses the logger's Print() method as it always has.
2016-04-16 12:45:27 +05:30
Antoine Grondin 870c1fc2ca add logstash hook to readme
closes #339
2016-04-16 12:42:53 +05:30
Antoine Grondin 881c9d3328 Merge pull request #298 from dolmen/refactor-prefixFieldClashes
formatter.go: simplify prefixFieldClashes(Fields)
2016-04-16 12:23:30 +05:30
Antoine Grondin ed4b7af3d4 Merge pull request #346 from e-max/logstash_formatter_race
race in logstashformatter.go
2016-04-16 11:52:44 +05:30
Max Lavrenov 8a870e4f7b fix race 2016-04-15 18:22:24 +03:00
Simon Eskildsen 7e6f976580 Merge pull request #341 from doublefree/add_smologic_hook_readme
Sumorus - SumoLogic Hook url added to readme
2016-04-13 08:47:20 -04:00
Simon Eskildsen 889e5d7019 Merge pull request #344 from vlad-doru/vlad-doru-logrusus-readme
Add a new InfluxDB Hook
2016-04-13 08:47:11 -04:00
Vlad-Doru Ion 0d667bc0c7 Added a new hook to the README.md
Added the logrusus hook.
2016-04-04 10:58:58 +03:00
Shintaro Kaneko dfb0e1d797 terminal: Include appengine tag to compile for GAE 2016-04-02 05:06:31 +00:00
takuya.watabe 5eb315cfd5 Sumorus - SumoLogic Hook url added to readme 2016-03-31 00:20:06 +09:00
Simon Eskildsen 4b6ea7319e changelog: update for 0.10.0 2016-03-17 14:11:10 +00:00
Simon Eskildsen 897f3dddf1 Rename LogrusLogger interface to FieldLogger 2016-03-17 14:07:00 +00:00
Simon Eskildsen bb78923f27 Merge pull request #320 from little-arhat/feature-logrus-interface
Add LogrusLogger interface for Entry and Logger
2016-03-17 10:01:39 -04:00
Simon Eskildsen e110284865 Merge pull request #325 from spicydog/patch-1
Update README.md
2016-03-17 10:01:08 -04:00
Simon Eskildsen 9ccfbde280 Merge pull request #335 from dim/master
Avoid re-allocations
2016-03-17 09:56:47 -04:00
Simon Eskildsen 70d89df0fa Merge pull request #336 from sohlich/master
Hook for ElasticSearch.
2016-03-17 09:55:16 -04:00
Radomír Sohlich b8b6593e80 Hook for ElasticSearch.
Added a link for ElasticSearch hook.
2016-03-16 20:34:53 +01:00
Dimitrij Denissenko b81f34e70a Avoid re-allocations 2016-03-15 07:39:40 +00:00
Simon Eskildsen a26f43589d Merge pull request #333 from dragon3/add-typetalk-hook
Add Typetalk hook
2016-03-11 15:57:46 -05:00
dragon3 ea350e0221 Add Typetalk hook 2016-03-09 23:13:41 -05:00
Simon Eskildsen 219c8cb75c Merge pull request #330 from f2prateek/patch-1
Fix Godoc link
2016-02-24 16:10:30 -05:00
Prateek Srivastava 6d7aacc216 Fix Godoc link
Previous https://cloudup.com/cZnP3-jZ9O8
2016-02-24 14:05:45 -07:00