-
Notifications
You must be signed in to change notification settings - Fork 479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make SignalHandling supports different printer #238
base: master
Are you sure you want to change the base?
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 |
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. 🙏