logging: include file name suffixes in XLOG() category names
[folly.git] / folly / experimental / logging / xlog.cpp
index 3468c29f8fe97cb4044177881dcd2a412f84ce10..868021160f818d015e1c8f16a98c46b9bb933d5a 100644 (file)
@@ -52,7 +52,7 @@ StringPiece stripBuckOutPrefix(StringPiece filename) {
     idx = end + 1;
   }
 }
-} // unnamed namespace
+} // namespace
 
 std::string getXlogCategoryNameForFile(StringPiece filename) {
   // Buck mangles the directory layout for header files.  Rather than including
@@ -69,20 +69,12 @@ std::string getXlogCategoryNameForFile(StringPiece filename) {
 
   // Translate slashes to dots, to turn the directory layout into
   // a category hierarchy.
-  size_t lastDot = std::string::npos;
   for (size_t n = 0; n < categoryName.size(); ++n) {
     if (categoryName[n] == '/') {
       categoryName[n] = '.';
-      lastDot = std::string::npos;
-    } else if (categoryName[n] == '.') {
-      lastDot = n;
     }
   }
 
-  // Strip off the filename extension, if one was present.
-  if (lastDot != std::string::npos) {
-    categoryName.resize(lastDot);
-  }
   return categoryName;
 }
 
@@ -132,4 +124,4 @@ LogLevel XlogLevelInfo<false>::loadLevelFull(
 // compiled or not.
 template class XlogLevelInfo<true>;
 template class XlogCategoryInfo<true>;
-}
+} // namespace folly