]> git.siccegge.de Git - frida/frida.git/blobdiff - src/main.cxx
Add settings Class
[frida/frida.git] / src / main.cxx
index 8c0916cd0d9de3b7bd12531cccf96620fd923e34..ccb2c52951ccd9639866f507f7c064c954ada0bd 100644 (file)
@@ -17,7 +17,9 @@
 
 #include "gui/Mainwindow.hxx"
 #include "core/InformationManager.hxx"
+#include "core/Settings.hxx"
 #include "disassembler/llvm/LLVMDisassembler.hxx"
+#include "Config.hxx"
 
 int main(int argc, char** argv)
 {
@@ -32,14 +34,41 @@ int main(int argc, char** argv)
 
        QApplication::setApplicationName("frida");
        QApplication::setApplicationVersion("0.0");
+       QApplication::addLibraryPath(CONFIG_LIBDIR "/frida/plugins/Interpreter");
 #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");