Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#10524 closed Feature Requests (fixed)

Why does boost\log\sinks\text_file_backend.cpp prevents users from reusing its classes?

Reported by: blacksmith33@… Owned by: Andrey Semashev
Milestone: To Be Determined Component: log
Version: Boost 1.57.0 Severity: Problem
Keywords: logger; inheritance; code reuse Cc:

Description

Hello, guys!

Today my colleague have encountered a problem.

We're using boost logger in our application and it's really great boost library part. But, we need to change some of it's functionality. Actually, we need to add some lines of code in a method of collector class (for example, file_collector)

I guess the right way of doing it is inheritance from file_collector and redefining those functions. But, since it's all declaration and definition is in text_file_backend.cpp file in an anonymous namespace, it's impossible.

The only solution I see is to copy-and-paste entire file_collector class and rewrite some of it's methods content.

Is there any reason that the entire class is in text_file_backend.cpp file or maybe I am missing something?

Thank you for attention!

Change History (2)

comment:1 by Andrey Semashev, 8 years ago

Resolution: fixed
Status: newclosed

There is the file::collector interface that you can implement and supply to the sink as the file collector. file_collector in text_file_backend.cpp is not designed to be extensible because the interface for the extension is not clear. This made the implementation simpler.

comment:2 by blacksmith33@…, 8 years ago

Thank you for your advice and good luck on improving such an awesome boost library.

Note: See TracTickets for help on using tickets.