Merge pull request #5864

32f725d Properly format multiline logs (moneromooo-monero)
This commit is contained in:
luigi1111 2019-09-24 10:05:21 -05:00
commit 8c41d36a08
No known key found for this signature in database
GPG key ID: F4ACA0183641E010
8 changed files with 217 additions and 66 deletions

View file

@ -178,3 +178,20 @@ TEST(logging, last_precedence)
cleanup();
}
TEST(logging, multiline)
{
init();
mlog_set_categories("global:INFO");
MGINFO("first\nsecond\nthird");
std::string str;
ASSERT_TRUE(load_log_to_string(log_filename, str));
ASSERT_TRUE(nlines(str) == 3);
ASSERT_TRUE(str.find("global") != std::string::npos);
ASSERT_TRUE(str.find("first") != std::string::npos);
ASSERT_TRUE(str.find("second") != std::string::npos);
ASSERT_TRUE(str.find("third") != std::string::npos);
ASSERT_TRUE(str.find("first\nsecond") == std::string::npos);
ASSERT_TRUE(str.find("second\nthird") == std::string::npos);
cleanup();
}