From 4e8b6613dc918a0799dab85495118d87e96f24e2 Mon Sep 17 00:00:00 2001 From: Jason Bosco Date: Sat, 30 Jan 2021 13:26:37 -0800 Subject: [PATCH] Log stack trace lines separately to retain formatting --- include/backward.hpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/include/backward.hpp b/include/backward.hpp index c5fe0a68..3c418d48 100644 --- a/include/backward.hpp +++ b/include/backward.hpp @@ -4189,7 +4189,12 @@ private: Printer printer; printer.address = true; //printer.print(st, stderr); - printer.print(st, LOG(ERROR)); + + std::stringstream error_lines; + printer.print(st, error_lines); + for(std::string line; std::getline(error_lines, line);) { + LOG(ERROR) << line; + } #if _XOPEN_SOURCE >= 700 || _POSIX_C_SOURCE >= 200809L psiginfo(info, nullptr);