17 #ifndef SPDLOG_DISABLE_DEFAULT_LOGGER 24 #endif // SPDLOG_DISABLE_DEFAULT_LOGGER 30 #include <unordered_map> 51 new_logger->set_formatter(
formatter_->clone());
58 new_logger->set_level(
level_);
99 if (new_default_logger !=
nullptr)
101 loggers_[new_default_logger->name()] = new_default_logger;
106 void set_tp(std::shared_ptr<thread_pool> tp)
108 std::lock_guard<std::recursive_mutex> lock(
tp_mutex_);
114 std::lock_guard<std::recursive_mutex> lock(
tp_mutex_);
134 l.second->set_level(log_level);
144 l.second->flush_on(log_level);
161 l.second->set_error_handler(handler);
212 std::lock_guard<std::recursive_mutex> lock(
tp_mutex_);
239 #ifndef SPDLOG_DISABLE_DEFAULT_LOGGER 242 auto color_sink = std::make_shared<sinks::wincolor_stdout_sink_mt>();
244 auto color_sink = std::make_shared<sinks::ansicolor_stdout_sink_mt>();
247 const char *default_logger_name =
"";
251 #endif // SPDLOG_DISABLE_DEFAULT_LOGGER 260 throw spdlog_ex(
"logger with name '" + logger_name +
"' already exists");
266 auto logger_name = new_logger->name();
273 std::unordered_map<std::string, std::shared_ptr<logger>>
loggers_;
278 std::shared_ptr<thread_pool>
tp_;
std::shared_ptr< logger > default_logger_
std::recursive_mutex tp_mutex_
std::shared_ptr< thread_pool > get_tp()
std::unordered_map< std::string, std::shared_ptr< logger > > loggers_
void throw_if_exists_(const std::string &logger_name)
std::shared_ptr< thread_pool > tp_
level::level_enum flush_level_
void apply_all(const std::function< void(const std::shared_ptr< logger >)> &fun)
void set_formatter(std::unique_ptr< formatter > formatter)
void flush_on(level::level_enum log_level)
static registry & instance()
void set_error_handler(log_err_handler handler)
std::recursive_mutex & tp_mutex()
void set_tp(std::shared_ptr< thread_pool > tp)
log_err_handler err_handler_
static level::level_enum default_level()
std::shared_ptr< spdlog::details::thread_pool > thread_pool()
void set_level(level::level_enum log_level)
second seconds
Alias for common language habits.
std::unique_ptr< periodic_worker > periodic_flusher_
std::mutex logger_map_mutex_
registry & operator=(const registry &)=delete
void initialize_logger(std::shared_ptr< logger > new_logger)
void set_default_logger(std::shared_ptr< logger > new_default_logger)
std::mutex flusher_mutex_
void set_automatic_registration(bool automatic_regsistration)
void flush_every(std::chrono::seconds interval)
static msg_handler handler
std::unique_ptr< formatter > formatter_
void register_logger_(std::shared_ptr< logger > new_logger)
void function(int client, int *resource, int parblock, int *test, int p)
bool automatic_registration_
void drop(const std::string &logger_name)
std::function< void(const std::string &err_msg)> log_err_handler
void register_logger(std::shared_ptr< logger > new_logger)
logger * get_default_raw()
std::shared_ptr< logger > default_logger()