entry: fire hook before obtaining reader #24 #13

This commit is contained in:
Simon Eskildsen 2014-05-02 10:08:54 -04:00
parent 5568a01db7
commit eeed235659
1 changed files with 4 additions and 4 deletions

View File

@ -62,15 +62,15 @@ func (entry *Entry) log(level string, levelInt Level, msg string) string {
entry.Data["level"] = level entry.Data["level"] = level
entry.Data["msg"] = msg 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() reader, err := entry.Reader()
if err != nil { if err != nil {
fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v", err) 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() entry.Logger.mu.Lock()
defer entry.Logger.mu.Unlock() defer entry.Logger.mu.Unlock()