Commit Graph

38 Commits

Author SHA1 Message Date
Loren Osborn ed3ffa0190 PR#844: Added Trace to TestLogLevelEnabled() (requested by @dgsb) 2018-10-19 09:15:13 -07:00
Loren Osborn b54cafe5ce Addresses @stevvooe's backward compatibility concerns. 2018-10-18 10:12:27 -07:00
Giedrius Dubinskas c7a33dc5de Add Trace level logging 2018-10-17 19:12:50 -07: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
betrok 13d10d8d89 return old hooks from RelplaceHooks 2018-08-26 14:40:51 +03:00
betrok 7a0120e2c6 logger.ReplaceHooks 2018-08-22 12:10:05 +03:00
David Bariod c108f5553c Merge branch 'field-logger-with-hooks-race' of git://github.com/thundercat1/logrus into master 2018-07-23 13:53:07 +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
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
Michael Haines 828a649ef2 rename fieldLogger to entry 2018-02-05 12:52:11 -07:00
Michael Haines efbfdb5f09 Add failing test for using a FieldLogger with hooks inside goroutines 2018-02-05 12:42:00 -07:00
David Glasser 1fccefa2f4 Add Writer and WriterLevel to Entry
This lets you do things like:

    cmd := exec.Command("command")
    stdout := logrus.WithField("fd", "stdout").Writer()
    defer stdout.Close()
    stderr := logrus.WithField("fd", "stderr").Writer()
    defer stderr.Close()
    cmd.Stdout = stdout
    cmd.Stderr = stderr
2017-03-06 16:24:57 -08: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
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
Ronny López 6094714616 Run tests with -race 2016-01-23 11:18:45 +01: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 9561fcd7d6 assertify changed behavior and consider float64 != int 2015-04-22 22:48:32 -04:00
Anton Tiurin f08673d24a [Race] Fix datarace in GetLevel
`std.Level` is protected by mutex in setter (SetLevel),
so it must be protected in geetter (GetLevel) too.

Signed-off-by: Anton Tiurin <noxiouz@yandex.ru>
2015-02-20 01:14:10 +03:00
Simon Eskildsen 844911ce07 test: remove deprecated #len calls 2015-01-20 20:38:13 -05:00
Simon Eskildsen 51fe59aca1 Merge pull request #92 from rasky/no-extra-quoting
Avoid extra quotes where not strictly necessary.
2014-12-18 10:52:14 -05:00
Giovanni Bajo e5c1364122 Fix test to adjust for missing quotes 2014-12-18 15:14:24 +01:00
Antoine Grondin 2835e150d9 fixes #88 2014-12-09 21:57:50 -05:00
Antoine Grondin 62b915c008 regression test for issue #88 2014-12-09 21:53:14 -05:00
Antoine Grondin 3737b3267e logrus: remove test for dbg alias in ParseLevel. 2014-09-24 23:23:01 -04:00
Simon Eskildsen 4617ccb653 Merge pull request #62 from mohae/setloglevel
added support for setting log level using strings: SetLogLevel()
2014-09-24 23:09:09 -04:00
Antoine Grondin dc01f6d597 add regression for basic fields being incorrectly prefixed 2014-09-21 13:16:35 -04:00
Joel Scoble 4e6e671281 add ParseLevel to get Level from string 2014-09-17 20:08:23 -05:00
Simon Eskildsen 40069a98d6 entry: break out time, level and message from data 2014-07-26 21:34:29 -04:00
Simon Eskildsen cd8fc638cc levels: add string helper 2014-07-26 21:02:08 -04:00
Shuhao Wu 7a3a90cb3d Added test 2014-06-09 11:54:10 -04:00
Simon Eskildsen f8afa65d86 test: remove temporary benchmarks 2014-05-03 20:31:11 -04:00
Simon Eskildsen d85ac80aa9 entry: log with spaces between all operands on *ln #25 2014-05-03 20:20:07 -04:00
Anthony Bishopric 9f6da0e77c Defer formatting of log values in Levelf(), Levelln()
The Level() family of log methods defer formatting of log
values until it is confident that the log level needs them.
This change allows that deferral to happen at the Levelf()
and Levelln() levels too.

This commit also adds benchmarks to demonstrate the improved
performance of these functions
2014-03-25 14:54:31 -07:00
Simon Eskildsen 53371e3664 Add features from README 2014-03-10 19:22:08 -04:00