From 9f758bbd0db9402f23d690aebdae6f4cb78e6782 Mon Sep 17 00:00:00 2001 From: Ivan Kozlovic Date: Thu, 6 Oct 2016 09:30:49 -0600 Subject: [PATCH] Use simple if/else --- server/log.go | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/server/log.go b/server/log.go index 1bccc46c..04db93cf 100644 --- a/server/log.go +++ b/server/log.go @@ -37,17 +37,16 @@ type Logger interface { // SetLogger sets the logger of the server func (s *Server) SetLogger(logger Logger, debugFlag, traceFlag bool) { - debugVal := 0 if debugFlag { - debugVal = 1 + atomic.StoreInt32(&debug, 1) + } else { + atomic.StoreInt32(&debug, 0) } - atomic.StoreInt32(&debug, int32(debugVal)) - - traceVal := 0 if traceFlag { - traceVal = 1 + atomic.StoreInt32(&trace, 1) + } else { + atomic.StoreInt32(&trace, 0) } - atomic.StoreInt32(&trace, int32(traceVal)) log.Lock() log.logger = logger