32 using namespace folly;
33 using std::make_shared;
63 auto handler = make_shared<TestLogHandler>();
89 std::array<bool, 2> conds = {{
false,
true}};
90 for (
unsigned i = 0;
i < conds.size();
i++) {
91 for (
unsigned j = 0; j < conds.size(); j++) {
92 XLOG_IF(
DBG1, conds[
i] && conds[j],
"testing conditional");
96 XLOG_IF(
DBG1, conds[
i] || conds[j],
"testing conditional");
110 XLOG_IF(
DBG1, 0x6 | 0x2 ?
true :
false,
"More conditional 3");
114 XLOG_IF(
DBG1, 0x6 | 0x2 ?
true :
false,
"More conditional 3");
118 XLOG_IF(
DBG1, 0x3 & 0x4 ?
true :
false,
"More conditional 4");
122 XLOG_IF(
DBG1,
false ?
true :
false,
"More conditional 5");
126 XLOGF_IF(
DBG1,
false,
"number: {:>3d}; string: {}", 12,
"foo");
129 XLOGF_IF(
DBG1,
true,
"number: {:>3d}; string: {}", 12,
"foo");
135 auto handler = make_shared<TestLogHandler>();
153 <<
"unexpected file name: " <<
messages[0].
first.getFileName();
159 XLOGF(
WARN,
"number: {:>3d}; string: {}", 12,
"foo");
163 <<
"unexpected file name: " <<
messages[0].
first.getFileName();
169 XLOG(
DBG2,
"this log check should not pass");
174 XLOG(
INFO) <<
"stream test: " << 1 <<
", two, " << 3;
178 <<
"unexpected file name: " <<
messages[0].
first.getFileName();
185 TEST_F(XlogTest, perFileCategoryHandling) {
188 auto handler = make_shared<TestLogHandler>();
198 <<
"unexpected file name: " <<
messages[0].
first.getFileName();
201 "folly.logging.test.XlogHeader2.h",
211 <<
"unexpected file name: " <<
messages[0].
first.getFileName();
214 "folly.logging.test.XlogHeader1.h",
243 "folly.logging.test.XlogFile1.cpp",
251 "folly.logging.test.XlogFile2.cpp",
268 "file1: this log check should pass now",
messages[0].
first.getMessage());
270 "folly.logging.test.XlogFile1.cpp",
276 auto handler = make_shared<TestLogHandler>();
281 for (
size_t n = 0; n < 50; ++n) {
299 for (
size_t n = 0; n < 10; ++n) {
314 std::this_thread::sleep_for(110ms);
356 "myproject.generated_header.h",
358 "buck-out/gen/myproject#headers/myproject/generated_header.h")));
362 "buck-out/gen/foo/bar#header-map,headers/foo/bar/test.h")));
371 "/home/johndoe/src/spacesim/ships/cruiser.cpp",
372 "/home/johndoe/src/spacesim"));
383 <<
"should only strip full directory name matches";
390 <<
"should not strip if the result will be empty";
392 <<
"empty prefixes in the prefix list should be ignored";
395 <<
"only the first prefix match should be honored";
397 <<
"only the first prefix match should be honored";
406 "src/test.cpp") == 0,
407 "incorrect xlogStripFilename() behavior");
#define XLOG_SET_CATEGORY_NAME(category)
static struct message messages[5]
void testXlogFile2Dbg1(folly::StringPiece msg)
#define ASSERT_EQ(val1, val2)
#define XLOG_EVERY_N(level, n,...)
LogCategory * getCategory(folly::StringPiece name)
#define EXPECT_EQ(val1, val2)
void testXlogHdrFunction(folly::StringPiece str, int value)
—— Concurrent Priority Queue Implementation ——
LogConfig parseLogConfig(StringPiece value)
void resetConfig(const LogConfig &config)
void testXlogFile1Dbg1(folly::StringPiece msg)
void handler(int, siginfo_t *, void *)
#define EXPECT_STREQ(s1, s2)
StringPiece getXlogCategoryNameForFile(StringPiece filename)
constexpr const char * xlogStripFilename(const char *filename, const char *prefixes)
internal::ElementsAreArrayMatcher< typename::std::iterator_traits< Iter >::value_type > ElementsAreArray(Iter first, Iter last)
static std::string canonicalize(folly::StringPiece name)
#define XLOG_GET_CATEGORY_NAME()
#define XLOG_IF(level, cond,...)
void testXlogHdrLoop(size_t numIters, folly::StringPiece arg)
constexpr int constexpr_strcmp(const Char *s1, const Char *s2)
#define XLOGF_IF(level, cond, fmt, arg1,...)
TEST_F(AsyncSSLSocketWriteTest, write_coalescing1)
#define EXPECT_TRUE(condition)
#define EXPECT_THAT(value, matcher)
#define XLOG_EVERY_MS(level, ms,...)
#define XLOG_GET_CATEGORY()
void setLevel(folly::StringPiece name, LogLevel level, bool inherit=true)
#define XLOGF(level, fmt, arg1,...)
#define EXPECT_FALSE(condition)
void addHandler(std::shared_ptr< LogHandler > handler)
#define XLOG_IS_ON(level)
internal::ElementsAreMatcher< ::testing::tuple<> > ElementsAre()
TEST(SequencedExecutor, CPUThreadPoolExecutor)
#define XLOG_N_PER_MS(level, count, ms,...)
constexpr detail::First first