瀏覽代碼

logging: Fix creating empty file even when disabled (#2966)

* logging: Fix creating empty file even when disabled

* Minor formatting fix

Co-authored-by: staviq <staviq@gmail.com>

---------

Co-authored-by: staviq <staviq@gmail.com>
Kerfuffle 2 年之前
父節點
當前提交
3358c381f6
共有 1 個文件被更改,包括 6 次插入6 次删除
  1. 6 6
      common/log.h

+ 6 - 6
common/log.h

@@ -341,14 +341,14 @@ inline FILE *log_handler1_impl(bool change = false, LogTriState disable = LogTri
         }
     }
 
-    if (_initialized)
+    if (_disabled)
     {
-        if (_disabled)
-        {
-            // Log is disabled
-            return nullptr;
-        }
+        // Log is disabled
+        return nullptr;
+    }
 
+    if (_initialized)
+    {
         // with fallback in case something went wrong
         return logfile ? logfile : stderr;
     }