From 5cb4bf65c6cf91ed79bdddc73b962051e762f895 Mon Sep 17 00:00:00 2001 From: David Bariod Date: Tue, 16 Feb 2021 18:13:03 +0100 Subject: [PATCH 1/2] code and comments clean up --- entry.go | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/entry.go b/entry.go index e02e057..c968f63 100644 --- a/entry.go +++ b/entry.go @@ -88,10 +88,6 @@ func (entry *Entry) Dup() *Entry { // Returns the bytes representation of this entry from the formatter. func (entry *Entry) Bytes() ([]byte, error) { - return entry.bytes_nolock() -} - -func (entry *Entry) bytes_nolock() ([]byte, error) { return entry.Logger.Formatter.Format(entry) } @@ -222,8 +218,6 @@ func (entry Entry) HasCaller() (has bool) { entry.Caller != nil } -// This function is not declared with a pointer value because otherwise -// race conditions will occur when using multiple goroutines func (entry *Entry) log(level Level, msg string) { var buffer *bytes.Buffer @@ -279,13 +273,11 @@ func (entry *Entry) write() { fmt.Fprintf(os.Stderr, "Failed to obtain reader, %v\n", err) return } - func() { - entry.Logger.mu.Lock() - defer entry.Logger.mu.Unlock() - if _, err := entry.Logger.Out.Write(serialized); err != nil { - fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err) - } - }() + entry.Logger.mu.Lock() + defer entry.Logger.mu.Unlock() + if _, err := entry.Logger.Out.Write(serialized); err != nil { + fmt.Fprintf(os.Stderr, "Failed to write to log, %v\n", err) + } } func (entry *Entry) Log(level Level, args ...interface{}) { From 35ab8d8fef777a520fdaea54bfa3e1d2e5eb7c2e Mon Sep 17 00:00:00 2001 From: David Bariod Date: Tue, 16 Feb 2021 18:18:17 +0100 Subject: [PATCH 2/2] update changelog --- CHANGELOG.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f68fb86..311f2c3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,11 @@ +# 1.8.0 + +Correct versioning number replacing v1.7.1. + # 1.7.1 + +Beware this release has introduced a new public API and its semver is therefore incorrect. + Code quality: * use go 1.15 in travis * use magefile as task runner