4

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:

  1. Using one global logger object.
  2. Using one logger object per class by using Boost.Log's label mechanism.
  3. 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 of Boost.Log?
TemplateRex
  • 69,038
  • 19
  • 164
  • 304
Markus Mayr
  • 4,038
  • 1
  • 20
  • 42

0 Answers0