From 8520a030925bb25bbe525a07916051040a832598 Mon Sep 17 00:00:00 2001 From: nekobit Date: Sun, 2 Oct 2022 00:57:48 +0000 Subject: [PATCH] Fix logger FossilOrigin-Name: 499b09c29a9db49e92dd33e0e6cad317f7fefe704ca66c3492fa629622cced61 --- CMakeLists.txt | 2 ++ src/logger.cpp | 2 +- src/main.cpp | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6151495..d159d3e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,8 @@ set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") +# + include_directories(wormhole ${LIBMICROHTTPD_INCLUDE_DIRS} ${YAML_CPP_INCLUDE_DIRS} diff --git a/src/logger.cpp b/src/logger.cpp index 710af77..4d26d9c 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -72,7 +72,7 @@ void Logger::Logger::log(std::string message, Level level) Logger::Logger& Logger::instance() { - if (inst_setup) + if (!inst_setup) { inst.set_log_hook([](const Log& log) { std::cout << log << std::endl; diff --git a/src/main.cpp b/src/main.cpp index a6d1bd2..738527c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -30,10 +30,9 @@ void start_wormhole() using namespace std::string_literals; std::unique_ptr server = - std::make_unique(4000); + std::make_unique(8000); server->map_routes({ - { {HTTP::Request::Type::GET, "/test"}, [](const HTTP::RequestArgs_t& arg){ return HTTP::Response{"Hello, browser!"}; } }, @@ -46,6 +45,7 @@ void start_wormhole() server->start(); Logger::instance() << "Loading config"; + getchar(); }