From 73605d91798288a85536b4ad6a9000e6644d260f Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Thu, 30 Oct 2014 13:34:44 -0700 Subject: [PATCH] Apply InfoLogLevel to the logs in util/db_info_dumper.cc Summary: * Rename util/db_info_dummper.cc to util/db_info_dumper.cc * Apply InfoLogLevel to the logs in util/db_info_dumper.cc Test Plan: make Reviewers: ljin, sdong, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D27915 --- .../{db_info_dummper.cc => db_info_dumper.cc} | 26 ++++++++++++------- 1 file changed, 17 insertions(+), 9 deletions(-) rename util/{db_info_dummper.cc => db_info_dumper.cc} (78%) diff --git a/util/db_info_dummper.cc b/util/db_info_dumper.cc similarity index 78% rename from util/db_info_dummper.cc rename to util/db_info_dumper.cc index 2e0d34481..7049e6853 100644 --- a/util/db_info_dummper.cc +++ b/util/db_info_dumper.cc @@ -36,10 +36,11 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { uint64_t file_size; std::string file_info, wal_info; - Log(options.info_log, "DB SUMMARY\n"); + Log(InfoLogLevel::INFO_LEVEL, options.info_log, "DB SUMMARY\n"); // Get files in dbname dir if (!env->GetChildren(dbname, &files).ok()) { - Log(options.info_log, "Error when reading %s dir\n", dbname.c_str()); + Log(InfoLogLevel::ERROR_LEVEL, + options.info_log, "Error when reading %s dir\n", dbname.c_str()); } std::sort(files.begin(), files.end()); for (std::string file : files) { @@ -48,14 +49,17 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { } switch (type) { case kCurrentFile: - Log(options.info_log, "CURRENT file: %s\n", file.c_str()); + Log(InfoLogLevel::INFO_LEVEL, options.info_log, + "CURRENT file: %s\n", file.c_str()); break; case kIdentityFile: - Log(options.info_log, "IDENTITY file: %s\n", file.c_str()); + Log(InfoLogLevel::INFO_LEVEL, options.info_log, + "IDENTITY file: %s\n", file.c_str()); break; case kDescriptorFile: env->GetFileSize(dbname + "/" + file, &file_size); - Log(options.info_log, "MANIFEST file: %s size: %" PRIu64 " Bytes\n", + Log(InfoLogLevel::INFO_LEVEL, options.info_log, + "MANIFEST file: %s size: %" PRIu64 " Bytes\n", file.c_str(), file_size); break; case kLogFile: @@ -79,7 +83,8 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { for (auto& db_path : options.db_paths) { if (dbname.compare(db_path.path) != 0) { if (!env->GetChildren(db_path.path, &files).ok()) { - Log(options.info_log, "Error when reading %s dir\n", + Log(InfoLogLevel::ERROR_LEVEL, options.info_log, + "Error when reading %s dir\n", db_path.path.c_str()); continue; } @@ -92,7 +97,8 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { } } } - Log(options.info_log, "SST files in %s dir, Total Num: %" PRIu64 ", files: %s\n", + Log(InfoLogLevel::INFO_LEVEL, options.info_log, + "SST files in %s dir, Total Num: %" PRIu64 ", files: %s\n", db_path.path.c_str(), file_num, file_info.c_str()); file_num = 0; file_info.clear(); @@ -101,7 +107,8 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { // Get wal file in wal_dir if (dbname.compare(options.wal_dir) != 0) { if (!env->GetChildren(options.wal_dir, &files).ok()) { - Log(options.info_log, "Error when reading %s dir\n", + Log(InfoLogLevel::ERROR_LEVEL, options.info_log, + "Error when reading %s dir\n", options.wal_dir.c_str()); return; } @@ -118,7 +125,8 @@ void DumpDBFileSummary(const DBOptions& options, const std::string& dbname) { } } } - Log(options.info_log, "Write Ahead Log file in %s: %s\n", + Log(InfoLogLevel::INFO_LEVEL, options.info_log, + "Write Ahead Log file in %s: %s\n", options.wal_dir.c_str(), wal_info.c_str()); } } // namespace rocksdb