Added drop_all

This commit is contained in:
gabi 2014-12-27 13:01:15 +02:00
parent 3c57133c7a
commit bf3997de28
3 changed files with 19 additions and 4 deletions

View File

@ -78,6 +78,11 @@ public:
_loggers.erase(logger_name);
}
void drop_all()
{
std::lock_guard<std::mutex> lock(_mutex);
_loggers.clear();
}
std::shared_ptr<logger> create(const std::string& logger_name, sinks_init_list sinks)
{
return create(logger_name, sinks.begin(), sinks.end());

View File

@ -142,4 +142,8 @@ inline void spdlog::set_sync_mode()
details::registry::instance().set_sync_mode();
}
inline void spdlog::drop_all()
{
details::registry::instance().drop_all();
}

View File

@ -42,10 +42,7 @@ namespace spdlog
// logger.info() << "This is another message" << x << y << z;
std::shared_ptr<logger> get(const std::string& name);
//
// Drop the reference to this logger.
//
void drop(const std::string &name);
//
// Set global formatting
@ -138,6 +135,15 @@ std::shared_ptr<spdlog::logger> create(const std::string& logger_name, const Arg
#define SPDLOG_DEBUG(logger, ...)
#endif
// Drop the reference to the given logger
void drop(const std::string &name);
// Drop all references
void drop_all();
}
#include "details/spdlog_impl.h"