get_logger() support #814
-
Previoulsy i was using quill version 1.7.3, and we i used to log by getting the logger instance Now i have upgraded to latest 10.0.0 and i think quill::get_logger() is not supported. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
What i did was storing it in a singleton class LoggerSingleton
{
public:
static LoggerSingleton& instance()
{
return s_instance;
}
quill::Logger* get_logger() { return logger_; }
private:
LoggerSingleton()
{
auto console_sink = quill::Frontend::create_or_get_sink<quill::ConsoleSink>("sink_id_1");
logger_ = quill::Frontend::create_or_get_logger("root", std::move(console_sink));
}
quill::Logger* logger_{nullptr};
static LoggerSingleton s_instance;
};
LoggerSingleton LoggerSingleton::s_instance;
int main()
{
quill::BackendOptions backend_options;
quill::Backend::start(backend_options);
LOG_INFO(LoggerSingleton::instance().get_logger(), "Test");
}
it is also possible to look it up in each sub module and store it quill/include/quill/Frontend.h Line 298 in ae877d6 |
Beta Was this translation helpful? Give feedback.
What i did was storing it in a singleton
it…