From eeed23565968673c5030c8f9fe7d98593db70728 Mon Sep 17 00:00:00 2001 From: Simon Eskildsen Date: Fri, 2 May 2014 10:08:54 -0400 Subject: [PATCH] entry: fire hook before obtaining reader #24 #13 --- entry.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entry.go b/entry.go index 32f93f9..1db7dd7 100644 --- a/entry.go +++ b/entry.go @@ -62,15 +62,15 @@ func (entry *Entry) log(level string, levelInt Level, msg string) string { entry.Data["level"] = level entry.Data["msg"] = msg + if err := entry.Logger.Hooks.Fire(levelInt, entry); err != nil { + fmt.Fprintf(os.Stderr, "Failed to fire hook", err) + } + reader, err := entry.Reader() if err != nil { fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v", err) } - if err := entry.Logger.Hooks.Fire(levelInt, entry); err != nil { - fmt.Fprintf(os.Stderr, "Failed to fire hook", err) - } - entry.Logger.mu.Lock() defer entry.Logger.mu.Unlock()