/
farado
/
farado-binara
Обзор
Документация
Войти
/
farado
/
farado-binara
Код
Запросы
0
Пакеты
0
Релизы
0
CI/CD
Аналитика
develop
src/retejo/main.cpp
78 строк
2 KB
Ostapenko Alexey
[datenaro][retejo][f2fb] Корректировка инициализации средств логирования.
10 апр 2024, 08:22
10 апр 2024, 08:22
5f80f28
Код
Авторство
О чём код?
#include <cstdlib> #include <iostream> #include <boost/program_options.hpp> #include "common/config/config.h" #include "common/log/log.h" #include "stem.h" std::string configFilename(const boost::program_options::variables_map& variables) { if (variables.count("config")) return variables["config"].as<std::string>(); return "config.ini"; } void printHelp(const boost::program_options::options_description& options) { std::cout << "Использование: retejo [ПАРАМЕТР]…" << std::endl << "Формирует пользовательский интерфейс системы farado-binara" << std::endl << "в виде ВЕБ-сайта." << std::endl << std::endl; std::cout << options << std::endl; } int main(int argc, char* argv[]) { namespace po = boost::program_options; po::options_description options("Допустимые параметры"); options.add_options()( "help,h", "вывести справочное сообщение с перечнем разрешенных параметров" )( "config,c", po::value<std::string>(), "задать альтернативный путь к файлу конфигурации" ); po::variables_map variables; try { po::store(po::parse_command_line(argc, argv, options), variables); po::notify(variables); } catch (const po::error& exception) { LOG_ERROR << exception.what(); printHelp(options); return EXIT_FAILURE; } if (variables.count("help")) { printHelp(options); return EXIT_SUCCESS; } initConfig(configFilename(variables)); initLog( "retejo", CONFIG.fileLog.logPath, CONFIG.fileLog.rotationSize, CONFIG.fileLog.needSourceLocation, CONFIG.fileLog.needThreadId, CONFIG.fileLog.dateTimeFormat, CONFIG.fileLog.severityLevel, CONFIG.consoleLog.needSourceLocation, CONFIG.consoleLog.needThreadId, CONFIG.consoleLog.dateTimeFormat, CONFIG.consoleLog.severityLevel ); auto application = Stem(); return application.run(); }