David Bariod
64d5b7e66c
Merge branch 'master' into caller_feature
2018-10-27 15:10:52 +02:00
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
Dave Clendenan
b1db1b9c67
regex assertion rather than literal, for github path
2017-08-02 17:28:13 -07:00
Dave Clendenan
3cb9e18ef9
test updates
...
- add tests for callers accessed directly or via function pointer
(results are unchanged)
- undo unwanted capitalization/export in previous commit
2017-08-02 17:21:18 -07:00
Dave Clendenan
7d48cb786e
Merge branch 'master' of https://github.com/sirupsen/logrus
...
Conflicts:
alt_exit_test.go
formatter.go
json_formatter.go
2017-08-02 13:18:39 -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
Dave Clendenan
88dd8df1f8
responses to code review
...
- field rename to be more properly generic
- drop rewrite of main.main
2016-12-06 12:53:21 -08:00
Dave Clendenan
306956c385
tweak timing tests to handle slower VMs and older GoLang
2016-12-01 11:12:44 -08:00
Dave Clendenan
f08011a10f
merge upstream, add tests, full method context
...
- added benchmarks, and assertions for timeliness
- replaced regex usage in package-name handling with a straight
comparison to a cached value
- log the fullly-qualified method name, to remove ambiguity
eg: github.com/fflintstone/yabba.dabba.doo
- clean up possibly-unsafe assumptions about using the standard logger,
remove global lookup function to enforce safe usage
2016-12-01 10:23:00 -08:00
Dave Clendenan
a5c845c224
responses to review comments
...
- empty string as marker for failure to discover calling function
- tighten up logger usage - don't rely on std logger internally
Also fix ordering of expected/got in logrus_test.go to ensure correct
output form test failures.
2016-11-30 14:07:10 -08:00
Dave Clendenan
05a8f4db95
fix test description
2016-11-30 10:47:03 -08: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
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