8000 TRI_ASSERT Log Stream by maierlars · Pull Request #14676 · arangodb/arangodb · GitHub
[go: up one dir, main page]

Skip to content

8000 TRI_ASSERT Log Stream #14676

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

Merged
merged 10 commits into from
Aug 26, 2021
Prev Previous commit
Next Next commit
Remove stream wrapper.
  • Loading branch information
maierlars committed Aug 24, 2021
commit a04948fb224a047d5374d06f1bae917f6b0c543e
20 changes: 7 additions & 13 deletions lib/Basics/debugging.h
Original file line number Diff line number Diff line change
Expand Up @@ -209,22 +209,16 @@ struct NoOpStream {
}
};

struct StringStreamWrapper {
template <typename T>
auto operator<<(T const& v) -> StringStreamWrapper& {
_stream << v;
return *this;
}

std::stringstream _stream;
};

struct AssertionLogger {
void operator&(StringStreamWrapper const& wrapper) {
std::string message = wrapper._stream.str();
void operator&(std::ostringstream const& stream) const {
std::string message = stream.str();
arangodb::CrashHandler::assertionFailure(file, line, function, expr,
message.empty() ? nullptr : message.c_str());
}
// can be removed in C++20 because of LWG 1203
void operator&(std::ostream const& stream) const {
operator&(static_cast<std::ostringstream const&>(stream));
}
void operator&(NoOpStream const&) {}
const char* file;
int line;
Expand All @@ -245,7 +239,7 @@ struct AssertionLogger {
(ADB_LIKELY(expr)) \
? (void)nullptr \
: ::arangodb::debug::AssertionLogger{__FILE__, __LINE__, __FUNCTION__, #expr} & \
(::arangodb::debug::StringStreamWrapper{})
std::ostringstream{}

#else

Expand Down
0