From: Kerfuffle Date: Sat, 2 Sep 2023 17:53:55 +0000 (-0600) Subject: logging: Fix creating empty file even when disabled (#2966) X-Git-Tag: gguf-v0.4.0~152 X-Git-Url: https://git.djapps.eu/?a=commitdiff_plain;h=3358c381f6251bf6e65855e1c93bfaa9ec82ddb3;p=pkg%2Fggml%2Fsources%2Fllama.cpp logging: Fix creating empty file even when disabled (#2966) * logging: Fix creating empty file even when disabled * Minor formatting fix Co-authored-by: staviq --------- Co-authored-by: staviq --- diff --git a/common/log.h b/common/log.h index bf9fafd6..0b9b0105 100644 --- a/common/log.h +++ b/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; }