Use the filter function
This commit is contained in:
parent
8fb486570b
commit
69761c8e8a
@ -21,7 +21,7 @@ namespace cpptrace {
|
|||||||
bool snippets = false;
|
bool snippets = false;
|
||||||
int context_lines = 2;
|
int context_lines = 2;
|
||||||
bool columns = true;
|
bool columns = true;
|
||||||
std::function<bool(const stacktrace_frame&)> filter = [] (const stacktrace_frame&) { return true; };
|
std::function<bool(const stacktrace_frame&)> filter;
|
||||||
} options;
|
} options;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -139,6 +139,10 @@ namespace cpptrace {
|
|||||||
}
|
}
|
||||||
const auto frame_number_width = detail::n_digits(static_cast<int>(frames.size()) - 1);
|
const auto frame_number_width = detail::n_digits(static_cast<int>(frames.size()) - 1);
|
||||||
for(const auto& frame : frames) {
|
for(const auto& frame : frames) {
|
||||||
|
if(options.filter && !options.filter(frame)) {
|
||||||
|
counter++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
print_frame_internal(stream, frame, color, frame_number_width, counter);
|
print_frame_internal(stream, frame, color, frame_number_width, counter);
|
||||||
if(newline_at_end || &frame != &frames.back()) {
|
if(newline_at_end || &frame != &frames.back()) {
|
||||||
stream << '\n';
|
stream << '\n';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user