Commit Graph

21 Commits

Author SHA1 Message Date
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
plan 53cbb9dc6d Reuse entry from the same logger 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
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 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
Tevin Zhang 18073362a7 Fix comment 2016-05-06 11:48:51 +08:00
Graham Hughes 42c9c25263 Support `WithError` on `Logger`.
Should address #277.
2015-11-21 22:59:38 -08:00
Ryan Faerman 2612e8496d Fixes typo in WithField documentation 2015-08-20 00:07:28 -04:00
Viet Hung Nguyen d5580f082a Update logger.go 2015-08-07 15:56:08 +07:00
Simon Eskildsen 93a1736895 hooks: expose LevelHooks type 2015-06-26 11:42:49 -04:00
Madhav Puri fdae7ddaf5 Fix Fatal*() function of logger to match the behavior of Fatal*() functions of entry
Signed-off-by: Madhav Puri <madhav.puri@gmail.com>
2015-05-26 16:47:13 -07:00
Antoine Grondin f8f08842cc default logs to stderr 2015-04-22 22:53:40 -04:00
Mário Freitas a4a5df2c1f improved: move level check from entry to logger and bail out faster 2015-03-20 12:05:33 +09:00
Roberto Bampi d9706afd4a documentation fix 2014-11-27 07:54:16 +01:00
Antoine Grondin e5621dca87 Export package func to a standard logger. 2014-07-21 21:19:55 -04:00
Simon Eskildsen d02c5b387e docs: add documentation for godoc 2014-03-12 10:34:29 -04:00
Simon Eskildsen afde6aea11 levels: add to logger type 2014-03-10 19:52:39 -04:00
Simon Eskildsen 53371e3664 Add features from README 2014-03-10 19:22:08 -04:00
Simon Eskildsen 11dbaff352 Code review fixes 2014-02-24 06:34:12 -05:00
Simon Eskildsen 0bd36d372c code cleanup 2014-02-23 19:53:50 -05:00
Simon Eskildsen 6c895096e8 split into multiple files 2014-02-23 19:50:42 -05:00