Commit Graph

25 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
Aditya Mukerjee 3d1341ce2c Add AddHook method for logger 2017-08-17 15:22:06 +01:00
dmathieu 00386b3fbd remove unfinished doc sentence
Closes #521
2017-07-19 17:47:53 +02:00
Steve Jarvis 20d755ea5e Export logger's set level function to address #503. 2017-07-07 16:32:18 -04:00
DmitriyMV 3bcb09397d This commit fixes data race using atomics. We switch type of level from uint8 to uint32 but due memory alignment on most platforms it will not result in any additional memory. 2017-03-23 19:13:49 +03: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