Merge pull request #215 from underarmour/sentry-hook-with-client

Allow sentry hook to be created using an initialized raven client
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf2f0d1..ab18440 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,29 +1,37 @@
+# 0.8.5
+
+* logrus/core: revert #208
+
+# 0.8.4
+
+* formatter/text: fix data race (#218)
+
 # 0.8.3
 
-logrus/core: fix entry log level (#208)
-logrus/core: improve performance of text formatter by 40%
-logrus/core: expose `LevelHooks` type
-logrus/core: add support for DragonflyBSD and NetBSD
-formatter/text: print structs more verbosely
+* logrus/core: fix entry log level (#208)
+* logrus/core: improve performance of text formatter by 40%
+* logrus/core: expose `LevelHooks` type
+* logrus/core: add support for DragonflyBSD and NetBSD
+* formatter/text: print structs more verbosely
 
 # 0.8.2
 
-logrus: fix more Fatal family functions
+* logrus: fix more Fatal family functions
 
 # 0.8.1
 
-logrus: fix not exiting on `Fatalf` and `Fatalln`
+* logrus: fix not exiting on `Fatalf` and `Fatalln`
 
 # 0.8.0
 
-logrus: defaults to stderr instead of stdout
-hooks/sentry: add special field for `*http.Request`
-formatter/text: ignore Windows for colors
+* logrus: defaults to stderr instead of stdout
+* hooks/sentry: add special field for `*http.Request`
+* formatter/text: ignore Windows for colors
 
 # 0.7.3
 
-formatter/\*: allow configuration of timestamp layout
+* formatter/\*: allow configuration of timestamp layout
 
 # 0.7.2
 
-formatter/text: Add configuration option for time format (#158)
+* formatter/text: Add configuration option for time format (#158)
diff --git a/entry.go b/entry.go
index 2a98065..699ea03 100644
--- a/entry.go
+++ b/entry.go
@@ -32,8 +32,7 @@
 	return &Entry{
 		Logger: logger,
 		// Default is three fields, give a little extra room
-		Data: 	make(Fields, 5),
-		Level:	logger.Level,
+		Data: make(Fields, 5),
 	}
 }
 
@@ -68,7 +67,7 @@
 	for k, v := range fields {
 		data[k] = v
 	}
-	return &Entry{Logger: entry.Logger, Data: data, Level: entry.Level}
+	return &Entry{Logger: entry.Logger, Data: data}
 }
 
 func (entry *Entry) log(level Level, msg string) {
@@ -106,7 +105,7 @@
 }
 
 func (entry *Entry) Debug(args ...interface{}) {
-	if entry.Level >= DebugLevel {
+	if entry.Logger.Level >= DebugLevel {
 		entry.log(DebugLevel, fmt.Sprint(args...))
 	}
 }
@@ -116,13 +115,13 @@
 }
 
 func (entry *Entry) Info(args ...interface{}) {
-	if entry.Level >= InfoLevel {
+	if entry.Logger.Level >= InfoLevel {
 		entry.log(InfoLevel, fmt.Sprint(args...))
 	}
 }
 
 func (entry *Entry) Warn(args ...interface{}) {
-	if entry.Level >= WarnLevel {
+	if entry.Logger.Level >= WarnLevel {
 		entry.log(WarnLevel, fmt.Sprint(args...))
 	}
 }
@@ -132,20 +131,20 @@
 }
 
 func (entry *Entry) Error(args ...interface{}) {
-	if entry.Level >= ErrorLevel {
+	if entry.Logger.Level >= ErrorLevel {
 		entry.log(ErrorLevel, fmt.Sprint(args...))
 	}
 }
 
 func (entry *Entry) Fatal(args ...interface{}) {
-	if entry.Level >= FatalLevel {
+	if entry.Logger.Level >= FatalLevel {
 		entry.log(FatalLevel, fmt.Sprint(args...))
 	}
 	os.Exit(1)
 }
 
 func (entry *Entry) Panic(args ...interface{}) {
-	if entry.Level >= PanicLevel {
+	if entry.Logger.Level >= PanicLevel {
 		entry.log(PanicLevel, fmt.Sprint(args...))
 	}
 	panic(fmt.Sprint(args...))
@@ -154,13 +153,13 @@
 // Entry Printf family functions
 
 func (entry *Entry) Debugf(format string, args ...interface{}) {
-	if entry.Level >= DebugLevel {
+	if entry.Logger.Level >= DebugLevel {
 		entry.Debug(fmt.Sprintf(format, args...))
 	}
 }
 
 func (entry *Entry) Infof(format string, args ...interface{}) {
-	if entry.Level >= InfoLevel {
+	if entry.Logger.Level >= InfoLevel {
 		entry.Info(fmt.Sprintf(format, args...))
 	}
 }
@@ -170,7 +169,7 @@
 }
 
 func (entry *Entry) Warnf(format string, args ...interface{}) {
-	if entry.Level >= WarnLevel {
+	if entry.Logger.Level >= WarnLevel {
 		entry.Warn(fmt.Sprintf(format, args...))
 	}
 }
@@ -180,20 +179,20 @@
 }
 
 func (entry *Entry) Errorf(format string, args ...interface{}) {
-	if entry.Level >= ErrorLevel {
+	if entry.Logger.Level >= ErrorLevel {
 		entry.Error(fmt.Sprintf(format, args...))
 	}
 }
 
 func (entry *Entry) Fatalf(format string, args ...interface{}) {
-	if entry.Level >= FatalLevel {
+	if entry.Logger.Level >= FatalLevel {
 		entry.Fatal(fmt.Sprintf(format, args...))
 	}
 	os.Exit(1)
 }
 
 func (entry *Entry) Panicf(format string, args ...interface{}) {
-	if entry.Level >= PanicLevel {
+	if entry.Logger.Level >= PanicLevel {
 		entry.Panic(fmt.Sprintf(format, args...))
 	}
 }
@@ -201,13 +200,13 @@
 // Entry Println family functions
 
 func (entry *Entry) Debugln(args ...interface{}) {
-	if entry.Level >= DebugLevel {
+	if entry.Logger.Level >= DebugLevel {
 		entry.Debug(entry.sprintlnn(args...))
 	}
 }
 
 func (entry *Entry) Infoln(args ...interface{}) {
-	if entry.Level >= InfoLevel {
+	if entry.Logger.Level >= InfoLevel {
 		entry.Info(entry.sprintlnn(args...))
 	}
 }
@@ -217,7 +216,7 @@
 }
 
 func (entry *Entry) Warnln(args ...interface{}) {
-	if entry.Level >= WarnLevel {
+	if entry.Logger.Level >= WarnLevel {
 		entry.Warn(entry.sprintlnn(args...))
 	}
 }
@@ -227,20 +226,20 @@
 }
 
 func (entry *Entry) Errorln(args ...interface{}) {
-	if entry.Level >= ErrorLevel {
+	if entry.Logger.Level >= ErrorLevel {
 		entry.Error(entry.sprintlnn(args...))
 	}
 }
 
 func (entry *Entry) Fatalln(args ...interface{}) {
-	if entry.Level >= FatalLevel {
+	if entry.Logger.Level >= FatalLevel {
 		entry.Fatal(entry.sprintlnn(args...))
 	}
 	os.Exit(1)
 }
 
 func (entry *Entry) Panicln(args ...interface{}) {
-	if entry.Level >= PanicLevel {
+	if entry.Logger.Level >= PanicLevel {
 		entry.Panic(entry.sprintlnn(args...))
 	}
 }
diff --git a/entry_test.go b/entry_test.go
index f7de400..98717df 100644
--- a/entry_test.go
+++ b/entry_test.go
@@ -51,17 +51,3 @@
 	entry := NewEntry(logger)
 	entry.WithField("err", errBoom).Panicf("kaboom %v", true)
 }
-
-func TestEntryLogLevel(t *testing.T) {
-  	out := &bytes.Buffer{}
-  	logger := New()
-  	logger.Out = out
-  	logger.Level = DebugLevel
-  	entry := NewEntry(logger)
-  	assert.Equal(t, DebugLevel, entry.Level)
-  	entry.Level = WarnLevel
-  	entry.Info("it should not be displayed")
-  	assert.Equal(t, "", out.String())
-  	entry.Warn("it should be displayed")
-  	assert.Contains(t, out.String(), "it should be displayed")
-}
diff --git a/text_formatter.go b/text_formatter.go
index e25f86c..17cc298 100644
--- a/text_formatter.go
+++ b/text_formatter.go
@@ -73,14 +73,15 @@
 	isColorTerminal := isTerminal && (runtime.GOOS != "windows")
 	isColored := (f.ForceColors || isColorTerminal) && !f.DisableColors
 
-	if f.TimestampFormat == "" {
-		f.TimestampFormat = DefaultTimestampFormat
+	timestampFormat := f.TimestampFormat
+	if timestampFormat == "" {
+		timestampFormat = DefaultTimestampFormat
 	}
 	if isColored {
-		f.printColored(b, entry, keys)
+		f.printColored(b, entry, keys, timestampFormat)
 	} else {
 		if !f.DisableTimestamp {
-			f.appendKeyValue(b, "time", entry.Time.Format(f.TimestampFormat))
+			f.appendKeyValue(b, "time", entry.Time.Format(timestampFormat))
 		}
 		f.appendKeyValue(b, "level", entry.Level.String())
 		f.appendKeyValue(b, "msg", entry.Message)
@@ -93,7 +94,7 @@
 	return b.Bytes(), nil
 }
 
-func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string) {
+func (f *TextFormatter) printColored(b *bytes.Buffer, entry *Entry, keys []string, timestampFormat string) {
 	var levelColor int
 	switch entry.Level {
 	case DebugLevel:
@@ -111,7 +112,7 @@
 	if !f.FullTimestamp {
 		fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%04d] %-44s ", levelColor, levelText, miniTS(), entry.Message)
 	} else {
-		fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(f.TimestampFormat), entry.Message)
+		fmt.Fprintf(b, "\x1b[%dm%s\x1b[0m[%s] %-44s ", levelColor, levelText, entry.Time.Format(timestampFormat), entry.Message)
 	}
 	for _, k := range keys {
 		v := entry.Data[k]