#include "Application.h"
#include "Core/Logger.h"
#include "Core/Singleton.h"
#include <boost/asio/signal_set.hpp>

int main(int argc, char const *argv[]) {
    using namespace Core;
    using namespace Older;
    boost::log::initialize("logs/Older");
    auto application = Singleton<Application>::construct();

    boost::asio::signal_set signals(application->ioContext(), SIGINT, SIGTERM, SIGHUP);
    signals.async_wait([&application](boost::system::error_code const &, int signal) {
        LOG(info) << "capture " << (signal == SIGINT ? "SIGINT" : "SIGTERM") << ",stop!";
        application->ioContext().stop();
    });

    return application->exec();
}
