summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgitbw95 <95719937+gitbw95@users.noreply.github.com>2022-08-29 21:09:36 -0700
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>2022-08-29 21:09:36 -0700
commit6cd8133035fe06be4f629b69cfd0048e07709a84 (patch)
tree4966453f67cee785eb7f5c5308db77ff1bbb83f8
parent7c0838e65e7db1dd10b7a8411553c04f2d89fa61 (diff)
Fix an import issue in fbcode. (#10604)
Summary: This should fix an import issue detected in meta internal tests. Pull Request resolved: https://github.com/facebook/rocksdb/pull/10604 Test Plan: Unit Tests. Reviewed By: hx235 Differential Revision: D39120414 Pulled By: gitbw95 fbshipit-source-id: dbd016d7f47b9f54aab5ea61e8d3cd79734f46af
-rw-r--r--CMakeLists.txt1
-rw-r--r--TARGETS2
-rw-r--r--src.mk1
-rw-r--r--util/stderr_logger.cc30
-rw-r--r--util/stderr_logger.h23
5 files changed, 39 insertions, 18 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e9e506951..1584ea1a8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -828,6 +828,7 @@ set(SOURCES
util/slice.cc
util/file_checksum_helper.cc
util/status.cc
+ util/stderr_logger.cc
util/string_util.cc
util/thread_local.cc
util/threadpool_imp.cc
diff --git a/TARGETS b/TARGETS
index 71f32bc01..18f569288 100644
--- a/TARGETS
+++ b/TARGETS
@@ -253,6 +253,7 @@ cpp_library_wrapper(name="rocksdb_lib", srcs=[
"util/ribbon_config.cc",
"util/slice.cc",
"util/status.cc",
+ "util/stderr_logger.cc",
"util/string_util.cc",
"util/thread_local.cc",
"util/threadpool_imp.cc",
@@ -591,6 +592,7 @@ cpp_library_wrapper(name="rocksdb_whole_archive_lib", srcs=[
"util/ribbon_config.cc",
"util/slice.cc",
"util/status.cc",
+ "util/stderr_logger.cc",
"util/string_util.cc",
"util/thread_local.cc",
"util/threadpool_imp.cc",
diff --git a/src.mk b/src.mk
index a39f9a7f4..b94bc43ca 100644
--- a/src.mk
+++ b/src.mk
@@ -240,6 +240,7 @@ LIB_SOURCES = \
util/slice.cc \
util/file_checksum_helper.cc \
util/status.cc \
+ util/stderr_logger.cc \
util/string_util.cc \
util/thread_local.cc \
util/threadpool_imp.cc \
diff --git a/util/stderr_logger.cc b/util/stderr_logger.cc
new file mode 100644
index 000000000..6044b8b93
--- /dev/null
+++ b/util/stderr_logger.cc
@@ -0,0 +1,30 @@
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+//
+// This source code is licensed under both the GPLv2 (found in the
+// COPYING file in the root directory) and Apache 2.0 License
+// (found in the LICENSE.Apache file in the root directory).
+
+#include "util/stderr_logger.h"
+
+#include "port/sys_time.h"
+
+namespace ROCKSDB_NAMESPACE {
+StderrLogger::~StderrLogger() {}
+
+void StderrLogger::Logv(const char* format, va_list ap) {
+ const uint64_t thread_id = Env::Default()->GetThreadID();
+
+ port::TimeVal now_tv;
+ port::GetTimeOfDay(&now_tv, nullptr);
+ const time_t seconds = now_tv.tv_sec;
+ struct tm t;
+ port::LocalTimeR(&seconds, &t);
+ fprintf(stderr, "%04d/%02d/%02d-%02d:%02d:%02d.%06d %llx ", t.tm_year + 1900,
+ t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min, t.tm_sec,
+ static_cast<int>(now_tv.tv_usec),
+ static_cast<long long unsigned int>(thread_id));
+
+ vfprintf(stderr, format, ap);
+ fprintf(stderr, "\n");
+}
+} // namespace ROCKSDB_NAMESPACE
diff --git a/util/stderr_logger.h b/util/stderr_logger.h
index 97bd62561..c3b01210c 100644
--- a/util/stderr_logger.h
+++ b/util/stderr_logger.h
@@ -1,4 +1,5 @@
-// Copyright (c) 2016-present, Facebook, Inc. All rights reserved.
+// Copyright (c) Meta Platforms, Inc. and affiliates.
+//
// This source code is licensed under both the GPLv2 (found in the
// COPYING file in the root directory) and Apache 2.0 License
// (found in the LICENSE.Apache file in the root directory).
@@ -8,7 +9,6 @@
#include <stdarg.h>
#include <stdio.h>
-#include "port/sys_time.h"
#include "rocksdb/env.h"
namespace ROCKSDB_NAMESPACE {
@@ -19,26 +19,13 @@ class StderrLogger : public Logger {
explicit StderrLogger(const InfoLogLevel log_level = InfoLogLevel::INFO_LEVEL)
: Logger(log_level) {}
+ ~StderrLogger() override;
+
// Brings overloaded Logv()s into scope so they're not hidden when we override
// a subset of them.
using Logger::Logv;
- virtual void Logv(const char* format, va_list ap) override {
- const uint64_t thread_id = Env::Default()->GetThreadID();
-
- port::TimeVal now_tv;
- port::GetTimeOfDay(&now_tv, nullptr);
- const time_t seconds = now_tv.tv_sec;
- struct tm t;
- port::LocalTimeR(&seconds, &t);
- fprintf(stderr, "%04d/%02d/%02d-%02d:%02d:%02d.%06d %llx ",
- t.tm_year + 1900, t.tm_mon + 1, t.tm_mday, t.tm_hour, t.tm_min,
- t.tm_sec, static_cast<int>(now_tv.tv_usec),
- static_cast<long long unsigned int>(thread_id));
-
- vfprintf(stderr, format, ap);
- fprintf(stderr, "\n");
- }
+ virtual void Logv(const char* format, va_list ap) override;
};
} // namespace ROCKSDB_NAMESPACE