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