From 17d90f05a9209177b61934f013745a3e5115d17e Mon Sep 17 00:00:00 2001 From: Thulinma Date: Thu, 5 Jun 2014 14:21:32 +0200 Subject: [PATCH] Tweaks to various debug messages. --- src/controller/controller.cpp | 38 +++++++++++------------------------ src/input/input_flv.cpp | 2 -- 2 files changed, 12 insertions(+), 28 deletions(-) diff --git a/src/controller/controller.cpp b/src/controller/controller.cpp index 7284637f..4fe8208a 100644 --- a/src/controller/controller.cpp +++ b/src/controller/controller.cpp @@ -219,32 +219,15 @@ namespace Controller { /// } /// ~~~~~~~~~~~~~~~ void CheckConfig(JSON::Value & in, JSON::Value & out){ - for (JSON::ObjIter jit = in.ObjBegin(); jit != in.ObjEnd(); jit++){ - if (jit->first == "version" || jit->first == "time"){ - continue; - } - if (out.isMember(jit->first)){ - if (jit->second != out[jit->first]){ - Log("CONF", std::string("Updated configuration value ") + jit->first); - } - }else{ - Log("CONF", std::string("New configuration value ") + jit->first); - } - } - for (JSON::ObjIter jit = out.ObjBegin(); jit != out.ObjEnd(); jit++){ - if (jit->first == "version" || jit->first == "time"){ - continue; - } - if ( !in.isMember(jit->first)){ - Log("CONF", std::string("Deleted configuration value ") + jit->first); - } - } out = in; if (out["basepath"].asString()[out["basepath"].asString().size() - 1] == '/'){ out["basepath"] = out["basepath"].asString().substr(0, out["basepath"].asString().size() - 1); } if (out.isMember("debug")){ - Util::Config::printDebugLevel = out["debug"].asInt(); + if (Util::Config::printDebugLevel != out["debug"].asInt()){ + Util::Config::printDebugLevel = out["debug"].asInt(); + DEBUG_MSG(Util::Config::printDebugLevel, "Debug level set to %u", Util::Config::printDebugLevel); + } } } @@ -421,18 +404,20 @@ int main(int argc, char ** argv){ createAccount(Controller::conf.getString("account")); /// User friendliness input added at this line - if (isatty(fileno(stdin))){ + if (isatty(fileno(stdin)) && Controller::conf.getString("logfile") == ""){ //check for username if ( !Controller::Storage.isMember("account") || Controller::Storage["account"].size() < 1){ std::string in_string = ""; while(yna(in_string) == 'x'){ - std::cerr << "Account not set, do you want to create an account? (y)es, (n)o, (a)bort: "; + std::cout << "Account not set, do you want to create an account? (y)es, (n)o, (a)bort: "; + std::cout.flush(); std::getline(std::cin, in_string); if (yna(in_string) == 'y'){ //create account std::string usr_string = ""; while(!(Controller::Storage.isMember("account") && Controller::Storage["account"].size() > 0)){ - std::cerr << "Please type in the username, a colon and a password in the following format; username:password" << std::endl << ": "; + std::cout << "Please type in the username, a colon and a password in the following format; username:password" << std::endl << ": "; + std::cout.flush(); std::getline(std::cin, usr_string); createAccount(usr_string); } @@ -446,7 +431,8 @@ int main(int argc, char ** argv){ if ( !Controller::Storage.isMember("config") || !Controller::Storage["config"].isMember("protocols") || Controller::Storage["config"]["protocols"].size() < 1){ std::string in_string = ""; while(yna(in_string) == 'x'){ - std::cerr << "Protocols not set, do you want to enable default protocols? (y)es, (n)o, (a)bort: "; + std::cout << "Protocols not set, do you want to enable default protocols? (y)es, (n)o, (a)bort: "; + std::cout.flush(); std::getline(std::cin, in_string); if (yna(in_string) == 'y'){ //create protocols @@ -465,7 +451,7 @@ int main(int argc, char ** argv){ } //check for streams if ( !Controller::Storage.isMember("streams") || Controller::Storage["streams"].size() < 1){ - std::cerr << "No streams configured, remember to set up streams through local settings page on port " << Controller::conf.getInteger("listen_port") << " or using the API." << std::endl; + std::cout << "No streams configured, remember to set up streams through local settings page on port " << Controller::conf.getInteger("listen_port") << " or using the API." << std::endl; } } diff --git a/src/input/input_flv.cpp b/src/input/input_flv.cpp index 7c93b96f..25868bc6 100644 --- a/src/input/input_flv.cpp +++ b/src/input/input_flv.cpp @@ -112,7 +112,6 @@ namespace Mist { size_t seekPos = myMeta.tracks[trackSeek].keys[0].getBpos(); for (int i = 0; i < myMeta.tracks[trackSeek].keys.size(); i++){ if (myMeta.tracks[trackSeek].keys[i].getTime() > seekTime){ - DEBUG_MSG(DLVL_WARN, "Seeking to keyframe %d on track %d, timestamp %ld, bytepos %lu", i, trackSeek, myMeta.tracks[trackSeek].keys[i].getTime(), seekPos); break; } seekPos = myMeta.tracks[trackSeek].keys[i].getBpos(); @@ -126,7 +125,6 @@ namespace Mist { while (trackSpec != "") { index = trackSpec.find(' '); selectedTracks.insert(atoi(trackSpec.substr(0, index).c_str())); - DEBUG_MSG(DLVL_WARN, "Added track %d, index = %lld, (index == npos) = %d", atoi(trackSpec.substr(0, index).c_str()), index, index == std::string::npos); if (index != std::string::npos) { trackSpec.erase(0, index + 1); } else {