Fix logger

FossilOrigin-Name: 499b09c29a9db49e92dd33e0e6cad317f7fefe704ca66c3492fa629622cced61
This commit is contained in:
nekobit 2022-10-02 00:57:48 +00:00
parent 8bc17c9346
commit 8520a03092
3 changed files with 5 additions and 3 deletions

View file

@ -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}

View file

@ -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;

View file

@ -30,10 +30,9 @@ void start_wormhole()
using namespace std::string_literals;
std::unique_ptr<HTTP::Server> server =
std::make_unique<HTTP::MicroHttpdServer>(4000);
std::make_unique<HTTP::MicroHttpdServer>(8000);
server->map_routes({
{ {HTTP::Request::Type::GET, "/test"}, [](const HTTP::RequestArgs_t& arg){
return HTTP::Response{"<html><body>Hello, browser!</body></html>"};
} },
@ -46,6 +45,7 @@ void start_wormhole()
server->start();
Logger::instance() << "Loading config";
getchar();
}