libobs, UI: Fix `--verbose` logging for stdout

Verbosity of stdout was previously hardcoded to INFO, while log viewer
and log files had correct verbosity. This makes the behavior of
--verbose make sense in all places.
master
tt2468 2022-03-30 03:10:28 -07:00 committed by Jim
parent 3d7663f417
commit af67ef8e57
2 changed files with 25 additions and 30 deletions

View File

@ -389,14 +389,13 @@ static void do_log(int log_level, const char *msg, va_list args, void *param)
OutputDebugStringW(wide_buf.c_str());
}
}
#else
def_log_handler(log_level, msg, args2, nullptr);
va_end(args2);
#endif
if (log_level <= LOG_INFO || log_verbose) {
if (too_many_repeated_entries(logFile, msg, str))
return;
#ifndef _WIN32
def_log_handler(log_level, msg, args2, nullptr);
#endif
if (!too_many_repeated_entries(logFile, msg, str))
LogStringChunk(logFile, str, log_level);
}
@ -404,6 +403,10 @@ static void do_log(int log_level, const char *msg, va_list args, void *param)
if (log_level <= LOG_ERROR && IsDebuggerPresent())
__debugbreak();
#endif
#ifndef _WIN32
va_end(args2);
#endif
}
#define DEFAULT_LANG "en-US"

View File

@ -20,12 +20,6 @@
#include "c99defs.h"
#include "base.h"
#ifdef _DEBUG
static int log_output_level = LOG_DEBUG;
#else
static int log_output_level = LOG_INFO;
#endif
static int crashing = 0;
static void *log_param = NULL;
static void *crash_param = NULL;
@ -36,7 +30,6 @@ static void def_log_handler(int log_level, const char *format, va_list args,
char out[4096];
vsnprintf(out, sizeof(out), format, args);
if (log_level <= log_output_level) {
switch (log_level) {
case LOG_DEBUG:
fprintf(stdout, "debug: %s\n", out);
@ -57,7 +50,6 @@ static void def_log_handler(int log_level, const char *format, va_list args,
fprintf(stderr, "error: %s\n", out);
fflush(stderr);
}
}
UNUSED_PARAMETER(param);
}