Commit Graph

39 Commits

Author SHA1 Message Date
Logan HAUSPIE 90bf2e7f39
feat(LogLevel): taking in account code review from David Bariod 2018-08-27 00:16:06 +02:00
Logan HAUSPIE 0ab534bf6c
Merge remote-tracking branch 'upstream/master' 2018-08-26 23:36:08 +02:00
David Bariod 49fbef4694
Merge pull request #647 from ChimeraCoder/logger-docstring
Fix typo in docstring
2018-08-26 21:09:48 +02:00
David Bariod b24eae79a4 Merge branch 'hooks_replace' of git://github.com/betrok/logrus into betrok-hooks_replace 2018-08-26 20:44:53 +02:00
betrok 13d10d8d89 return old hooks from RelplaceHooks 2018-08-26 14:40:51 +03:00
David Bariod 3ed92f8c1f Merge branch 'cleanup-exported' of git://github.com/conjmurph/logrus into conjmurph-cleanup-exported 2018-08-26 11:58:08 +02:00
betrok 7a0120e2c6 logger.ReplaceHooks 2018-08-22 12:10:05 +03:00
David Bariod 179037fcd4 Ensure a new entry data fields are empty
Fixes #795
2018-07-31 18:08:27 +02:00
David Bariod 92052687f8 Merge branch 'override-time' of git://github.com/sbrisson2/logrus into sbrisson2-override-time 2018-07-12 22:16:18 +02:00
Simon Brisson 725f3be199 Adds WithTime to Logger and Entry types, as well as a pure module-level function. 2018-07-12 13:25:17 -04:00
Daniel Bershatsky fc9bbf2f57 [#241] Allow to set writer during logger usage. 2018-07-01 23:57:16 +03:00
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
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
conor 0c03a05a0e mirror and wrap Logger instance methods in exported.go 2017-12-21 14:04:49 -05:00
Aditya Mukerjee c44d524628 Fix typo in docstring 2017-10-09 11:18:43 -04: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