0

We are using boost log and want to add information about filename and line number to the logging records, similar to this question: boost log to print source code file name and line number. That is not a problem in itself, but there seems to be two alternative solutions: Either using attributes (as in the answer by Guillermo Ruiz) or by adding the information directly to the logging stream with add_value() as shown here.

My question is: What are advantages/disadvantages of the two approaches when it comes to efficiency, threading, etc.? Any recommendations?

ssaue
  • 1
  • 1
  • If I understand correctly, it doesn't matter if you do not plan for the attributes in question to participate in filtering. See this FAQ https://www.boost.org/doc/libs/1_71_0/libs/log/doc/html/log/rationale/why_attribute_manips_dont_affect_filters.html – Maikel Oct 07 '19 at 11:45
  • Thanks! Then it seems that using add_value might be more efficient in my case, since the attributes are added only if the filter passes the log record. – ssaue Oct 07 '19 at 13:31

0 Answers0