Merge pull request #682 from Xaymar/cmd_verbose_unfiltered

UI: Add --verbose and --unfiltered_log command line options
master
Jim 2016-11-16 20:50:01 -08:00 committed by GitHub
commit 8d86f49003
1 changed files with 13 additions and 1 deletions

View File

@ -59,6 +59,8 @@ static string currentLogFile;
static string lastLogFile; static string lastLogFile;
static bool portable_mode = false; static bool portable_mode = false;
static bool log_verbose = false;
static bool unfiltered_log = false;
bool opt_start_streaming = false; bool opt_start_streaming = false;
bool opt_start_recording = false; bool opt_start_recording = false;
string opt_starting_collection; string opt_starting_collection;
@ -270,6 +272,10 @@ static inline bool too_many_repeated_entries(fstream &logFile, const char *msg,
lock_guard<mutex> guard(log_mutex); lock_guard<mutex> guard(log_mutex);
if (unfiltered_log) {
return false;
}
if (last_msg_ptr == msg) { if (last_msg_ptr == msg) {
int diff = std::abs(new_sum - last_char_sum); int diff = std::abs(new_sum - last_char_sum);
if (diff < MAX_CHAR_VARIATION) { if (diff < MAX_CHAR_VARIATION) {
@ -314,7 +320,7 @@ static void do_log(int log_level, const char *msg, va_list args, void *param)
if (too_many_repeated_entries(logFile, msg, str)) if (too_many_repeated_entries(logFile, msg, str))
return; return;
if (log_level <= LOG_INFO) if (log_level <= LOG_INFO || log_verbose)
LogStringChunk(logFile, str); LogStringChunk(logFile, str);
#if defined(_WIN32) && defined(OBS_DEBUGBREAK_ON_ERROR) #if defined(_WIN32) && defined(OBS_DEBUGBREAK_ON_ERROR)
@ -1796,6 +1802,12 @@ int main(int argc, char *argv[])
if (arg_is(argv[i], "--portable", "-p")) { if (arg_is(argv[i], "--portable", "-p")) {
portable_mode = true; portable_mode = true;
} else if (arg_is(argv[i], "--verbose", nullptr)) {
log_verbose = true;
} else if (arg_is(argv[i], "--unfiltered_log", nullptr)) {
unfiltered_log = true;
} else if (arg_is(argv[i], "--startstreaming", nullptr)) { } else if (arg_is(argv[i], "--startstreaming", nullptr)) {
opt_start_streaming = true; opt_start_streaming = true;