From 884d629a564a745fdb8d3e6b691dfbf7254a4266 Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow <brian.holderchow@gmail.com> Date: Sun, 16 Nov 2014 09:51:20 -0800 Subject: [PATCH] deps(eventlog) no need to augment Logger allow framework to add level to log so level can be applied when using text formatter License: MIT Signed-off-by: Brian Tiger Chow <brian@perfmode.com> --- Godeps/Godeps.json | 4 ++-- .../src/github.com/maybebtc/logrus/entry.go | 11 +++-------- .../src/github.com/maybebtc/logrus/entry_test.go | 2 -- .../src/github.com/maybebtc/logrus/exported.go | 8 -------- .../src/github.com/maybebtc/logrus/logger.go | 5 ----- .../src/github.com/maybebtc/logrus/logrus_test.go | 1 - 6 files changed, 5 insertions(+), 26 deletions(-) diff --git a/Godeps/Godeps.json b/Godeps/Godeps.json index 1b9852137..5364a8e82 100644 --- a/Godeps/Godeps.json +++ b/Godeps/Godeps.json @@ -133,8 +133,8 @@ }, { "ImportPath": "github.com/maybebtc/logrus", - "Comment": "v0.6.0-7-g51cc99e", - "Rev": "51cc99e4b07ec5516233a8370c28b5eedd096b6b" + "Comment": "v0.6.0-6-g005463f", + "Rev": "005463f8fb49c4a6f36181e05157e111ec5cf8a3" }, { "ImportPath": "github.com/mitchellh/go-homedir", diff --git a/Godeps/_workspace/src/github.com/maybebtc/logrus/entry.go b/Godeps/_workspace/src/github.com/maybebtc/logrus/entry.go index bb2aabdbc..e164eecb5 100644 --- a/Godeps/_workspace/src/github.com/maybebtc/logrus/entry.go +++ b/Godeps/_workspace/src/github.com/maybebtc/logrus/entry.go @@ -71,14 +71,9 @@ func (entry *Entry) WithFields(fields Fields) *Entry { } func (entry *Entry) log(level Level, msg string) { - - entry.Logger.mu.Lock() - if entry.Logger.WriteFields { - entry.Time = time.Now() - entry.Level = level - entry.Message = msg - } - entry.Logger.mu.Unlock() + entry.Time = time.Now() + entry.Level = level + entry.Message = msg if err := entry.Logger.Hooks.Fire(level, entry); err != nil { entry.Logger.mu.Lock() diff --git a/Godeps/_workspace/src/github.com/maybebtc/logrus/entry_test.go b/Godeps/_workspace/src/github.com/maybebtc/logrus/entry_test.go index 8359abe18..98717df49 100644 --- a/Godeps/_workspace/src/github.com/maybebtc/logrus/entry_test.go +++ b/Godeps/_workspace/src/github.com/maybebtc/logrus/entry_test.go @@ -26,7 +26,6 @@ func TestEntryPanicln(t *testing.T) { logger := New() logger.Out = &bytes.Buffer{} - logger.WriteFields = true entry := NewEntry(logger) entry.WithField("err", errBoom).Panicln("kaboom") } @@ -49,7 +48,6 @@ func TestEntryPanicf(t *testing.T) { logger := New() logger.Out = &bytes.Buffer{} - logger.WriteFields = true entry := NewEntry(logger) entry.WithField("err", errBoom).Panicf("kaboom %v", true) } diff --git a/Godeps/_workspace/src/github.com/maybebtc/logrus/exported.go b/Godeps/_workspace/src/github.com/maybebtc/logrus/exported.go index 46fb099aa..0e2d59f19 100644 --- a/Godeps/_workspace/src/github.com/maybebtc/logrus/exported.go +++ b/Godeps/_workspace/src/github.com/maybebtc/logrus/exported.go @@ -56,14 +56,6 @@ func WithFields(fields Fields) *Entry { return std.WithFields(fields) } -// WriteFields gives the Logger permission to add time, level, msg info to -// Entries -func WriteFields(b bool) { - std.mu.Lock() - defer std.mu.Unlock() - std.WriteFields = b -} - // Debug logs a message at level Debug on the standard logger. func Debug(args ...interface{}) { std.Debug(args...) diff --git a/Godeps/_workspace/src/github.com/maybebtc/logrus/logger.go b/Godeps/_workspace/src/github.com/maybebtc/logrus/logger.go index ceec1a6c5..7374fe365 100644 --- a/Godeps/_workspace/src/github.com/maybebtc/logrus/logger.go +++ b/Godeps/_workspace/src/github.com/maybebtc/logrus/logger.go @@ -26,11 +26,6 @@ type Logger struct { // to) `logrus.Info`, which allows Info(), Warn(), Error() and Fatal() to be // logged. `logrus.Debug` is useful in Level Level - - // WriteFields permits the logger to add time, msg, level data to - // user-provided Fields - WriteFields bool - // Used to sync writing to the log. mu sync.Mutex } diff --git a/Godeps/_workspace/src/github.com/maybebtc/logrus/logrus_test.go b/Godeps/_workspace/src/github.com/maybebtc/logrus/logrus_test.go index 329427951..15157d172 100644 --- a/Godeps/_workspace/src/github.com/maybebtc/logrus/logrus_test.go +++ b/Godeps/_workspace/src/github.com/maybebtc/logrus/logrus_test.go @@ -17,7 +17,6 @@ func LogAndAssertJSON(t *testing.T, log func(*Logger), assertions func(fields Fi logger := New() logger.Out = &buffer logger.Formatter = new(JSONFormatter) - logger.WriteFields = true log(logger) -- GitLab