Stacktrace dump method added
Summary: Stacktrace dump method added Test Plan: manual Reviewers: buda Subscribers: buda Differential Revision: https://memgraph.phacility.com/D19
This commit is contained in:
parent
9154f9b719
commit
b4c65d9680
@ -58,6 +58,22 @@ public:
|
||||
return lines.size();
|
||||
}
|
||||
|
||||
void dump(std::ostream& stream) {
|
||||
std::string message;
|
||||
for (int i = 0; i < size(); i++) {
|
||||
message.append(fmt::format("at {} ({})\n", lines[i].function,
|
||||
lines[i].location));
|
||||
}
|
||||
stream << message;
|
||||
}
|
||||
|
||||
void dump(std::string& message) {
|
||||
for (int i = 0; i < size(); i++) {
|
||||
message.append(fmt::format("at {} ({}) \n", lines[i].function,
|
||||
lines[i].location));
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
std::vector<Line> lines;
|
||||
|
||||
|
@ -9,14 +9,7 @@
|
||||
// TODO: log to local file or remote database
|
||||
void stacktrace(std::ostream& stream) noexcept {
|
||||
Stacktrace stacktrace;
|
||||
|
||||
std::string message;
|
||||
|
||||
for (int i = 0; i < stacktrace.size(); i++) {
|
||||
message.append(fmt::format("\n at {} ({})", stacktrace[i].function,
|
||||
stacktrace[i].location));
|
||||
}
|
||||
stream << message << std::endl;
|
||||
stacktrace.dump(stream);
|
||||
}
|
||||
|
||||
// TODO: log to local file or remote database
|
||||
|
@ -22,11 +22,7 @@ static constexpr const char* port = "7687";
|
||||
|
||||
void throw_and_stacktace(std::string message) {
|
||||
Stacktrace stacktrace;
|
||||
|
||||
for (int i = 0; i < stacktrace.size(); i++)
|
||||
message.append(fmt::format("\n at {} ({})", stacktrace[i].function,
|
||||
stacktrace[i].location));
|
||||
|
||||
stacktrace.dump(message);
|
||||
logger.info(message);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user