I am currently considering to use Boost.Log
for logging purposes. It looks quite interesting, but I am not quite sure yet, how I am supposed to manage logger objects.
As far as I can see, there are the following options:
- Using one global logger object.
- Using one logger object per class by using
Boost.Log
's label mechanism. - Using one logger object per object (either by using composition or sub-typing).
I have the following questions:
- What are the benefits of the individual approaches? The
Boost.Log
manual says that the last approach is superior, but I did not understand why. - Which approach keeps the syntactic overhead of logging at a minimum? Or do you make use of any techniques in order to reduce the syntactic overhead? For example, I would like to avoid initializing the logger object from each constructor, but unfortunately constructor delegation is not an option yet.
- Do you have any other suggestions on integrating
Boost.Log
into an application or writing a new one that makes use ofBoost.Log
?