// #include #include #include #include "ArgParser.hpp" #include "Logger.hpp" int main(int argc, char* argv[]) { ArgParser argparser; const int r = argparser.parse(argc, argv); if (r != -1) return r; std::ofstream logfile; if (argparser.useConsole()) { Logger::getInstance()->setStream(&std::cout); } else { logfile.open (argparser.logFile(), std::ios::out | std::ios::app); if (!logfile.is_open()) { std::cerr << "Could not open file '" << argparser.logFile() << "' to append." << std::endl; return EXIT_FAILURE; } Logger::getInstance()->setStream(&logfile); } LOG << "hello" << std::endl; if (!argparser.useConsole()) logfile.close(); return EXIT_SUCCESS; }