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,21 +389,24 @@ 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;
LogStringChunk(logFile, str, log_level);
#ifndef _WIN32
def_log_handler(log_level, msg, args2, nullptr);
#endif
if (!too_many_repeated_entries(logFile, msg, str))
LogStringChunk(logFile, str, log_level);
}
#if defined(_WIN32) && defined(OBS_DEBUGBREAK_ON_ERROR)
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,27 +30,25 @@ 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);
fflush(stdout);
break;
switch (log_level) {
case LOG_DEBUG:
fprintf(stdout, "debug: %s\n", out);
fflush(stdout);
break;
case LOG_INFO:
fprintf(stdout, "info: %s\n", out);
fflush(stdout);
break;
case LOG_INFO:
fprintf(stdout, "info: %s\n", out);
fflush(stdout);
break;
case LOG_WARNING:
fprintf(stdout, "warning: %s\n", out);
fflush(stdout);
break;
case LOG_WARNING:
fprintf(stdout, "warning: %s\n", out);
fflush(stdout);
break;
case LOG_ERROR:
fprintf(stderr, "error: %s\n", out);
fflush(stderr);
}
case LOG_ERROR:
fprintf(stderr, "error: %s\n", out);
fflush(stderr);
}
UNUSED_PARAMETER(param);