dlr-gtlab / gt-logging

Basic C++14 logging library based on QsLog
0 stars 0 forks source link

Consider implementing option to log a message to a single destination #55

Open rainman110 opened 1 year ago

rainman110 commented 1 year ago

In GitLab by @mariusalexander on Jun 12, 2023, 13:20

There has been the request to log a message to a single destination. While this is techinally possible, using the write mthod of an destination, the current time, id and other flags are not automatically processed like they are using the gt::log::Logger::Helper class.

Maybe we could provide a macro like gtLogTo (or gtLogToDest/gtLogDest) which accepts a destination pointer as well as the logging level. It could be used like this:

auto myDestPtr = gt::log::makeDebugOutputDestination();
auto* myDest = myDestPtr.get();  // access ptr before it has been moved
gt::log::Logger::instance().addDestination("my_dest", std::move(myDestPtr));

gtLogTo(myDest, Debug) << "Hello world"; // Debug will denote the logging level (to avoid having to declare multiple new macros)
rainman110 commented 1 year ago

In GitLab by @mariusalexander on Sep 20, 2023, 13:48

created branch 55-consider-implementing-option-to-log-a-message-to-a-single-destination to address this issue