qHexWalker 0.0.1
Hexagonal Grid Pathfinding & Maze Visualization on Interactive Maps
Loading...
Searching...
No Matches
logger.h
Go to the documentation of this file.
1#ifndef Q_HEX_WALKER_LOGGER_H
2#define Q_HEX_WALKER_LOGGER_H
3
4#include "spdlog/async.h"
5#include "spdlog/sinks/stdout_color_sinks.h"
6
7namespace TD {
8class Logger {
9public:
10 explicit Logger(const std::string_view loggerName) : loggerName_(loggerName) {}
11 void Init(const size_t queueSize = 8192, const size_t threadCount = 1) {
12 auto console = spdlog::sinks::stdout_color_sink_mt();
13 spdlog::init_thread_pool(queueSize, threadCount);
14 logger_ = spdlog::create_async<spdlog::sinks::stdout_color_sink_mt>(loggerName_);
15 spdlog::set_default_logger(logger_);
16 }
17
18private:
19 std::string loggerName_;
20 std::shared_ptr<spdlog::logger> logger_;
21};
22} // namespace TD
23
24#endif // Q_HEX_WALKER_LOGGER_H
std::string loggerName_
Definition logger.h:19
std::shared_ptr< spdlog::logger > logger_
Definition logger.h:20
Logger(const std::string_view loggerName)
Definition logger.h:10
void Init(const size_t queueSize=8192, const size_t threadCount=1)
Definition logger.h:11