Commit 4ccca079 authored by gabime's avatar gabime

clone support in lite logger

parent 9e5d1b3b
...@@ -9,4 +9,8 @@ int main() ...@@ -9,4 +9,8 @@ int main()
l.info_printf("Hello %d", 12346); l.info_printf("Hello %d", 12346);
l.warn_printf("Hello %f", 12346.5656); l.warn_printf("Hello %f", 12346.5656);
l.warn("Hello {}", "LITE :) "); l.warn("Hello {}", "LITE :) ");
auto l2 = l.clone("logger2");
l2.debug("HELLO");
} }
\ No newline at end of file
...@@ -125,6 +125,11 @@ void spdlog::lite::logger::set_pattern(std::string pattern) ...@@ -125,6 +125,11 @@ void spdlog::lite::logger::set_pattern(std::string pattern)
impl_->set_pattern(std::move(pattern)); impl_->set_pattern(std::move(pattern));
} }
spdlog::lite::logger spdlog::lite::logger::clone(std::string logger_name)
{
return spdlog::lite::logger(impl_->clone(std::move(logger_name)));
}
void spdlog::lite::logger::log_formatted_(spdlog::lite::level lvl, const fmt::memory_buffer &formatted) void spdlog::lite::logger::log_formatted_(spdlog::lite::level lvl, const fmt::memory_buffer &formatted)
{ {
auto spd_level = to_spdlog_level(lvl); auto spd_level = to_spdlog_level(lvl);
......
...@@ -174,6 +174,11 @@ public: ...@@ -174,6 +174,11 @@ public:
// //
void set_pattern(std::string pattern); void set_pattern(std::string pattern);
//
//clone with new name
//
spdlog::lite::logger clone(std::string logger_name);
protected: protected:
std::shared_ptr<spdlog::logger> impl_; std::shared_ptr<spdlog::logger> impl_;
void log_formatted_(lite::level lvl, const fmt::memory_buffer &formatted); void log_formatted_(lite::level lvl, const fmt::memory_buffer &formatted);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment