I'm currently writing a library in C++ and was wondering if I should log from within it. Googling the issue I came across this question but it makes reference to a logging facade. Is there anything equivalent for C++?
The facade pattern is not really what you want here, as that’s more a way to hide the complexity of a system behind a simpler api, which IMO is not really relevant to your problem.
As the user of your library, I’ll probably be grateful for useful log messages. However, I would prefer those messages to end up along with those of the application and those of other libraries. If you hard code logging through stdout, or decide to use any arbitrary logging library, I may not be able to configure it the way I need to. Thus, you want to log through an interface, normally a pure virtual class in C++, for which you may supply a default or a null implementation if you like, but for which you also let the library user provide an implementation.
If I use a number of different libraries that all offer an interface for logging, sure I need to implement all of those interfaces to use my logging library of choice, but it’s normally way simpler than trying to make potentially the same number of logging libraries work well together for the whole application.