X-Git-Url: https://git.siccegge.de//index.cgi?a=blobdiff_plain;f=src%2Fmain.cxx;h=ccb2c52951ccd9639866f507f7c064c954ada0bd;hb=6c57e6468447bf3b71b5990e62b56990dc520fee;hp=d284d4fcb0a3e685d797877182465505f9bb25a7;hpb=914bc03c4ed200f495288d8483f4b9909368b4fd;p=frida%2Ffrida.git diff --git a/src/main.cxx b/src/main.cxx index d284d4f..ccb2c52 100644 --- a/src/main.cxx +++ b/src/main.cxx @@ -17,6 +17,7 @@ #include "gui/Mainwindow.hxx" #include "core/InformationManager.hxx" +#include "core/Settings.hxx" #include "disassembler/llvm/LLVMDisassembler.hxx" #include "Config.hxx" @@ -37,11 +38,37 @@ int main(int argc, char** argv) #ifdef ARGPARSE parser.addHelpOption(); parser.addVersionOption(); + + QCommandLineOption loglevelOption("loglevel", "Control verbosity of logging", "FATAL|ERROR|WARN|INFO|DEBUG|TRACE"); + loglevelOption.setDefaultValue("INFO"); + parser.addOption(loglevelOption); + parser.addPositionalArgument("filename", QCoreApplication::translate("main", "File to disassemble.")); parser.process(app); #endif + log4cxx::LevelPtr level = log4cxx::Level::getInfo(); +#ifdef ARGPARSE + if (parser.value(loglevelOption) != "") { + std::string levelstring = parser.value(loglevelOption).toStdString(); + if (levelstring == "FATAL") + level = log4cxx::Level::getFatal(); + if (levelstring == "ERROR") + level = log4cxx::Level::getError(); + if (levelstring == "WARN") + level = log4cxx::Level::getWarn(); + if (levelstring == "INFO") + level = log4cxx::Level::getInfo(); + if (levelstring == "DEBUG") + level = log4cxx::Level::getDebug(); + if (levelstring == "TRACE") + level = log4cxx::Level::getTrace(); + } +#endif + log4cxx::Logger::getRootLogger()->setLevel(level); + + Settings settings; InformationManager iman; LOG4CXX_DEBUG(_logger, "Initializing LLVM");