Skip to content

Commit

Permalink
Merge pull request #1231 from sirupsen/dbd-cleanup
Browse files Browse the repository at this point in the history
cleanup
  • Loading branch information
dgsb authored Feb 17, 2021
2 parents 15ca3c0 + 35ab8d8 commit d59e561
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
18 changes: 5 additions & 13 deletions entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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{}) {
Expand Down

0 comments on commit d59e561

Please sign in to comment.