I am creating a common module for my team, from parts incoming from many places.
Some are written in C++ 11, others in C++ 14 or 17, and soon I expect putting them all compatible with C++ 20…
My problem is that C++ 11 code is using log4cplus for logger:
auto logger = log4cplus::Logger::getInstance(LOG4CPLUS_TEXT("APP"));
try {
[...]
LOG4CPLUS_INFO(logger, LOG4CPLUS_TEXT("Database connection established..."));
}
catch(const exception& e) {
LOG4CPLUS_INFO(logger, LOG4CPLUS_TEXT("Caught exception : " << converter.from_bytes(e.what())));
}
and this logger won’t be used by my team. Too cumbersome.
My team will expect a classical logger, like:
auto logger = loggerFactory.getInstance("APP");
logger.info("abcd");
logger.debug(str); // where str is a std::string
logger.error(e); // the exception
What loggers are used today, in C++ applications?