mirror of
https://github.com/Sani7/remote-ui.git
synced 2026-10-27 06:01:14 +01:00
client move to spdlog
This commit is contained in:
+20
-1
@@ -1,6 +1,22 @@
|
||||
#include "mainwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include "spdlog/async.h"
|
||||
#include "spdlog/sinks/stdout_color_sinks.h"
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
void init_logger()
|
||||
{
|
||||
spdlog::init_thread_pool(8192, 1);
|
||||
auto stdout_sink = std::make_shared<spdlog::sinks::stdout_color_sink_mt>();
|
||||
//auto rotating_sink = std::make_shared<spdlog::sinks::rotating_file_sink_mt>("log-sim_us.txt", 1024 * 1024 * 10, 3);
|
||||
std::vector<spdlog::sink_ptr> sinks{stdout_sink/*, rotating_sink*/};
|
||||
auto logger = std::make_shared<spdlog::async_logger>("sim_us", sinks.begin(), sinks.end(), spdlog::thread_pool(),
|
||||
spdlog::async_overflow_policy::block);
|
||||
spdlog::set_default_logger(logger);
|
||||
spdlog::set_pattern("[%H:%M:%S %z] [%^---%L---%$] %@: %v");
|
||||
spdlog::flush_every(std::chrono::seconds(3));
|
||||
spdlog::set_level(spdlog::level::trace);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
@@ -22,6 +38,9 @@ int main(int argc, char *argv[])
|
||||
parser.addOption(portOption);
|
||||
|
||||
parser.process(a);
|
||||
// Initialize the logger
|
||||
init_logger();
|
||||
SPDLOG_INFO("Starting GUI");
|
||||
|
||||
QString host = parser.value(hostOption);
|
||||
uint16_t port = parser.value(portOption).toUShort();
|
||||
|
||||
Reference in New Issue
Block a user