Go to the source code of this file.
|
| folly |
| —— Concurrent Priority Queue Implementation ——
|
|
|
| TEST_F (LoggerTest, basic) |
|
| TEST_F (LoggerTest, subCategory) |
|
| TEST_F (LoggerTest, formatMessage) |
|
| TEST_F (LoggerTest, follyFormatError) |
|
| TEST_F (LoggerTest, toString) |
|
void | toAppend (const ToStringFailure &, std::string *) |
|
| TEST_F (LoggerTest, toStringError) |
|
| TEST_F (LoggerTest, formatFallbackError) |
|
| TEST_F (LoggerTest, formatFallbackUnsupported) |
|
| TEST_F (LoggerTest, streamingArgs) |
|
| TEST_F (LoggerTest, escapeSequences) |
|
| TEST_F (LoggerTest, logMacros) |
|
| TEST_F (LoggerTest, logRawMacros) |
|
Definition at line 53 of file LoggerTest.cpp.
References ASSERT_EQ, EXPECT_EQ, EXPECT_FALSE, FB_LOG, folly::gen::first, messages, and folly::WARN.
55 auto expectedLine = __LINE__ + 1;
56 FB_LOG(logger_, WARN,
"hello world");
58 auto&
messages = handler_->getMessages();
static struct message messages[5]
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define FB_LOG(logger, level,...)
#define EXPECT_FALSE(condition)
constexpr detail::First first
Definition at line 69 of file LoggerTest.cpp.
References ASSERT_EQ, db_, folly::ERR, EXPECT_EQ, EXPECT_TRUE, FB_LOG, folly::gen::first, and messages.
72 auto expectedLine = __LINE__ + 1;
73 FB_LOG(subLogger, ERR,
"sub-category\nlog message");
75 auto&
messages = handler_->getMessages();
static struct message messages[5]
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define FB_LOG(logger, level,...)
std::unique_ptr< LoggerDB > db_
#define EXPECT_TRUE(condition)
constexpr detail::First first
Definition at line 86 of file LoggerTest.cpp.
References ASSERT_EQ, EXPECT_EQ, EXPECT_FALSE, FB_LOGF, folly::gen::first, messages, and folly::WARN.
87 auto expectedLine = __LINE__ + 1;
88 FB_LOGF(logger_, WARN,
"num events: {:06d}, duration: {:6.3f}", 1234, 5.6789);
90 auto&
messages = handler_->getMessages();
93 "num events: 001234, duration: 5.679",
messages[0].
first.getMessage());
static struct message messages[5]
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define FB_LOGF(logger, level, fmt, arg1,...)
#define EXPECT_FALSE(condition)
constexpr detail::First first
Definition at line 102 of file LoggerTest.cpp.
References ASSERT_EQ, EXPECT_EQ, EXPECT_FALSE, EXPECT_THAT, FB_LOGF, folly::gen::first, testing::MatchesRegex(), messages, and folly::WARN.
106 logger_, WARN,
"param1: {:06d}, param2: {:6.3f}", 1234,
"hello world!");
108 auto&
messages = handler_->getMessages();
115 R
"(error formatting log message: )" 116 R"(invalid format argument \{:6.3f\}: invalid specifier 'f'; )" 117 R"(format string: "param1: \{:06d\}, param2: \{:6.3f\}", )" 118 R"(arguments: \((.*: )?1234\), \((.*: )?hello world\!\))")); static struct message messages[5]
PolymorphicMatcher< internal::MatchesRegexMatcher > MatchesRegex(const internal::RE *regex)
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define FB_LOGF(logger, level, fmt, arg1,...)
#define EXPECT_THAT(value, matcher)
#define EXPECT_FALSE(condition)
constexpr detail::First first
Definition at line 126 of file LoggerTest.cpp.
References ASSERT_EQ, folly::DBG5, EXPECT_EQ, EXPECT_FALSE, FB_LOG, folly::gen::first, and messages.
128 auto expectedLine = __LINE__ + 1;
129 FB_LOG(logger_, DBG5,
"status=", 5,
" name=",
"foobar");
131 auto&
messages = handler_->getMessages();
static struct message messages[5]
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define FB_LOG(logger, level,...)
#define EXPECT_FALSE(condition)
constexpr detail::First first
Definition at line 178 of file LoggerTest.cpp.
References ASSERT_EQ, folly::DBG1, EXPECT_EQ, EXPECT_FALSE, FB_LOG, folly::gen::first, and messages.
185 auto expectedLine = __LINE__ + 1;
186 FB_LOG(logger_, DBG1,
"status=", obj,
" name=",
"foobar");
188 auto&
messages = handler_->getMessages();
191 "error constructing log message: " 192 "error converting ToStringFailure object to a string",
static struct message messages[5]
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define FB_LOG(logger, level,...)
#define EXPECT_FALSE(condition)
constexpr detail::First first
Definition at line 202 of file LoggerTest.cpp.
References ASSERT_EQ, EXPECT_EQ, EXPECT_FALSE, EXPECT_THAT, FB_LOGF, folly::gen::first, testing::MatchesRegex(), messages, and folly::WARN.
205 FB_LOGF(logger_, WARN,
"param1: {}, param2: {}, {}", 1234, obj);
207 auto&
messages = handler_->getMessages();
212 R
"(error formatting log message: invalid format argument \{\}: )" 213 R"(argument index out of range, max=2; )" 214 R"(format string: "param1: \{\}, param2: \{\}, \{\}", )" 215 R"(arguments: \((.*: )?1234\), )" 216 R"(\((.*ToStringFailure.*: )?<error_converting_to_string>\))")); static struct message messages[5]
PolymorphicMatcher< internal::MatchesRegexMatcher > MatchesRegex(const internal::RE *regex)
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define FB_LOGF(logger, level, fmt, arg1,...)
#define EXPECT_THAT(value, matcher)
#define EXPECT_FALSE(condition)
constexpr detail::First first
Definition at line 224 of file LoggerTest.cpp.
References ASSERT_EQ, EXPECT_EQ, EXPECT_FALSE, EXPECT_THAT, FB_LOGF, folly::gen::first, testing::MatchesRegex(), messages, and folly::WARN.
227 FB_LOGF(logger_, WARN,
"param1: {}, param2: {}", 1234, obj);
229 auto&
messages = handler_->getMessages();
234 R
"(error formatting log message: test; )" 235 R"(format string: "param1: \{\}, param2: \{\}", )" 236 R"(arguments: \((.*: )?1234\), )" 237 R"(\((.*FormattableButNoToString.*: )?<no_string_conversion>\))")); static struct message messages[5]
PolymorphicMatcher< internal::MatchesRegexMatcher > MatchesRegex(const internal::RE *regex)
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define FB_LOGF(logger, level, fmt, arg1,...)
#define EXPECT_THAT(value, matcher)
#define EXPECT_FALSE(condition)
constexpr detail::First first
Definition at line 245 of file LoggerTest.cpp.
References ASSERT_EQ, EXPECT_EQ, EXPECT_FALSE, FB_LOG, FB_LOGF, folly::gen::first, messages, string, and folly::WARN.
246 auto&
messages = handler_->getMessages();
250 FB_LOG(logger_, WARN) <<
"foo=" << foo <<
", test=0x" << std::hex << 35;
261 FB_LOG(logger_, WARN,
"foo=", foo) <<
" hello, " 273 FB_LOGF(logger_, WARN,
"foo={}, x={}", foo, 34) <<
", also " << 12;
static struct message messages[5]
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define FB_LOG(logger, level,...)
#define FB_LOGF(logger, level, fmt, arg1,...)
#define EXPECT_FALSE(condition)
constexpr detail::First first
Definition at line 284 of file LoggerTest.cpp.
References ASSERT_EQ, EXPECT_EQ, EXPECT_FALSE, FB_LOG, folly::gen::first, messages, and folly::WARN.
287 auto expectedLine = __LINE__ + 1;
288 FB_LOG(logger_, WARN,
"hello \033[34mworld\033[0m!");
290 auto&
messages = handler_->getMessages();
static struct message messages[5]
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define FB_LOG(logger, level,...)
#define EXPECT_FALSE(condition)
constexpr detail::First first
Definition at line 301 of file LoggerTest.cpp.
References ASSERT_EQ, db_, folly::DBG0, folly::DBG1, folly::DBG2, folly::DBG3, folly::DBG5, folly::DBG7, folly::DBG9, folly::ERR, EXPECT_EQ, EXPECT_FALSE, EXPECT_THAT, EXPECT_TRUE, FB_LOG, FB_LOGF, folly::gen::first, testing::MatchesRegex(), and messages.
305 Logger footest1234{&
db_,
"test.foo.test.1234"};
307 db_.setLevel(
"test", LogLevel::ERR);
308 db_.setLevel(
"test.foo", LogLevel::DBG2);
309 db_.setLevel(
"test.foo.test", LogLevel::DBG7);
311 auto&
messages = handler_->getMessages();
315 FB_LOG(other, DBG0,
"this should be discarded");
319 bool argumentEvaluated =
false;
320 auto getValue = [&] {
321 argumentEvaluated =
true;
324 FB_LOG(foobar, DBG3,
"discarded message: ", getValue());
327 FB_LOG(foobar, DBG1,
"this message should pass: ", getValue());
334 argumentEvaluated =
false;
335 FB_LOGF(footest1234, DBG9,
"failing log check: {}", getValue());
338 FB_LOGF(footest1234, DBG5,
"passing log: {:03}", getValue());
345 FB_LOGF(footest1234, ERR,
"whoops: {}, {}", getValue());
350 R
"(error formatting log message: invalid format argument \{\}: )" 351 R"(argument index out of range, max=1; )" 352 R"(format string: "whoops: \{\}, \{\}", arguments: \((.*: )?5\))")); static struct message messages[5]
PolymorphicMatcher< internal::MatchesRegexMatcher > MatchesRegex(const internal::RE *regex)
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define FB_LOG(logger, level,...)
std::unique_ptr< LoggerDB > db_
#define FB_LOGF(logger, level, fmt, arg1,...)
#define EXPECT_TRUE(condition)
#define EXPECT_THAT(value, matcher)
#define EXPECT_FALSE(condition)
constexpr detail::First first
Definition at line 356 of file LoggerTest.cpp.
References ASSERT_EQ, db_, folly::DBG1, folly::DBG2, EXPECT_EQ, FB_LOG_RAW, FB_LOGF_RAW, folly::gen::first, and messages.
358 db_.setLevel(
"test.foo", LogLevel::DBG2);
360 auto&
messages = handler_->getMessages();
379 auto level = LogLevel::DBG1;
389 <<
" plus extra stuff";
static struct message messages[5]
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
#define FB_LOG_RAW(logger, level, filename, linenumber, functionName,...)
#define FB_LOGF_RAW(logger, level, filename, linenumber, functionName, fmt, arg1,...)
std::unique_ptr< LoggerDB > db_
constexpr detail::First first
Definition at line 146 of file LoggerTest.cpp.
149 throw std::runtime_error(
150 "error converting ToStringFailure object to a string");