]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
logging: Fix creating empty file even when disabled (#2966)
authorKerfuffle <redacted>
Sat, 2 Sep 2023 17:53:55 +0000 (11:53 -0600)
committerGitHub <redacted>
Sat, 2 Sep 2023 17:53:55 +0000 (11:53 -0600)
* logging: Fix creating empty file even when disabled

* Minor formatting fix

Co-authored-by: staviq <redacted>
---------

Co-authored-by: staviq <redacted>
common/log.h

index bf9fafd68c51e3ac83384cbc7b5230f01da7093a..0b9b01052b87ca5193e35d66aa77f8ebab8f0cd9 100644 (file)
@@ -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;
     }