r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
main.cpp
Go to the documentation of this file.
2#include "Client/Client.hpp"
3#include "Utils/Logger.hpp"
4
5int main(const int argc, const char *const *argv, const char *const *env)
6{
8
9 try
10 {
11 const cli::ArgsConfig argsConf = cli::ArgsHandler::ParseArgs(argc, argv);
12 const cli::EnvConfig envConf = cli::ArgsHandler::ParseEnv(env);
13 if (argsConf.exit)
14 {
15 return EXIT_SUCCESS;
16 }
17 cli::Client client(argsConf);
18 client.run();
19 }
20 catch (const std::exception &e)
21 {
22 utl::Logger::log(std::string("Exception: ") + e.what(), utl::LogLevel::WARNING);
23 return EXIT_FAILURE;
24 }
25 catch (...)
26 {
27 utl::Logger::log("Unknown exception", utl::LogLevel::WARNING);
28 return EXIT_FAILURE;
29 }
30 return EXIT_SUCCESS;
31}
This file contains the Client class declaration.
This file contains the Logger class.
static ArgsConfig ParseArgs(int argc, const char *const argv[])
static EnvConfig ParseEnv(const char *const env[])
Class for the client.
Definition Client.hpp:25
void run()
Definition client.cpp:126
static void init()
Definition logger.cpp:7
static void log(const std::string &message, const LogLevel &logLevel)
Definition Logger.hpp:51
This file contains the ArgsHandler class declaration.
int main(const int argc, const char *const *argv, const char *const *env)
Definition main.cpp:5