Skip to content

Commit

Permalink
Update lock abstraction of defaultLogger. (#113)
Browse files Browse the repository at this point in the history
Just a first small change about how locks are referenced.  This moves
the lock from an extension like parameter ofdefaultLogger to a
private member
  • Loading branch information
Jack Lindamood authored and luluzhao committed Jun 3, 2019
1 parent a1bf010 commit d958efe
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xraylog/xray_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func NewDefaultLogger(w io.Writer, minLogLevel LogLevel) Logger {
}

type defaultLogger struct {
sync.Mutex
mu sync.Mutex
w io.Writer
minLevel LogLevel
}
Expand All @@ -71,8 +71,8 @@ func (l *defaultLogger) Log(ll LogLevel, msg fmt.Stringer) {
return
}

l.Lock()
defer l.Unlock()
l.mu.Lock()
defer l.mu.Unlock()
fmt.Fprintf(l.w, "%s [%s] %s\n", time.Now().Format(time.RFC3339), ll, msg)
}

Expand Down

0 comments on commit d958efe

Please sign in to comment.