From 69761c8e8a8ea4c5354a2bbef1ad988e11475609 Mon Sep 17 00:00:00 2001 From: Jeremy Rifkin <51220084+jeremy-rifkin@users.noreply.github.com> Date: Sat, 1 Feb 2025 13:35:23 -0600 Subject: [PATCH] Use the filter function --- src/formatting.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/formatting.cpp b/src/formatting.cpp index 1fe8a76..2414c37 100644 --- a/src/formatting.cpp +++ b/src/formatting.cpp @@ -21,7 +21,7 @@ namespace cpptrace { bool snippets = false; int context_lines = 2; bool columns = true; - std::function filter = [] (const stacktrace_frame&) { return true; }; + std::function filter; } options; public: @@ -139,6 +139,10 @@ namespace cpptrace { } const auto frame_number_width = detail::n_digits(static_cast(frames.size()) - 1); for(const auto& frame : frames) { + if(options.filter && !options.filter(frame)) { + counter++; + continue; + } print_frame_internal(stream, frame, color, frame_number_width, counter); if(newline_at_end || &frame != &frames.back()) { stream << '\n';