Adapts logging

This commit is contained in:
Johannes Wendel
2020-01-06 22:01:18 +01:00
parent bfcc5b86ea
commit 4b76b477f5
23 changed files with 94 additions and 59 deletions

View File

@@ -7,6 +7,7 @@
#include "input/InputSocketHandlerFactory.h"
#include "DriverFactory.h"
#include "utility/Colors.h"
#include "utility/LoggerFactory.h"
#include <Poco/Net/SocketAddress.h>
#include <Poco/Net/ServerSocket.h>
@@ -126,7 +127,6 @@ void FlippRServer::initialize(Application &self)
//this->input_server->start();
logger().warning(FRED("Input server not started!"));
//https://gist.github.com/NIPE-SYSTEMS/5a06428c0880ed7ff3cc4304be436e3e
ServerApplication::initialize(self);
}
@@ -248,6 +248,11 @@ void FlippRServer::defineOptions(OptionSet& options)
.repeatable(false)
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::handle_config_file))
.argument("server-config", true));
options.addOption(Option("debug", "d", "Switch debug messages on.")
.required(false)
.repeatable(true)
.callback(OptionCallback<FlippRServer>(this, &FlippRServer::create_debug_logger)));
}
void FlippRServer::handle_config_file(const std::string &name, const std::string &value)
@@ -283,5 +288,11 @@ std::string FlippRServer::get_runtime_dir()
return std::getenv("XDG_RUNTIME_DIR") ? std::string(std::getenv("XDG_RUNTIME_DIR")) + "/" : DEFAULT_RUNTIME_DIR;
}
void FlippRServer::create_debug_logger(const std::string &name, const std::string &value)
{
utility::LoggerFactory::ActivateDebugLog();
logger().information(FCYN("Activated debug logging."));
}
}
}