Skip to content
This repository has been archived by the owner on Nov 22, 2023. It is now read-only.

Commit

Permalink
Better log output on mismatches (#462)
Browse files Browse the repository at this point in the history
  • Loading branch information
agutenkunst authored Oct 26, 2020
1 parent 944f844 commit d149ea3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion pilz_testutils/include/pilz_testutils/mock_appender.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class MockAppender : public log4cxx::AppenderSkeleton
};

#define GENERATE_LOGMESSAGE_MATCHER_P(level) \
MATCHER_P(Is##level, msg, "") \
MATCHER_P(Is##level, msg, std::string(#level " \"") + msg + "\"") \
{ \
return arg->getLevel()->toInt() == log4cxx::Level::level##_INT && std::string(msg) == arg->getMessage(); \
}
Expand All @@ -81,4 +81,12 @@ GENERATE_LOGMESSAGE_MATCHER_P(FATAL)

} // namespace pilz_testutils

namespace log4cxx::spi
{
void PrintTo(const LoggingEventPtr& logging_event, std::ostream* os)
{
*os << logging_event->getLevel()->toString() << " \"" << logging_event->getMessage() << "\"";
}
} // namespace log4cxx::spi

#endif // MOCK_APPENDER_H

0 comments on commit d149ea3

Please sign in to comment.