Commit Graph

558 Commits

Author SHA1 Message Date
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
Dave Clendenan 4575b7a64d revert slight added complexity in NewEntry() 2016-11-30 11:36:48 -08:00
Dave Clendenan 05a8f4db95 fix test description 2016-11-30 10:47:03 -08:00
Dave Clendenan 962ceebd51 Merge branch 'master' of https://github.com/Sirupsen/logrus 2016-11-29 09:46:00 -08: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 1e21450408 push compilation even higher, to reduce to one call 2016-11-28 16:22:33 -08:00
Stephen Day e400ff7861 Merge pull request #447 from stevvooe/revert-example-compilation
Compile examples filtered in #439
2016-11-28 14:57:24 -08:00
Dave Clendenan 8161d932a1 performance: precompile regex before iterating 2016-11-28 14:47:38 -08:00
Dave Clendenan 473c3448ab Add README notes and CHANGELOG entries
documentation for usage of the new optional calling-method logging
2016-11-28 13:43:38 -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
Stephen J Day 6ecd392994
travis: build Go 1.7 as well, removed by revert
Signed-off-by: Stephen J Day <stephen.day@docker.com>
2016-11-23 16:20:51 -08:00
Stephen J Day a89950b151 Revert "Updated .travis.yml to ignore /examples/"
This reverts commit 140886f9dc.
2016-11-23 16:19:58 -08:00
Stephen Day a437dfd246 Merge pull request #396 from onetwopunch/customzable-json-keys
Added customizable keys to JSON formatter
2016-11-18 11:45:39 -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
Simon Eskildsen abc6f20dab Merge pull request #440 from gemnasium/add-pglogrus
Add pglogrus to README
2016-11-11 07:09:51 -05:00
Simon Eskildsen 528e33852c Remove legacy go versions 2016-11-11 07:09:38 -05:00
Simon Eskildsen 1445b7a382 Merge pull request #439 from irfansharif/pre-go1.6-builds
Updated .travis.yml to ignore /examples/
2016-11-08 14:08:11 -05:00
Philippe Lafoucrière 65aed8c493 Add pglogrus to README 2016-11-03 21:59:20 -04:00
Simon Eskildsen d264929707 Merge pull request #419 from aaronlehmann/fix-error-formatting
Fix formatting of wrapped errors when colors are used
2016-11-03 17:40:07 -04:00
irfan sharif 140886f9dc
Updated .travis.yml to ignore /examples/
/examples/hook/hook.go with it's child dependency on airbrake/gobrake is
not backwards compatible pre-go1.6 due to use of the following:
  - os.LookupEnv (introduced in go1.5)
  - http.StatusTooManyRequests (introduced in go1.6)
ignoring the fetch and explicit test of /examples/ fixes failing go1.3,
go1.4, go1.5 builds.
2016-11-03 01:28:25 -04:00
Simon Eskildsen 380f64d344 Merge pull request #412 from sagar8192/add-scribe-hook-description
Add scribe hook
2016-10-31 10:45:02 -04:00
Simon Eskildsen 8de4982a7a Merge pull request #413 from toorop/master
Add Pushover Hook
2016-10-31 10:44:55 -04:00
Simon Eskildsen 7371813290 Merge pull request #421 from heralight/master
Update README.md
2016-10-31 10:44:43 -04:00
Simon Eskildsen 551ec64450 Merge pull request #422 from JJ/master
Adds new logz.io hook by @ripcurld00d
2016-10-31 10:44:29 -04:00
JJ Merelo ea5eab4f4b Adds new logz.io hook by @ripcurld00d 2016-10-09 13:02:24 +02:00
Alexandre Richonnier 0c8a99c9b8 Update README.md
add link to Logrus and Viper integration Helper
2016-10-05 09:20:26 +02:00
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
Stéphane Depierrepont aka Toorop f7be9f0695 Add Pushover Hook 2016-09-19 16:09:08 +02:00
Sagar Sadashiv Patwardhan 32472f55b6 Add scribe hook 2016-09-18 12:42:16 -07: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