From d958efe7066bde1cf3e47670659898d1c92702cd Mon Sep 17 00:00:00 2001 From: Jack Lindamood Date: Mon, 3 Jun 2019 10:35:19 -0700 Subject: [PATCH] Update lock abstraction of defaultLogger. (#113) Just a first small change about how locks are referenced. This moves the lock from an extension like parameter ofdefaultLogger to a private member --- xraylog/xray_log.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xraylog/xray_log.go b/xraylog/xray_log.go index 5883bf91..a790a109 100644 --- a/xraylog/xray_log.go +++ b/xraylog/xray_log.go @@ -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 } @@ -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) }