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 client.stop();
20 }
21 catch (const std::exception &e)
22 {
23 utl::Logger::log(std::string("Exception: ") + e.what(), utl::LogLevel::WARNING);
24 return EXIT_FAILURE;
25 }
26 catch (...)
27 {
28 utl::Logger::log("Unknown exception", utl::LogLevel::WARNING);
29 return EXIT_FAILURE;
30 }
31 return EXIT_SUCCESS;
32}
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:26
void stop() const
Definition client.cpp:84
void run()
Definition client.cpp:69
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