You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
732 B

5 years ago
// #include <cstdlib>
5 years ago
#include <iostream>
5 years ago
#include <fstream>
5 years ago
5 years ago
#include "ArgParser.hpp"
5 years ago
#include "Logger.hpp"
5 years ago
int main(int argc, char* argv[])
5 years ago
{
5 years ago
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);
}
5 years ago
LOG << "hello" << std::endl;
5 years ago
if (!argparser.useConsole())
logfile.close();
5 years ago
return EXIT_SUCCESS;
}