Properly format multiline logs

As a side effect, colouring on Windows should now work
regardless of version
This commit is contained in:
moneromooo-monero 2019-06-22 14:42:48 +00:00
parent 2c171a9b02
commit 32f725d32f
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
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();
}