Added drop_all
This commit is contained in:
parent
3c57133c7a
commit
bf3997de28
@ -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());
|
||||
|
@ -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();
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user