diff options
Diffstat (limited to 'absl/log')
-rw-r--r-- | absl/log/BUILD.bazel | 46 | ||||
-rw-r--r-- | absl/log/CMakeLists.txt | 4 | ||||
-rw-r--r-- | absl/log/flags.cc | 2 | ||||
-rw-r--r-- | absl/log/internal/BUILD.bazel | 41 | ||||
-rw-r--r-- | absl/log/internal/vlog_config.cc (renamed from absl/log/vlog_config.cc) | 5 | ||||
-rw-r--r-- | absl/log/internal/vlog_config.h (renamed from absl/log/vlog_config.h) | 13 | ||||
-rw-r--r-- | absl/log/internal/vlog_config_benchmark.cc (renamed from absl/log/vlog_config_benchmark.cc) | 2 | ||||
-rw-r--r-- | absl/log/vlog_is_on.h | 16 |
8 files changed, 64 insertions, 65 deletions
diff --git a/absl/log/BUILD.bazel b/absl/log/BUILD.bazel index 0e9078a4..8d734dbb 100644 --- a/absl/log/BUILD.bazel +++ b/absl/log/BUILD.bazel @@ -92,7 +92,6 @@ cc_library( visibility = ["//visibility:public"], deps = [ ":globals", - ":vlog_config", "//absl/base:config", "//absl/base:core_headers", "//absl/base:log_severity", @@ -100,6 +99,7 @@ cc_library( "//absl/flags:marshalling", "//absl/log/internal:config", "//absl/log/internal:flags", + "//absl/log/internal:vlog_config", "//absl/strings", ], # Binaries which do not access these flags from C++ still want this library linked in. @@ -239,25 +239,6 @@ cc_library( ) cc_library( - name = "vlog_config", - srcs = ["vlog_config.cc"], - hdrs = ["vlog_config.h"], - copts = ABSL_DEFAULT_COPTS, - linkopts = ABSL_DEFAULT_LINKOPTS, - visibility = ["//visibility:private"], - deps = [ - "//absl/base", - "//absl/base:config", - "//absl/base:core_headers", - "//absl/log/internal:fnmatch", - "//absl/memory", - "//absl/strings", - "//absl/synchronization", - "//absl/types:optional", - ], -) - -cc_library( name = "vlog_is_on", hdrs = ["vlog_is_on.h"], copts = ABSL_DEFAULT_COPTS, @@ -266,9 +247,9 @@ cc_library( "//absl/log:__subpackages__", ], deps = [ - ":vlog_config", "//absl/base:config", "//absl/base:core_headers", + "//absl/log/internal:vlog_config", "//absl/strings", ], ) @@ -295,29 +276,6 @@ cc_test( ], ) -cc_test( - name = "vlog_config_benchmark", - size = "medium", - srcs = ["vlog_config_benchmark.cc"], - copts = ABSL_TEST_COPTS, - linkopts = ABSL_DEFAULT_LINKOPTS, - tags = [ - "benchmark", - "no_test_loonix", - "notsan", - ], - deps = [ - ":vlog_config", - "//absl/base:config", - "//absl/base:core_headers", - "//absl/container:layout", - "//absl/memory", - "//absl/random:distributions", - "//absl/strings", - "@com_github_google_benchmark//:benchmark_main", - ], -) - # Test targets cc_test( diff --git a/absl/log/CMakeLists.txt b/absl/log/CMakeLists.txt index c4ac59a4..da855667 100644 --- a/absl/log/CMakeLists.txt +++ b/absl/log/CMakeLists.txt @@ -680,9 +680,9 @@ absl_cc_library( NAME vlog_config_internal SRCS - "vlog_config.cc" + "internal/vlog_config.cc" HDRS - "vlog_config.h" + "internal/vlog_config.h" COPTS ${ABSL_DEFAULT_COPTS} LINKOPTS diff --git a/absl/log/flags.cc b/absl/log/flags.cc index dfb0d8e6..287b3e96 100644 --- a/absl/log/flags.cc +++ b/absl/log/flags.cc @@ -28,7 +28,7 @@ #include "absl/flags/marshalling.h" #include "absl/log/globals.h" #include "absl/log/internal/config.h" -#include "absl/log/vlog_config.h" +#include "absl/log/internal/vlog_config.h" #include "absl/strings/numbers.h" #include "absl/strings/string_view.h" diff --git a/absl/log/internal/BUILD.bazel b/absl/log/internal/BUILD.bazel index 90643a5e..0525ac1d 100644 --- a/absl/log/internal/BUILD.bazel +++ b/absl/log/internal/BUILD.bazel @@ -378,6 +378,47 @@ cc_library( ], ) +cc_library( + name = "vlog_config", + srcs = ["vlog_config.cc"], + hdrs = ["vlog_config.h"], + copts = ABSL_DEFAULT_COPTS, + linkopts = ABSL_DEFAULT_LINKOPTS, + visibility = ["//absl/log:__subpackages__"], + deps = [ + "//absl/base", + "//absl/base:config", + "//absl/base:core_headers", + "//absl/log/internal:fnmatch", + "//absl/memory", + "//absl/strings", + "//absl/synchronization", + "//absl/types:optional", + ], +) + +cc_binary( + name = "vlog_config_benchmark", + testonly = 1, + srcs = ["vlog_config_benchmark.cc"], + copts = ABSL_TEST_COPTS, + linkopts = ABSL_DEFAULT_LINKOPTS, + tags = [ + "benchmark", + ], + visibility = ["//visibility:private"], + deps = [ + ":vlog_config", + "//absl/base:config", + "//absl/base:core_headers", + "//absl/container:layout", + "//absl/memory", + "//absl/random:distributions", + "//absl/strings", + "@com_github_google_benchmark//:benchmark_main", + ], +) + # Test targets cc_test( name = "stderr_log_sink_test", diff --git a/absl/log/vlog_config.cc b/absl/log/internal/vlog_config.cc index 7375b279..5270e0d1 100644 --- a/absl/log/vlog_config.cc +++ b/absl/log/internal/vlog_config.cc @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include "absl/log/vlog_config.h" +#include "absl/log/internal/vlog_config.h" #include <stddef.h> @@ -42,6 +42,7 @@ namespace absl { ABSL_NAMESPACE_BEGIN namespace log_internal { + namespace { bool ModuleIsPath(absl::string_view module_pattern) { #ifdef _WIN32 @@ -51,7 +52,6 @@ bool ModuleIsPath(absl::string_view module_pattern) { #endif } } // namespace -} // namespace log_internal bool VLogSite::SlowIsEnabled(int stale_v, int level) { if (ABSL_PREDICT_TRUE(stale_v != kUninitialized)) { @@ -71,7 +71,6 @@ bool VLogSite::SlowIsEnabled3(int stale_v) { return SlowIsEnabled(stale_v, 3); } bool VLogSite::SlowIsEnabled4(int stale_v) { return SlowIsEnabled(stale_v, 4); } bool VLogSite::SlowIsEnabled5(int stale_v) { return SlowIsEnabled(stale_v, 5); } -namespace log_internal { namespace { struct VModuleInfo final { std::string module_pattern; diff --git a/absl/log/vlog_config.h b/absl/log/internal/vlog_config.h index 9ff56265..b6e322c4 100644 --- a/absl/log/vlog_config.h +++ b/absl/log/internal/vlog_config.h @@ -21,8 +21,8 @@ // It also declares and defines multiple internal utilities used to implement // `VLOG`, such as `VLogSiteManager`. -#ifndef ABSL_LOG_VLOG_CONFIG_H_ -#define ABSL_LOG_VLOG_CONFIG_H_ +#ifndef ABSL_LOG_INTERNAL_VLOG_CONFIG_H_ +#define ABSL_LOG_INTERNAL_VLOG_CONFIG_H_ // IWYU pragma: private, include "absl/log/log.h" @@ -40,13 +40,14 @@ namespace absl { ABSL_NAMESPACE_BEGIN -class VLogSite; namespace log_internal { + class SyntheticBinary; +class VLogSite; + int RegisterAndInitialize(VLogSite* v); void UpdateVLogSites(); constexpr int kUseFlag = (std::numeric_limits<int16_t>::min)(); -} // namespace log_internal // Represents a unique callsite for a `VLOG()` or `VLOG_IS_ON()` call. // @@ -122,7 +123,6 @@ class VLogSite final { static_assert(std::is_trivially_destructible<VLogSite>::value, "VLogSite must be trivially destructible"); -namespace log_internal { // Returns the current verbose log level of `file`. // Does not allocate memory. int VLogLevel(absl::string_view file); @@ -155,8 +155,9 @@ void OnVLogVerbosityUpdate(std::function<void()> cb); // Does not allocate memory. VLogSite* SetVModuleListHeadForTestOnly(VLogSite* v); + } // namespace log_internal ABSL_NAMESPACE_END } // namespace absl -#endif // ABSL_LOG_VLOG_CONFIG_H_ +#endif // ABSL_LOG_INTERNAL_VLOG_CONFIG_H_ diff --git a/absl/log/vlog_config_benchmark.cc b/absl/log/internal/vlog_config_benchmark.cc index 78994b76..9004e2ee 100644 --- a/absl/log/vlog_config_benchmark.cc +++ b/absl/log/internal/vlog_config_benchmark.cc @@ -26,7 +26,7 @@ #include "absl/base/config.h" #include "absl/container/internal/layout.h" -#include "absl/log/vlog_config.h" +#include "absl/log/internal/vlog_config.h" #include "absl/memory/memory.h" #include "absl/random/distributions.h" #include "absl/strings/str_cat.h" diff --git a/absl/log/vlog_is_on.h b/absl/log/vlog_is_on.h index 6e5abf56..4c929c30 100644 --- a/absl/log/vlog_is_on.h +++ b/absl/log/vlog_is_on.h @@ -58,7 +58,7 @@ #include "absl/base/attributes.h" #include "absl/base/config.h" -#include "absl/log/vlog_config.h" // IWYU pragma: export +#include "absl/log/internal/vlog_config.h" // IWYU pragma: export #include "absl/strings/string_view.h" // IWYU pragma: private, include "absl/log/log.h" @@ -81,13 +81,13 @@ // // VLOG_IS_ON is not async signal safe, but it is guaranteed not to allocate // new memory. -#define VLOG_IS_ON(verbose_level) \ - (ABSL_LOG_INTERNAL_MAX_LOG_VERBOSITY_CHECK(verbose_level)[]() \ - ->::absl::VLogSite * \ - { \ - ABSL_CONST_INIT static ::absl::VLogSite site(__FILE__); \ - return &site; \ - }() \ +#define VLOG_IS_ON(verbose_level) \ + (ABSL_LOG_INTERNAL_MAX_LOG_VERBOSITY_CHECK(verbose_level)[]() \ + ->::absl::log_internal::VLogSite * \ + { \ + ABSL_CONST_INIT static ::absl::log_internal::VLogSite site(__FILE__); \ + return &site; \ + }() \ ->IsEnabled(verbose_level)) namespace absl { |