From 1d174e00c0ea5eb8e263b494b14cca7622501969 Mon Sep 17 00:00:00 2001 From: John Date: Thu, 24 Sep 2020 23:46:19 +0800 Subject: [PATCH] improve package internal/intlog --- internal/intlog/intlog.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/intlog/intlog.go b/internal/intlog/intlog.go index 4c44c62fd..445b56b72 100644 --- a/internal/intlog/intlog.go +++ b/internal/intlog/intlog.go @@ -35,7 +35,10 @@ func init() { // SetEnabled enables/disables the internal logging manually. // Note that this function is not concurrent safe, be aware of the DATA RACE. func SetEnabled(enabled bool) { - isGFDebug = enabled + // If they're the same, it does not write the but only reading operation. + if isGFDebug != enabled { + isGFDebug = enabled + } } // IsEnabled checks and returns whether current process is in GF development.