28 using namespace folly;
29 using std::make_shared;
37 return folly::to<std::string>(
56 messages_.emplace_back(buffer.
str());
58 void flush()
override {}
60 std::vector<std::string>& getMessages() {
63 const std::vector<std::string>& getMessages()
const {
67 bool ttyOutput()
const override {
72 std::vector<std::string> messages_;
77 auto writer = make_shared<TestLogWriter>();
82 auto logCategory = db.getCategory(
"log_cat");
83 auto handlerCategory = db.getCategory(
"handler_cat");
92 ASSERT_EQ(1, writer->getMessages().size());
94 "DBG8::log_cat::handler_cat::src/test.cpp::1234::hello world",
95 writer->getMessages()[0]);
99 auto writer = make_shared<TestLogWriter>();
104 auto logCategory = db.getCategory(
"log_cat");
105 auto handlerCategory = db.getCategory(
"handler_cat");
109 logCategory, level,
"src/test.cpp", 1234,
"testMethod", message};
119 auto&
messages = writer->getMessages();
122 "WARN::log_cat::handler_cat::src/test.cpp::1234::beware",
messages.at(0));
124 "ERR::log_cat::handler_cat::src/test.cpp::1234::whoops",
messages.at(1));
136 "DBG1::log_cat::handler_cat::src/test.cpp::1234::here",
messages.at(0));
138 "DBG2::log_cat::handler_cat::src/test.cpp::1234::and here",
141 "ERR::log_cat::handler_cat::src/test.cpp::1234::oh noes",
messages.at(2));
static struct message messages[5]
std::vector< uint8_t > buffer(kBufferSize+16)
void handleMessage(const LogMessage &message, const LogCategory *handlerCategory) override
#define ASSERT_EQ(val1, val2)
#define EXPECT_EQ(val1, val2)
—— Concurrent Priority Queue Implementation ——
string logLevelToString(LogLevel level)
void handler(int, siginfo_t *, void *)
const std::string & getMessage() const
LogLevel getLevel() const
void setLevel(LogLevel level)
folly::StringPiece getFileName() const
const std::string & getName() const
unsigned int getLineNumber() const
const LogCategory * getCategory() const
TEST(SequencedExecutor, CPUThreadPoolExecutor)