Fix copyright lines
[folly.git] / folly / experimental / logging / test / StandardLogHandlerTest.cpp
index 6a1f78db1091f47c67af40b2777f9dce30b5dbc5..ca8d8088e59142ad70a40204b1e755dc9665112a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright 2004-present Facebook, Inc.
+ * Copyright 2017-present Facebook, Inc.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+#include <folly/experimental/logging/StandardLogHandler.h>
+
 #include <folly/Conv.h>
 #include <folly/experimental/logging/LogCategory.h>
 #include <folly/experimental/logging/LogFormatter.h>
+#include <folly/experimental/logging/LogHandlerConfig.h>
 #include <folly/experimental/logging/LogLevel.h>
 #include <folly/experimental/logging/LogMessage.h>
 #include <folly/experimental/logging/LogWriter.h>
 #include <folly/experimental/logging/LoggerDB.h>
-#include <folly/experimental/logging/StandardLogHandler.h>
 #include <folly/portability/GTest.h>
 
 using namespace folly;
@@ -65,11 +67,12 @@ class TestLogWriter : public LogWriter {
  private:
   std::vector<std::string> messages_;
 };
-}
+} // namespace
 
 TEST(StandardLogHandler, simple) {
   auto writer = make_shared<TestLogWriter>();
-  StandardLogHandler handler(make_shared<TestLogFormatter>(), writer);
+  LogHandlerConfig config{"std_test"};
+  StandardLogHandler handler(config, make_shared<TestLogFormatter>(), writer);
 
   LoggerDB db{LoggerDB::TESTING};
   auto logCategory = db.getCategory("log_cat");
@@ -83,13 +86,14 @@ TEST(StandardLogHandler, simple) {
   handler.handleMessage(msg, handlerCategory);
   ASSERT_EQ(1, writer->getMessages().size());
   EXPECT_EQ(
-      "LogLevel::DBG8::log_cat::handler_cat::src/test.cpp::1234::hello world",
+      "DBG8::log_cat::handler_cat::src/test.cpp::1234::hello world",
       writer->getMessages()[0]);
 }
 
 TEST(StandardLogHandler, levelCheck) {
   auto writer = make_shared<TestLogWriter>();
-  StandardLogHandler handler(make_shared<TestLogFormatter>(), writer);
+  LogHandlerConfig config{"std_test"};
+  StandardLogHandler handler(config, make_shared<TestLogFormatter>(), writer);
 
   LoggerDB db{LoggerDB::TESTING};
   auto logCategory = db.getCategory("log_cat");
@@ -109,11 +113,9 @@ TEST(StandardLogHandler, levelCheck) {
   auto& messages = writer->getMessages();
   ASSERT_EQ(2, messages.size());
   EXPECT_EQ(
-      "LogLevel::WARN::log_cat::handler_cat::src/test.cpp::1234::beware",
-      messages.at(0));
+      "WARN::log_cat::handler_cat::src/test.cpp::1234::beware", messages.at(0));
   EXPECT_EQ(
-      "LogLevel::ERR::log_cat::handler_cat::src/test.cpp::1234::whoops",
-      messages.at(1));
+      "ERR::log_cat::handler_cat::src/test.cpp::1234::whoops", messages.at(1));
   messages.clear();
 
   handler.setLevel(LogLevel::DBG2);
@@ -125,13 +127,11 @@ TEST(StandardLogHandler, levelCheck) {
 
   ASSERT_EQ(3, messages.size());
   EXPECT_EQ(
-      "LogLevel::DBG1::log_cat::handler_cat::src/test.cpp::1234::here",
-      messages.at(0));
+      "DBG1::log_cat::handler_cat::src/test.cpp::1234::here", messages.at(0));
   EXPECT_EQ(
-      "LogLevel::DBG2::log_cat::handler_cat::src/test.cpp::1234::and here",
+      "DBG2::log_cat::handler_cat::src/test.cpp::1234::and here",
       messages.at(1));
   EXPECT_EQ(
-      "LogLevel::ERR::log_cat::handler_cat::src/test.cpp::1234::oh noes",
-      messages.at(2));
+      "ERR::log_cat::handler_cat::src/test.cpp::1234::oh noes", messages.at(2));
   messages.clear();
 }