David Bariod
4fd274e0b8
improve Logger.WithField documentation
2019-10-28 19:22:23 +01:00
Adam Renberg Tamm
68e41f673a
Add WithContext
2019-03-11 15:38:19 +01:00
Jiang Xin
f61e48bb8e
logger: fix wrong callback method
...
Fix wrong callback in `logger.go`, and add test cases:
1. `logger.Warningln` should call `logger.Warnln`, not `logger.Warn`.
2. It's ok for `logger.Print` to call `entry.Info`, but calling `entry.Print`
is better.
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
2019-01-22 20:46:10 +08:00
Lisa Ugray
a6668e7a60
Add Generic Log functions with level via argument
2018-12-20 15:49:25 -05:00
David Bariod
5fcd19eae6
add a SetReportCaller on Logger object
2018-10-27 15:19:06 +02:00
David Bariod
64d5b7e66c
Merge branch 'master' into caller_feature
2018-10-27 15:10:52 +02:00
drampull
4981d8161c
Added TRACE level logging.
2018-10-17 18:22:00 -07:00
Albert Salim
a13c5db57c
Fix typo in comment
2018-10-10 21:59:03 +08:00
Albert Salim
4346c76f26
Remove unnecessary wrapper function on `os.Exit`
2018-10-10 21:57:58 +08:00
Albert Salim
99bc300c8d
Add a method Exit on Logger that calls `os.Exit` or alternate exit function.
...
This keeps backward compatibility for static declaration of logger
that does not specify `ExitFunc` field.
2018-10-10 21:54:15 +08:00
Albert Salim
2be620216a
Add option to panic in `test.NewNullLogger` to allow testing of
...
calls to `Fatal*`
See #813
2018-10-06 18:08:19 +08:00
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
Dave Clendenan
eab1019f63
Merge branch 'master' of https://github.com/sirupsen/logrus
2017-08-30 15:39:09 -07: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
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
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