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>
This commit is contained in:
Kerfuffle 2023-09-02 11:53:55 -06:00 committed by GitHub
parent 52315a4216
commit 3358c381f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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