Commit Graph

23 Commits

Author SHA1 Message Date
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
Logan HAUSPIE 90bf2e7f39
feat(LogLevel): taking in account code review from David Bariod 2018-08-27 00:16:06 +02: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
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
Simon Eskildsen 897f3dddf1 Rename LogrusLogger interface to FieldLogger 2016-03-17 14:07:00 +00:00
Simon Eskildsen bb78923f27 Merge pull request #320 from little-arhat/feature-logrus-interface
Add LogrusLogger interface for Entry and Logger
2016-03-17 10:01:39 -04:00
Joern Barthel 088ac1380d Expose all levels (for hooks). 2016-02-22 10:46:52 +01:00
Rickard Dybeck 03ba213b8a Make ParseLevel case-insensitive
Coming from an environment where loglevels are always specified in
uppercase, having ParseLevel be case-insensitive is a nice to have.
2016-02-16 16:27:38 +01:00
Roma Sokolov 1196d67b47 Add LogrusLogger interface for Entry and Logger
This make it possible for client code to accept either Logger or Entry.
For example, utility function may accept logger object to inform fatal
errors and it is job of the calling code to provide either generic
top-level logger, or request-bound Entry created using .WithFields.

(fixes #308)
2016-02-02 17:38:49 +00:00
Simon Eskildsen 4197a1bbd5 Revert "TextMarshaler and TextUnmarshaler implementation for Level" 2015-10-05 07:45:58 -04:00
Maksim Naumov 277d0cb562 `TextMarshaler` and `TextUnmarshaler` implementation for `Level` 2015-09-12 22:41:06 +02:00
Antoine Grondin a2f80bd9c0 add compile checks for StdLogger interface 2015-09-07 20:49:55 -04:00
Simon Eskildsen 45d5602d9c logrus: remove dbg alias for ParseLevel
\cc @mohae
2014-09-25 03:10:06 +00:00
Joel Scoble 4e6e671281 add ParseLevel to get Level from string 2014-09-17 20:08:23 -05:00
Simon Eskildsen cd8fc638cc levels: add string helper 2014-07-26 21:02:08 -04:00
Antoine Grondin e5621dca87 Export package func to a standard logger. 2014-07-21 21:19:55 -04:00
Antoine Grondin bf45b308e9 Rename StandartLogger. Clean way to assert log.Logger realizes logrus
interface.
2014-03-14 15:07:57 -04:00
Antoine Grondin 97e1bef2cc Fix logger.StdLogger to really be a plugin stdlib/log.Logger. 2014-03-14 14:50:08 -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 6c895096e8 split into multiple files 2014-02-23 19:50:42 -05:00
Simon Eskildsen 84ff01f444 Initial commit 2014-02-23 09:57:04 -05:00