Make SignalHandling supports different printer#238
Make SignalHandling supports different printer#238z0ow wants to merge 1 commit intobombela:masterfrom
Conversation
…::set_printer<PT>()
|
+1 would like to see this merged, i had a similar problem trying to customize the formatting of the |
|
me too |
|
In this current state this would break backward compatibility by requiring C++11. So at least a new major version release would be required. But it is surely possible to maintain compatibility. The printer and signal handlers were meant to be examples to use as a starting point for your own customization. You can write your own, specific to your project(s) and use what you want from backward-cpp. With insight I should have had those examples in a different file. I wanted backward-cpp to be a single file to copy around for easy installation. With that said, many people have asked for this feature over time. Maybe we can have our cake and eat it too. |
|
Any updates? |
|
Why can't you inherit and override the base class? |
|
I tried inheriting from the base class and overriding only Anyway my objection remains, if the PR could be merged it would simplify customizing the printer a lot. I understand that |
|
Dah; of course; the vtable is missing! In C++ the vtable pointer is within the object and I somehow forgot about that (I blame it on enjoying Rust too much ;)). I now remember that the destructor must be marked virtual too. Instead of |
|
Are there any plans to have this merged? It would be really nice to have this functionality. |
The backward::SignalHandling only supports outputting traces via backward::Printer takes a disadvantage to designers to customize their output style. This PR makes a derived class of backward::Printer can override print functions and adds class backward::SignalHandlingBase to allow designers to set their inherited printer as default.
The std::shared_ptr is brought into backward::SignalHandling to support polymorphism. This feature could make backward better if this change does not affect performance and compatibility. 🙏