summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--absl/container/BUILD.bazel9
-rw-r--r--absl/container/CMakeLists.txt21
-rw-r--r--absl/container/flat_hash_map_test.cc8
-rw-r--r--absl/container/flat_hash_set_test.cc6
-rw-r--r--absl/container/inlined_vector_test.cc6
-rw-r--r--absl/container/internal/layout_test.cc36
-rw-r--r--absl/container/internal/raw_hash_set_test.cc5
-rw-r--r--absl/debugging/BUILD.bazel12
-rw-r--r--absl/debugging/CMakeLists.txt13
-rw-r--r--absl/debugging/failure_signal_handler_test.cc5
-rw-r--r--absl/debugging/internal/demangle_test.cc4
-rw-r--r--absl/debugging/internal/stack_consumption_test.cc4
-rw-r--r--absl/debugging/leak_check_fail_test.cc8
-rw-r--r--absl/debugging/leak_check_test.cc6
-rw-r--r--absl/debugging/symbolize_test.cc39
-rw-r--r--absl/flags/BUILD.bazel2
-rw-r--r--absl/flags/CMakeLists.txt2
-rw-r--r--absl/flags/parse_test.cc5
-rw-r--r--absl/log/BUILD.bazel1
-rw-r--r--absl/log/CMakeLists.txt1
-rw-r--r--absl/log/log_sink_test.cc3
-rw-r--r--absl/random/BUILD.bazel18
-rw-r--r--absl/random/CMakeLists.txt23
-rw-r--r--absl/random/beta_distribution_test.cc39
-rw-r--r--absl/random/discrete_distribution_test.cc4
-rw-r--r--absl/random/exponential_distribution_test.cc44
-rw-r--r--absl/random/gaussian_distribution_test.cc44
-rw-r--r--absl/random/internal/BUILD.bazel8
-rw-r--r--absl/random/internal/nanobenchmark_test.cc20
-rw-r--r--absl/random/internal/randen_engine_test.cc7
-rw-r--r--absl/random/internal/randen_hwaes_test.cc26
-rw-r--r--absl/random/log_uniform_int_distribution_test.cc19
-rw-r--r--absl/random/poisson_distribution_test.cc45
-rw-r--r--absl/random/uniform_int_distribution_test.cc7
-rw-r--r--absl/random/uniform_real_distribution_test.cc9
-rw-r--r--absl/random/zipf_distribution_test.cc22
-rw-r--r--absl/strings/BUILD.bazel7
-rw-r--r--absl/strings/CMakeLists.txt18
-rw-r--r--absl/strings/cord_test.cc21
-rw-r--r--absl/strings/internal/charconv_parse_test.cc10
-rw-r--r--absl/strings/internal/str_format/convert_test.cc3
-rw-r--r--absl/strings/numbers_test.cc45
-rw-r--r--absl/synchronization/BUILD.bazel8
-rw-r--r--absl/synchronization/CMakeLists.txt10
-rw-r--r--absl/synchronization/internal/graphcycles_test.cc41
-rw-r--r--absl/synchronization/lifetime_test.cc18
-rw-r--r--absl/synchronization/mutex_test.cc122
-rw-r--r--absl/types/BUILD.bazel4
-rw-r--r--absl/types/CMakeLists.txt4
-rw-r--r--absl/types/any_test.cc4
-rw-r--r--absl/types/optional_test.cc5
51 files changed, 409 insertions, 442 deletions
diff --git a/absl/container/BUILD.bazel b/absl/container/BUILD.bazel
index 902f6ed3..f22da59a 100644
--- a/absl/container/BUILD.bazel
+++ b/absl/container/BUILD.bazel
@@ -160,8 +160,8 @@ cc_test(
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:exception_testing",
- "//absl/base:raw_logging_internal",
"//absl/hash:hash_testing",
+ "//absl/log:check",
"//absl/memory",
"//absl/strings",
"@com_google_googletest//:gtest_main",
@@ -255,7 +255,7 @@ cc_test(
":unordered_map_lookup_test",
":unordered_map_members_test",
":unordered_map_modifiers_test",
- "//absl/base:raw_logging_internal",
+ "//absl/log:check",
"//absl/types:any",
"@com_google_googletest//:gtest_main",
],
@@ -289,7 +289,7 @@ cc_test(
":unordered_set_lookup_test",
":unordered_set_members_test",
":unordered_set_modifiers_test",
- "//absl/base:raw_logging_internal",
+ "//absl/log:check",
"//absl/memory",
"//absl/strings",
"@com_google_googletest//:gtest_main",
@@ -656,7 +656,6 @@ cc_test(
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:prefetch",
- "//absl/base:raw_logging_internal",
"//absl/log",
"//absl/strings",
"@com_google_googletest//:gtest_main",
@@ -743,7 +742,7 @@ cc_test(
":layout",
"//absl/base:config",
"//absl/base:core_headers",
- "//absl/base:raw_logging_internal",
+ "//absl/log:check",
"//absl/types:span",
"@com_google_googletest//:gtest_main",
],
diff --git a/absl/container/CMakeLists.txt b/absl/container/CMakeLists.txt
index 3c48270b..39d95e02 100644
--- a/absl/container/CMakeLists.txt
+++ b/absl/container/CMakeLists.txt
@@ -221,16 +221,16 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
- absl::counting_allocator
- absl::inlined_vector
- absl::test_instance_tracker
+ absl::check
absl::config
absl::core_headers
+ absl::counting_allocator
absl::exception_testing
absl::hash_testing
+ absl::inlined_vector
absl::memory
- absl::raw_logging_internal
absl::strings
+ absl::test_instance_tracker
GTest::gmock_main
)
@@ -300,14 +300,14 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
+ absl::any
+ absl::check
absl::flat_hash_map
absl::hash_generator_testing
absl::unordered_map_constructor_test
absl::unordered_map_lookup_test
absl::unordered_map_members_test
absl::unordered_map_modifiers_test
- absl::any
- absl::raw_logging_internal
GTest::gmock_main
)
@@ -337,15 +337,15 @@ absl_cc_test(
${ABSL_TEST_COPTS}
"-DUNORDERED_SET_CXX17"
DEPS
+ absl::check
absl::flat_hash_set
absl::hash_generator_testing
+ absl::memory
+ absl::strings
absl::unordered_set_constructor_test
absl::unordered_set_lookup_test
absl::unordered_set_members_test
absl::unordered_set_modifiers_test
- absl::memory
- absl::raw_logging_internal
- absl::strings
GTest::gmock_main
)
@@ -742,7 +742,6 @@ absl_cc_test(
absl::log
absl::prefetch
absl::raw_hash_set
- absl::raw_logging_internal
absl::strings
GTest::gmock_main
)
@@ -788,9 +787,9 @@ absl_cc_test(
${ABSL_TEST_COPTS}
DEPS
absl::layout
+ absl::check
absl::config
absl::core_headers
- absl::raw_logging_internal
absl::span
GTest::gmock_main
)
diff --git a/absl/container/flat_hash_map_test.cc b/absl/container/flat_hash_map_test.cc
index 03171f6d..e6acbea2 100644
--- a/absl/container/flat_hash_map_test.cc
+++ b/absl/container/flat_hash_map_test.cc
@@ -16,12 +16,12 @@
#include <memory>
-#include "absl/base/internal/raw_logging.h"
#include "absl/container/internal/hash_generator_testing.h"
#include "absl/container/internal/unordered_map_constructor_test.h"
#include "absl/container/internal/unordered_map_lookup_test.h"
#include "absl/container/internal/unordered_map_members_test.h"
#include "absl/container/internal/unordered_map_modifiers_test.h"
+#include "absl/log/check.h"
#include "absl/types/any.h"
namespace absl {
@@ -40,10 +40,10 @@ struct BeforeMain {
BeforeMain() {
absl::flat_hash_map<int, int> x;
x.insert({1, 1});
- ABSL_RAW_CHECK(x.find(0) == x.end(), "x should not contain 0");
+ CHECK(x.find(0) == x.end()) << "x should not contain 0";
auto it = x.find(1);
- ABSL_RAW_CHECK(it != x.end(), "x should contain 1");
- ABSL_RAW_CHECK(it->second, "1 should map to 1");
+ CHECK(it != x.end()) << "x should contain 1";
+ CHECK(it->second) << "1 should map to 1";
}
};
const BeforeMain before_main;
diff --git a/absl/container/flat_hash_set_test.cc b/absl/container/flat_hash_set_test.cc
index b6a72a20..20130f91 100644
--- a/absl/container/flat_hash_set_test.cc
+++ b/absl/container/flat_hash_set_test.cc
@@ -16,12 +16,12 @@
#include <vector>
-#include "absl/base/internal/raw_logging.h"
#include "absl/container/internal/hash_generator_testing.h"
#include "absl/container/internal/unordered_set_constructor_test.h"
#include "absl/container/internal/unordered_set_lookup_test.h"
#include "absl/container/internal/unordered_set_members_test.h"
#include "absl/container/internal/unordered_set_modifiers_test.h"
+#include "absl/log/check.h"
#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
@@ -42,8 +42,8 @@ struct BeforeMain {
BeforeMain() {
absl::flat_hash_set<int> x;
x.insert(1);
- ABSL_RAW_CHECK(!x.contains(0), "x should not contain 0");
- ABSL_RAW_CHECK(x.contains(1), "x should contain 1");
+ CHECK(!x.contains(0)) << "x should not contain 0";
+ CHECK(x.contains(1)) << "x should contain 1";
}
};
const BeforeMain before_main;
diff --git a/absl/container/inlined_vector_test.cc b/absl/container/inlined_vector_test.cc
index 808f97cc..6f4625dc 100644
--- a/absl/container/inlined_vector_test.cc
+++ b/absl/container/inlined_vector_test.cc
@@ -31,12 +31,12 @@
#include "gtest/gtest.h"
#include "absl/base/attributes.h"
#include "absl/base/internal/exception_testing.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
#include "absl/base/options.h"
#include "absl/container/internal/counting_allocator.h"
#include "absl/container/internal/test_instance_tracker.h"
#include "absl/hash/hash_testing.h"
+#include "absl/log/check.h"
#include "absl/memory/memory.h"
#include "absl/strings/str_cat.h"
@@ -103,13 +103,13 @@ class RefCounted {
}
void Ref() const {
- ABSL_RAW_CHECK(count_ != nullptr, "");
+ CHECK_NE(count_, nullptr);
++(*count_);
}
void Unref() const {
--(*count_);
- ABSL_RAW_CHECK(*count_ >= 0, "");
+ CHECK_GE(*count_, 0);
}
int value_;
diff --git a/absl/container/internal/layout_test.cc b/absl/container/internal/layout_test.cc
index 54e5d5bb..ce599ce7 100644
--- a/absl/container/internal/layout_test.cc
+++ b/absl/container/internal/layout_test.cc
@@ -26,7 +26,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/config.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/check.h"
#include "absl/types/span.h"
namespace absl {
@@ -38,7 +38,7 @@ using ::absl::Span;
using ::testing::ElementsAre;
size_t Distance(const void* from, const void* to) {
- ABSL_RAW_CHECK(from <= to, "Distance must be non-negative");
+ CHECK_LE(from, to) << "Distance must be non-negative";
return static_cast<const char*>(to) - static_cast<const char*>(from);
}
@@ -366,7 +366,7 @@ TEST(Layout, Sizes) {
}
TEST(Layout, PointerByIndex) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, Distance(p, Type<const int32_t*>(L::Partial().Pointer<0>(p))));
@@ -447,7 +447,7 @@ TEST(Layout, PointerByIndex) {
}
TEST(Layout, PointerByType) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
@@ -526,7 +526,7 @@ TEST(Layout, PointerByType) {
}
TEST(Layout, MutablePointerByIndex) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, Distance(p, Type<int32_t*>(L::Partial().Pointer<0>(p))));
@@ -581,7 +581,7 @@ TEST(Layout, MutablePointerByIndex) {
}
TEST(Layout, MutablePointerByType) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, Distance(p, Type<int32_t*>(L::Partial().Pointer<int32_t>(p))));
@@ -647,7 +647,7 @@ TEST(Layout, MutablePointerByType) {
}
TEST(Layout, Pointers) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
@@ -683,7 +683,7 @@ TEST(Layout, Pointers) {
}
TEST(Layout, MutablePointers) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
@@ -716,7 +716,7 @@ TEST(Layout, MutablePointers) {
}
TEST(Layout, SliceByIndexSize) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<0>(p).size());
@@ -744,7 +744,7 @@ TEST(Layout, SliceByIndexSize) {
}
TEST(Layout, SliceByTypeSize) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<int32_t>(p).size());
@@ -766,7 +766,7 @@ TEST(Layout, SliceByTypeSize) {
}
TEST(Layout, MutableSliceByIndexSize) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<0>(p).size());
@@ -794,7 +794,7 @@ TEST(Layout, MutableSliceByIndexSize) {
}
TEST(Layout, MutableSliceByTypeSize) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(0, L::Partial(0).Slice<int32_t>(p).size());
@@ -816,7 +816,7 @@ TEST(Layout, MutableSliceByTypeSize) {
}
TEST(Layout, SliceByIndexData) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
@@ -939,7 +939,7 @@ TEST(Layout, SliceByIndexData) {
}
TEST(Layout, SliceByTypeData) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
@@ -1037,7 +1037,7 @@ TEST(Layout, SliceByTypeData) {
}
TEST(Layout, MutableSliceByIndexData) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
@@ -1122,7 +1122,7 @@ TEST(Layout, MutableSliceByIndexData) {
}
TEST(Layout, MutableSliceByTypeData) {
- alignas(max_align_t) unsigned char p[100];
+ alignas(max_align_t) unsigned char p[100] = {0};
{
using L = Layout<int32_t>;
EXPECT_EQ(
@@ -1268,7 +1268,7 @@ testing::PolymorphicMatcher<TupleMatcher<M...>> Tuple(M... matchers) {
}
TEST(Layout, Slices) {
- alignas(max_align_t) const unsigned char p[100] = {};
+ alignas(max_align_t) const unsigned char p[100] = {0};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
@@ -1302,7 +1302,7 @@ TEST(Layout, Slices) {
}
TEST(Layout, MutableSlices) {
- alignas(max_align_t) unsigned char p[100] = {};
+ alignas(max_align_t) unsigned char p[100] = {0};
using L = Layout<int8_t, int8_t, Int128>;
{
const auto x = L::Partial();
diff --git a/absl/container/internal/raw_hash_set_test.cc b/absl/container/internal/raw_hash_set_test.cc
index c46a5939..ce1070ba 100644
--- a/absl/container/internal/raw_hash_set_test.cc
+++ b/absl/container/internal/raw_hash_set_test.cc
@@ -40,7 +40,6 @@
#include "absl/base/attributes.h"
#include "absl/base/config.h"
#include "absl/base/internal/cycleclock.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/prefetch.h"
#include "absl/container/flat_hash_map.h"
#include "absl/container/flat_hash_set.h"
@@ -1280,7 +1279,7 @@ ExpectedStats XorSeedExpectedStats() {
{{0.95, 0}, {0.99, 1}, {0.999, 4}, {0.9999, 10}}};
}
}
- ABSL_RAW_LOG(FATAL, "%s", "Unknown Group width");
+ LOG(FATAL) << "Unknown Group width";
return {};
}
@@ -1376,7 +1375,7 @@ ExpectedStats LinearTransformExpectedStats() {
{{0.95, 0}, {0.99, 1}, {0.999, 6}, {0.9999, 10}}};
}
}
- ABSL_RAW_LOG(FATAL, "%s", "Unknown Group width");
+ LOG(FATAL) << "Unknown Group width";
return {};
}
diff --git a/absl/debugging/BUILD.bazel b/absl/debugging/BUILD.bazel
index e89dbae8..42124bfb 100644
--- a/absl/debugging/BUILD.bazel
+++ b/absl/debugging/BUILD.bazel
@@ -122,7 +122,8 @@ cc_test(
"//absl/base",
"//absl/base:config",
"//absl/base:core_headers",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
+ "//absl/log:check",
"//absl/memory",
"//absl/strings",
"@com_google_googletest//:gtest",
@@ -180,6 +181,7 @@ cc_test(
":stacktrace",
":symbolize",
"//absl/base:raw_logging_internal",
+ "//absl/log:check",
"//absl/strings",
"@com_google_googletest//:gtest",
],
@@ -233,7 +235,7 @@ cc_test(
":stack_consumption",
"//absl/base:config",
"//absl/base:core_headers",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/memory",
"@com_google_googletest//:gtest_main",
],
@@ -260,7 +262,7 @@ cc_test(
deps = [
":leak_check",
"//absl/base:config",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"@com_google_googletest//:gtest_main",
],
)
@@ -277,7 +279,7 @@ cc_binary(
linkopts = ABSL_DEFAULT_LINKOPTS,
deps = [
":leak_check",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"@com_google_googletest//:gtest_main",
],
)
@@ -306,7 +308,7 @@ cc_test(
deps = [
":stack_consumption",
"//absl/base:core_headers",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"@com_google_googletest//:gtest_main",
],
)
diff --git a/absl/debugging/CMakeLists.txt b/absl/debugging/CMakeLists.txt
index ef6b4965..65e2af88 100644
--- a/absl/debugging/CMakeLists.txt
+++ b/absl/debugging/CMakeLists.txt
@@ -101,14 +101,15 @@ absl_cc_test(
LINKOPTS
$<$<BOOL:${MSVC}>:-DEBUG>
DEPS
- absl::stack_consumption
- absl::symbolize
absl::base
+ absl::check
absl::config
absl::core_headers
+ absl::log
absl::memory
- absl::raw_logging_internal
+ absl::stack_consumption
absl::strings
+ absl::symbolize
GTest::gmock
)
@@ -157,6 +158,7 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
+ absl::check
absl::failure_signal_handler
absl::stacktrace
absl::symbolize
@@ -216,8 +218,8 @@ absl_cc_test(
absl::stack_consumption
absl::config
absl::core_headers
+ absl::log
absl::memory
- absl::raw_logging_internal
GTest::gmock_main
)
@@ -248,6 +250,7 @@ absl_cc_test(
DEPS
absl::leak_check
absl::base
+ absl::log
GTest::gmock_main
)
@@ -278,7 +281,7 @@ absl_cc_test(
DEPS
absl::stack_consumption
absl::core_headers
- absl::raw_logging_internal
+ absl::log
GTest::gmock_main
)
diff --git a/absl/debugging/failure_signal_handler_test.cc b/absl/debugging/failure_signal_handler_test.cc
index 6a62428b..72816a3e 100644
--- a/absl/debugging/failure_signal_handler_test.cc
+++ b/absl/debugging/failure_signal_handler_test.cc
@@ -22,11 +22,12 @@
#include <cstring>
#include <fstream>
-#include "gtest/gtest.h"
#include "gmock/gmock.h"
+#include "gtest/gtest.h"
#include "absl/base/internal/raw_logging.h"
#include "absl/debugging/stacktrace.h"
#include "absl/debugging/symbolize.h"
+#include "absl/log/check.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
@@ -87,7 +88,7 @@ std::string GetTmpDir() {
// This function runs in a fork()ed process on most systems.
void InstallHandlerWithWriteToFileAndRaise(const char* file, int signo) {
error_file = fopen(file, "w");
- ABSL_RAW_CHECK(error_file != nullptr, "Failed create error_file");
+ CHECK_NE(error_file, nullptr) << "Failed create error_file";
absl::FailureSignalHandlerOptions options;
options.writerfn = WriteToErrorFile;
absl::InstallFailureSignalHandler(options);
diff --git a/absl/debugging/internal/demangle_test.cc b/absl/debugging/internal/demangle_test.cc
index 2fa4143a..faec72b5 100644
--- a/absl/debugging/internal/demangle_test.cc
+++ b/absl/debugging/internal/demangle_test.cc
@@ -19,8 +19,8 @@
#include "gtest/gtest.h"
#include "absl/base/config.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/debugging/internal/stack_consumption.h"
+#include "absl/log/log.h"
#include "absl/memory/memory.h"
namespace absl {
@@ -151,7 +151,7 @@ static const char *DemangleStackConsumption(const char *mangled,
int *stack_consumed) {
g_mangled = mangled;
*stack_consumed = GetSignalHandlerStackConsumption(DemangleSignalHandler);
- ABSL_RAW_LOG(INFO, "Stack consumption of Demangle: %d", *stack_consumed);
+ LOG(INFO) << "Stack consumption of Demangle: " << *stack_consumed;
return g_demangle_result;
}
diff --git a/absl/debugging/internal/stack_consumption_test.cc b/absl/debugging/internal/stack_consumption_test.cc
index 80445bf4..0255ac8f 100644
--- a/absl/debugging/internal/stack_consumption_test.cc
+++ b/absl/debugging/internal/stack_consumption_test.cc
@@ -20,7 +20,7 @@
#include <string.h>
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/log.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
@@ -33,7 +33,7 @@ static void SimpleSignalHandler(int signo) {
// Never true, but prevents compiler from optimizing buf out.
if (signo == 0) {
- ABSL_RAW_LOG(INFO, "%p", static_cast<void*>(buf));
+ LOG(INFO) << static_cast<void*>(buf);
}
}
diff --git a/absl/debugging/leak_check_fail_test.cc b/absl/debugging/leak_check_fail_test.cc
index c49b81a9..46e9fb62 100644
--- a/absl/debugging/leak_check_fail_test.cc
+++ b/absl/debugging/leak_check_fail_test.cc
@@ -13,9 +13,10 @@
// limitations under the License.
#include <memory>
+
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/debugging/leak_check.h"
+#include "absl/log/log.h"
namespace {
@@ -25,7 +26,7 @@ TEST(LeakCheckTest, LeakMemory) {
// failed exit code.
char* foo = strdup("lsan should complain about this leaked string");
- ABSL_RAW_LOG(INFO, "Should detect leaked string %s", foo);
+ LOG(INFO) << "Should detect leaked string " << foo;
}
TEST(LeakCheckTest, LeakMemoryAfterDisablerScope) {
@@ -34,8 +35,7 @@ TEST(LeakCheckTest, LeakMemoryAfterDisablerScope) {
// failed exit code.
{ absl::LeakCheckDisabler disabler; }
char* foo = strdup("lsan should also complain about this leaked string");
- ABSL_RAW_LOG(INFO, "Re-enabled leak detection.Should detect leaked string %s",
- foo);
+ LOG(INFO) << "Re-enabled leak detection.Should detect leaked string " << foo;
}
} // namespace
diff --git a/absl/debugging/leak_check_test.cc b/absl/debugging/leak_check_test.cc
index 6a42e31b..6f0135ed 100644
--- a/absl/debugging/leak_check_test.cc
+++ b/absl/debugging/leak_check_test.cc
@@ -16,8 +16,8 @@
#include "gtest/gtest.h"
#include "absl/base/config.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/debugging/leak_check.h"
+#include "absl/log/log.h"
namespace {
@@ -26,7 +26,7 @@ TEST(LeakCheckTest, IgnoreLeakSuppressesLeakedMemoryErrors) {
GTEST_SKIP() << "LeakChecker is not active";
}
auto foo = absl::IgnoreLeak(new std::string("some ignored leaked string"));
- ABSL_RAW_LOG(INFO, "Ignoring leaked string %s", foo->c_str());
+ LOG(INFO) << "Ignoring leaked string " << foo;
}
TEST(LeakCheckTest, LeakCheckDisablerIgnoresLeak) {
@@ -35,7 +35,7 @@ TEST(LeakCheckTest, LeakCheckDisablerIgnoresLeak) {
}
absl::LeakCheckDisabler disabler;
auto foo = new std::string("some string leaked while checks are disabled");
- ABSL_RAW_LOG(INFO, "Ignoring leaked string %s", foo->c_str());
+ LOG(INFO) << "Ignoring leaked string " << foo;
}
} // namespace
diff --git a/absl/debugging/symbolize_test.cc b/absl/debugging/symbolize_test.cc
index 3165c6ed..1d1199ff 100644
--- a/absl/debugging/symbolize_test.cc
+++ b/absl/debugging/symbolize_test.cc
@@ -29,9 +29,10 @@
#include "absl/base/casts.h"
#include "absl/base/config.h"
#include "absl/base/internal/per_thread_tls.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/optimization.h"
#include "absl/debugging/internal/stack_consumption.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "absl/memory/memory.h"
#include "absl/strings/string_view.h"
@@ -124,15 +125,17 @@ static char try_symbolize_buffer[4096];
// absl::Symbolize() returns false, otherwise returns try_symbolize_buffer with
// the result of absl::Symbolize().
static const char *TrySymbolizeWithLimit(void *pc, int limit) {
- ABSL_RAW_CHECK(limit <= sizeof(try_symbolize_buffer),
- "try_symbolize_buffer is too small");
+ CHECK_LE(limit, sizeof(try_symbolize_buffer))
+ << "try_symbolize_buffer is too small";
// Use the heap to facilitate heap and buffer sanitizer tools.
auto heap_buffer = absl::make_unique<char[]>(sizeof(try_symbolize_buffer));
bool found = absl::Symbolize(pc, heap_buffer.get(), limit);
if (found) {
- ABSL_RAW_CHECK(strnlen(heap_buffer.get(), limit) < limit,
- "absl::Symbolize() did not properly terminate the string");
+ CHECK_LT(static_cast<int>(
+ strnlen(heap_buffer.get(), static_cast<size_t>(limit))),
+ limit)
+ << "absl::Symbolize() did not properly terminate the string";
strncpy(try_symbolize_buffer, heap_buffer.get(),
sizeof(try_symbolize_buffer) - 1);
try_symbolize_buffer[sizeof(try_symbolize_buffer) - 1] = '\0';
@@ -155,8 +158,8 @@ void ABSL_ATTRIBUTE_NOINLINE TestWithReturnAddress() {
#if defined(ABSL_HAVE_ATTRIBUTE_NOINLINE)
void *return_address = __builtin_return_address(0);
const char *symbol = TrySymbolize(return_address);
- ABSL_RAW_CHECK(symbol != nullptr, "TestWithReturnAddress failed");
- ABSL_RAW_CHECK(strcmp(symbol, "main") == 0, "TestWithReturnAddress failed");
+ CHECK_NE(symbol, nullptr) << "TestWithReturnAddress failed";
+ CHECK_STREQ(symbol, "main") << "TestWithReturnAddress failed";
std::cout << "TestWithReturnAddress passed" << std::endl;
#endif
}
@@ -314,8 +317,8 @@ static int FilterElfHeader(struct dl_phdr_info *info, size_t size, void *data) {
TEST(Symbolize, SymbolizeWithMultipleMaps) {
// Force kPadding0 and kPadding1 to be linked in.
if (volatile_bool) {
- ABSL_RAW_LOG(INFO, "%s", kPadding0);
- ABSL_RAW_LOG(INFO, "%s", kPadding1);
+ LOG(INFO) << kPadding0;
+ LOG(INFO) << kPadding1;
}
// Verify we can symbolize everything.
@@ -463,9 +466,9 @@ void ABSL_ATTRIBUTE_NOINLINE TestWithPCInsideNonInlineFunction() {
(defined(__i386__) || defined(__x86_64__))
void *pc = non_inline_func();
const char *symbol = TrySymbolize(pc);
- ABSL_RAW_CHECK(symbol != nullptr, "TestWithPCInsideNonInlineFunction failed");
- ABSL_RAW_CHECK(strcmp(symbol, "non_inline_func") == 0,
- "TestWithPCInsideNonInlineFunction failed");
+ CHECK_NE(symbol, nullptr) << "TestWithPCInsideNonInlineFunction failed";
+ CHECK_STREQ(symbol, "non_inline_func")
+ << "TestWithPCInsideNonInlineFunction failed";
std::cout << "TestWithPCInsideNonInlineFunction passed" << std::endl;
#endif
}
@@ -475,9 +478,8 @@ void ABSL_ATTRIBUTE_NOINLINE TestWithPCInsideInlineFunction() {
(defined(__i386__) || defined(__x86_64__))
void *pc = inline_func(); // Must be inlined.
const char *symbol = TrySymbolize(pc);
- ABSL_RAW_CHECK(symbol != nullptr, "TestWithPCInsideInlineFunction failed");
- ABSL_RAW_CHECK(strcmp(symbol, __FUNCTION__) == 0,
- "TestWithPCInsideInlineFunction failed");
+ CHECK_NE(symbol, nullptr) << "TestWithPCInsideInlineFunction failed";
+ CHECK_STREQ(symbol, __FUNCTION__) << "TestWithPCInsideInlineFunction failed";
std::cout << "TestWithPCInsideInlineFunction passed" << std::endl;
#endif
}
@@ -519,9 +521,8 @@ __attribute__((target("arm"))) int ArmThumbOverlapArm(int x) {
void ABSL_ATTRIBUTE_NOINLINE TestArmThumbOverlap() {
#if defined(ABSL_HAVE_ATTRIBUTE_NOINLINE)
const char *symbol = TrySymbolize((void *)&ArmThumbOverlapArm);
- ABSL_RAW_CHECK(symbol != nullptr, "TestArmThumbOverlap failed");
- ABSL_RAW_CHECK(strcmp("ArmThumbOverlapArm()", symbol) == 0,
- "TestArmThumbOverlap failed");
+ CHECK_NE(symbol, nullptr) << "TestArmThumbOverlap failed";
+ CHECK_STREQ("ArmThumbOverlapArm()", symbol) << "TestArmThumbOverlap failed";
std::cout << "TestArmThumbOverlap passed" << std::endl;
#endif
}
@@ -584,7 +585,7 @@ int main(int argc, char **argv) {
#if !defined(__EMSCRIPTEN__)
// Make sure kHpageTextPadding is linked into the binary.
if (volatile_bool) {
- ABSL_RAW_LOG(INFO, "%s", kHpageTextPadding);
+ LOG(INFO) << kHpageTextPadding;
}
#endif // !defined(__EMSCRIPTEN__)
diff --git a/absl/flags/BUILD.bazel b/absl/flags/BUILD.bazel
index 570d280c..627f453a 100644
--- a/absl/flags/BUILD.bazel
+++ b/absl/flags/BUILD.bazel
@@ -452,8 +452,8 @@ cc_test(
":parse",
":reflection",
":usage_internal",
- "//absl/base:raw_logging_internal",
"//absl/base:scoped_set_env",
+ "//absl/log",
"//absl/strings",
"//absl/types:span",
"@com_google_googletest//:gtest_main",
diff --git a/absl/flags/CMakeLists.txt b/absl/flags/CMakeLists.txt
index b5f6dfc4..b9d3b97b 100644
--- a/absl/flags/CMakeLists.txt
+++ b/absl/flags/CMakeLists.txt
@@ -374,7 +374,7 @@ absl_cc_test(
absl::flags_parse
absl::flags_reflection
absl::flags_usage_internal
- absl::raw_logging_internal
+ absl::log
absl::scoped_set_env
absl::span
absl::strings
diff --git a/absl/flags/parse_test.cc b/absl/flags/parse_test.cc
index cd32efc8..97b78980 100644
--- a/absl/flags/parse_test.cc
+++ b/absl/flags/parse_test.cc
@@ -24,12 +24,12 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/internal/scoped_set_env.h"
#include "absl/flags/flag.h"
#include "absl/flags/internal/parse.h"
#include "absl/flags/internal/usage.h"
#include "absl/flags/reflection.h"
+#include "absl/log/log.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
#include "absl/strings/substitute.h"
@@ -150,8 +150,7 @@ const std::string& GetTestTempDir() {
}
if (res->empty()) {
- ABSL_INTERNAL_LOG(FATAL,
- "Failed to make temporary directory for data files");
+ LOG(FATAL) << "Failed to make temporary directory for data files";
}
#ifdef _WIN32
diff --git a/absl/log/BUILD.bazel b/absl/log/BUILD.bazel
index 560f6c44..e1410637 100644
--- a/absl/log/BUILD.bazel
+++ b/absl/log/BUILD.bazel
@@ -459,7 +459,6 @@ cc_test(
":log_sink_registry",
":scoped_mock_log",
"//absl/base:core_headers",
- "//absl/base:raw_logging_internal",
"//absl/log/internal:test_actions",
"//absl/log/internal:test_helpers",
"//absl/log/internal:test_matchers",
diff --git a/absl/log/CMakeLists.txt b/absl/log/CMakeLists.txt
index 2990984f..9320ce59 100644
--- a/absl/log/CMakeLists.txt
+++ b/absl/log/CMakeLists.txt
@@ -905,7 +905,6 @@ absl_cc_test(
absl::log_sink
absl::log_sink_registry
absl::log_severity
- absl::raw_logging_internal
absl::scoped_mock_log
absl::strings
GTest::gtest_main
diff --git a/absl/log/log_sink_test.cc b/absl/log/log_sink_test.cc
index 8903da72..fa743060 100644
--- a/absl/log/log_sink_test.cc
+++ b/absl/log/log_sink_test.cc
@@ -18,7 +18,6 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "absl/base/attributes.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/log/internal/test_actions.h"
#include "absl/log/internal/test_helpers.h"
#include "absl/log/internal/test_matchers.h"
@@ -205,7 +204,7 @@ class ReentrancyTest : public ::testing::Test {
<< "The log is coming from *inside the sink*.";
break;
default:
- ABSL_RAW_LOG(FATAL, "Invalid mode %d.\n", static_cast<int>(mode_));
+ LOG(FATAL) << "Invalid mode " << static_cast<int>(mode_);
}
}
diff --git a/absl/random/BUILD.bazel b/absl/random/BUILD.bazel
index 133c0659..19130ff7 100644
--- a/absl/random/BUILD.bazel
+++ b/absl/random/BUILD.bazel
@@ -189,7 +189,7 @@ cc_test(
deps = [
":distributions",
":random",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/numeric:representation",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
@@ -244,7 +244,7 @@ cc_test(
deps = [
":distributions",
":random",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
"//absl/random/internal:sequence_urbg",
@@ -265,7 +265,7 @@ cc_test(
deps = [
":distributions",
":random",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
"//absl/random/internal:sequence_urbg",
@@ -292,8 +292,8 @@ cc_test(
":distributions",
":random",
"//absl/base:core_headers",
- "//absl/base:raw_logging_internal",
"//absl/container:flat_hash_map",
+ "//absl/log",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
"//absl/random/internal:sequence_urbg",
@@ -314,7 +314,7 @@ cc_test(
":distributions",
":random",
"//absl/base:core_headers",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/numeric:representation",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
@@ -338,7 +338,7 @@ cc_test(
":distributions",
":random",
"//absl/base:core_headers",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/numeric:representation",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:sequence_urbg",
@@ -360,7 +360,7 @@ cc_test(
deps = [
":distributions",
":random",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
"//absl/random/internal:sequence_urbg",
@@ -385,7 +385,7 @@ cc_test(
deps = [
":distributions",
":random",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/numeric:representation",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
@@ -406,7 +406,7 @@ cc_test(
deps = [
":distributions",
":random",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/random/internal:distribution_test_util",
"//absl/random/internal:pcg_engine",
"//absl/random/internal:sequence_urbg",
diff --git a/absl/random/CMakeLists.txt b/absl/random/CMakeLists.txt
index c74fd300..bd363d88 100644
--- a/absl/random/CMakeLists.txt
+++ b/absl/random/CMakeLists.txt
@@ -260,13 +260,13 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
+ absl::log
absl::numeric_representation
absl::random_distributions
absl::random_random
absl::random_internal_distribution_test_util
absl::random_internal_sequence_urbg
absl::random_internal_pcg_engine
- absl::raw_logging_internal
absl::strings
absl::str_format
GTest::gmock
@@ -299,6 +299,7 @@ absl_cc_test(
${ABSL_TEST_COPTS}
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
+ DEPS
absl::random_distributions
absl::random_random
absl::raw_logging_internal
@@ -315,12 +316,13 @@ absl_cc_test(
${ABSL_TEST_COPTS}
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
+ DEPS
+ absl::log
absl::random_distributions
absl::random_internal_distribution_test_util
absl::random_internal_pcg_engine
absl::random_internal_sequence_urbg
absl::random_random
- absl::raw_logging_internal
absl::strings
absl::str_format
GTest::gmock
@@ -337,12 +339,12 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
+ absl::log
absl::random_distributions
absl::random_internal_distribution_test_util
absl::random_internal_pcg_engine
absl::random_internal_sequence_urbg
absl::random_random
- absl::raw_logging_internal
absl::strings
GTest::gmock
GTest::gtest_main
@@ -362,10 +364,10 @@ absl_cc_test(
absl::random_random
absl::core_headers
absl::flat_hash_map
+ absl::log
absl::random_internal_distribution_test_util
absl::random_internal_pcg_engine
absl::random_internal_sequence_urbg
- absl::raw_logging_internal
absl::strings
absl::str_format
GTest::gmock
@@ -383,13 +385,13 @@ absl_cc_test(
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::core_headers
+ absl::log
absl::numeric_representation
absl::random_distributions
absl::random_internal_distribution_test_util
absl::random_internal_pcg_engine
absl::random_internal_sequence_urbg
absl::random_random
- absl::raw_logging_internal
absl::strings
absl::str_format
GTest::gmock
@@ -407,12 +409,12 @@ absl_cc_test(
${ABSL_DEFAULT_LINKOPTS}
DEPS
absl::core_headers
+ absl::log
absl::numeric_representation
absl::random_distributions
absl::random_internal_distribution_test_util
absl::random_internal_sequence_urbg
absl::random_random
- absl::raw_logging_internal
absl::strings
absl::str_format
GTest::gmock
@@ -429,12 +431,12 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
+ absl::log
absl::random_distributions
absl::random_internal_distribution_test_util
absl::random_internal_pcg_engine
absl::random_internal_sequence_urbg
absl::random_random
- absl::raw_logging_internal
absl::strings
GTest::gmock
GTest::gtest_main
@@ -450,6 +452,7 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
+ absl::log
absl::numeric_representation
absl::random_distributions
absl::random_internal_distribution_test_util
@@ -471,12 +474,12 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
+ absl::log
absl::random_distributions
absl::random_internal_distribution_test_util
absl::random_internal_pcg_engine
absl::random_internal_sequence_urbg
absl::random_random
- absl::raw_logging_internal
absl::strings
GTest::gmock
GTest::gtest_main
@@ -1090,9 +1093,9 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
+ absl::log
absl::random_internal_explicit_seed_seq
absl::random_internal_randen_engine
- absl::raw_logging_internal
absl::strings
absl::time
GTest::gmock
@@ -1142,10 +1145,10 @@ absl_cc_test(
LINKOPTS
${ABSL_DEFAULT_LINKOPTS}
DEPS
+ absl::log
absl::random_internal_platform
absl::random_internal_randen_hwaes
absl::random_internal_randen_hwaes_impl
- absl::raw_logging_internal
absl::str_format
GTest::gmock
GTest::gtest
diff --git a/absl/random/beta_distribution_test.cc b/absl/random/beta_distribution_test.cc
index c16fbb4f..c93b2a33 100644
--- a/absl/random/beta_distribution_test.cc
+++ b/absl/random/beta_distribution_test.cc
@@ -28,7 +28,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/log.h"
#include "absl/numeric/internal/representation.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
@@ -107,8 +107,8 @@ TYPED_TEST(BetaDistributionInterfaceTest, SerializeTest) {
};
for (TypeParam alpha : kValues) {
for (TypeParam beta : kValues) {
- ABSL_INTERNAL_LOG(
- INFO, absl::StrFormat("Smoke test for Beta(%a, %a)", alpha, beta));
+ LOG(INFO) << absl::StreamFormat("Smoke test for Beta(%a, %a)", alpha,
+ beta);
param_type param(alpha, beta);
absl::beta_distribution<TypeParam> before(alpha, beta);
@@ -327,15 +327,13 @@ bool BetaDistributionTest::SingleZTestOnMeanAndVariance(double p,
absl::random_internal::Near("z", z_mean, 0.0, max_err) &&
absl::random_internal::Near("z_variance", z_variance, 0.0, max_err);
if (!pass) {
- ABSL_INTERNAL_LOG(
- INFO,
- absl::StrFormat(
- "Beta(%f, %f), "
- "mean: sample %f, expect %f, which is %f stddevs away, "
- "variance: sample %f, expect %f, which is %f stddevs away.",
- alpha_, beta_, m.mean, Mean(),
- std::abs(m.mean - Mean()) / mean_stddev, m.variance, Variance(),
- std::abs(m.variance - Variance()) / variance_stddev));
+ LOG(INFO) << "Beta(" << alpha_ << ", " << beta_ << "), mean: sample "
+ << m.mean << ", expect " << Mean() << ", which is "
+ << std::abs(m.mean - Mean()) / mean_stddev
+ << " stddevs away, variance: sample " << m.variance << ", expect "
+ << Variance() << ", which is "
+ << std::abs(m.variance - Variance()) / variance_stddev
+ << " stddevs away.";
}
return pass;
}
@@ -396,18 +394,15 @@ bool BetaDistributionTest::SingleChiSquaredTest(double p, size_t samples,
const bool pass =
(absl::random_internal::ChiSquarePValue(chi_square, dof) >= p);
if (!pass) {
- for (int i = 0; i < cutoffs.size(); i++) {
- ABSL_INTERNAL_LOG(
- INFO, absl::StrFormat("cutoff[%d] = %f, actual count %d, expected %d",
- i, cutoffs[i], counts[i],
- static_cast<int>(expected[i])));
+ for (size_t i = 0; i < cutoffs.size(); i++) {
+ LOG(INFO) << "cutoff[" << i << "] = " << cutoffs[i] << ", actual count "
+ << counts[i] << ", expected " << static_cast<int>(expected[i]);
}
- ABSL_INTERNAL_LOG(
- INFO, absl::StrFormat(
- "Beta(%f, %f) %s %f, p = %f", alpha_, beta_,
- absl::random_internal::kChiSquared, chi_square,
- absl::random_internal::ChiSquarePValue(chi_square, dof)));
+ LOG(INFO) << "Beta(" << alpha_ << ", " << beta_ << ") "
+ << absl::random_internal::kChiSquared << " " << chi_square
+ << ", p = "
+ << absl::random_internal::ChiSquarePValue(chi_square, dof);
}
return pass;
}
diff --git a/absl/random/discrete_distribution_test.cc b/absl/random/discrete_distribution_test.cc
index e528a6a7..32405ea9 100644
--- a/absl/random/discrete_distribution_test.cc
+++ b/absl/random/discrete_distribution_test.cc
@@ -26,7 +26,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/log.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
#include "absl/random/internal/pcg_engine.h"
@@ -194,7 +194,7 @@ TEST(DiscreteDistributionTest, ChiSquaredTest50) {
absl::StrAppend(&msg, kChiSquared, " p-value ", p_value, "\n");
absl::StrAppend(&msg, "High ", kChiSquared, " value: ", chi_square, " > ",
kThreshold);
- ABSL_RAW_LOG(INFO, "%s", msg.c_str());
+ LOG(INFO) << msg;
FAIL() << msg;
}
}
diff --git a/absl/random/exponential_distribution_test.cc b/absl/random/exponential_distribution_test.cc
index 3c44d9ec..fb9a0d16 100644
--- a/absl/random/exponential_distribution_test.cc
+++ b/absl/random/exponential_distribution_test.cc
@@ -29,8 +29,8 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
+#include "absl/log/log.h"
#include "absl/numeric/internal/representation.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
@@ -115,9 +115,8 @@ TYPED_TEST(ExponentialDistributionTypedTest, SerializeTest) {
if (sample < sample_min) sample_min = sample;
}
if (!std::is_same<TypeParam, long double>::value) {
- ABSL_INTERNAL_LOG(INFO,
- absl::StrFormat("Range {%f}: %f, %f, lambda=%f", lambda,
- sample_min, sample_max, lambda));
+ LOG(INFO) << "Range {" << lambda << "}: " << sample_min << ", "
+ << sample_max << ", lambda=" << lambda;
}
std::stringstream ss;
@@ -219,17 +218,16 @@ bool ExponentialDistributionTests::SingleZTest(const double p,
const bool pass = absl::random_internal::Near("z", z, 0.0, max_err);
if (!pass) {
- ABSL_INTERNAL_LOG(
- INFO, absl::StrFormat("p=%f max_err=%f\n"
- " lambda=%f\n"
- " mean=%f vs. %f\n"
- " stddev=%f vs. %f\n"
- " skewness=%f vs. %f\n"
- " kurtosis=%f vs. %f\n"
- " z=%f vs. 0",
- p, max_err, lambda(), m.mean, mean(),
- std::sqrt(m.variance), stddev(), m.skewness,
- skew(), m.kurtosis, kurtosis(), z));
+ // clang-format off
+ LOG(INFO)
+ << "p=" << p << " max_err=" << max_err << "\n"
+ " lambda=" << lambda() << "\n"
+ " mean=" << m.mean << " vs. " << mean() << "\n"
+ " stddev=" << std::sqrt(m.variance) << " vs. " << stddev() << "\n"
+ " skewness=" << m.skewness << " vs. " << skew() << "\n"
+ " kurtosis=" << m.kurtosis << " vs. " << kurtosis() << "\n"
+ " z=" << z << " vs. 0";
+ // clang-format on
}
return pass;
}
@@ -274,16 +272,16 @@ double ExponentialDistributionTests::SingleChiSquaredTest() {
double p = absl::random_internal::ChiSquarePValue(chi_square, dof);
if (chi_square > threshold) {
- for (int i = 0; i < cutoffs.size(); i++) {
- ABSL_INTERNAL_LOG(
- INFO, absl::StrFormat("%d : (%f) = %d", i, cutoffs[i], counts[i]));
+ for (size_t i = 0; i < cutoffs.size(); i++) {
+ LOG(INFO) << i << " : (" << cutoffs[i] << ") = " << counts[i];
}
- ABSL_INTERNAL_LOG(INFO,
- absl::StrCat("lambda ", lambda(), "\n", //
- " expected ", expected, "\n", //
- kChiSquared, " ", chi_square, " (", p, ")\n",
- kChiSquared, " @ 0.98 = ", threshold));
+ // clang-format off
+ LOG(INFO) << "lambda " << lambda() << "\n"
+ " expected " << expected << "\n"
+ << kChiSquared << " " << chi_square << " (" << p << ")\n"
+ << kChiSquared << " @ 0.98 = " << threshold;
+ // clang-format on
}
return p;
}
diff --git a/absl/random/gaussian_distribution_test.cc b/absl/random/gaussian_distribution_test.cc
index 4584ac92..bad3476f 100644
--- a/absl/random/gaussian_distribution_test.cc
+++ b/absl/random/gaussian_distribution_test.cc
@@ -26,8 +26,8 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
+#include "absl/log/log.h"
#include "absl/numeric/internal/representation.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
@@ -116,9 +116,8 @@ TYPED_TEST(GaussianDistributionInterfaceTest, SerializeTest) {
EXPECT_LE(sample, before.max()) << before;
}
if (!std::is_same<TypeParam, long double>::value) {
- ABSL_INTERNAL_LOG(
- INFO, absl::StrFormat("Range{%f, %f}: %f, %f", mean, stddev,
- sample_min, sample_max));
+ LOG(INFO) << "Range{" << mean << ", " << stddev << "}: " << sample_min
+ << ", " << sample_max;
}
std::stringstream ss;
@@ -240,17 +239,16 @@ bool GaussianDistributionTests::SingleZTest(const double p,
(std::pow(m.skewness, 2.0) + std::pow(m.kurtosis - 3.0, 2.0) / 4.0);
if (!pass || jb > 9.21) {
- ABSL_INTERNAL_LOG(
- INFO, absl::StrFormat("p=%f max_err=%f\n"
- " mean=%f vs. %f\n"
- " stddev=%f vs. %f\n"
- " skewness=%f vs. %f\n"
- " kurtosis=%f vs. %f\n"
- " z=%f vs. 0\n"
- " jb=%f vs. 9.21",
- p, max_err, m.mean, mean(), std::sqrt(m.variance),
- stddev(), m.skewness, skew(), m.kurtosis,
- kurtosis(), z, jb));
+ // clang-format off
+ LOG(INFO)
+ << "p=" << p << " max_err=" << max_err << "\n"
+ " mean=" << m.mean << " vs. " << mean() << "\n"
+ " stddev=" << std::sqrt(m.variance) << " vs. " << stddev() << "\n"
+ " skewness=" << m.skewness << " vs. " << skew() << "\n"
+ " kurtosis=" << m.kurtosis << " vs. " << kurtosis() << "\n"
+ " z=" << z << " vs. 0\n"
+ " jb=" << jb << " vs. 9.21";
+ // clang-format on
}
return pass;
}
@@ -297,16 +295,16 @@ double GaussianDistributionTests::SingleChiSquaredTest() {
// Log if the chi_square value is above the threshold.
if (chi_square > threshold) {
- for (int i = 0; i < cutoffs.size(); i++) {
- ABSL_INTERNAL_LOG(
- INFO, absl::StrFormat("%d : (%f) = %d", i, cutoffs[i], counts[i]));
+ for (size_t i = 0; i < cutoffs.size(); i++) {
+ LOG(INFO) << i << " : (" << cutoffs[i] << ") = " << counts[i];
}
- ABSL_INTERNAL_LOG(
- INFO, absl::StrCat("mean=", mean(), " stddev=", stddev(), "\n", //
- " expected ", expected, "\n", //
- kChiSquared, " ", chi_square, " (", p, ")\n", //
- kChiSquared, " @ 0.98 = ", threshold));
+ // clang-format off
+ LOG(INFO) << "mean=" << mean() << " stddev=" << stddev() << "\n"
+ " expected " << expected << "\n"
+ << kChiSquared << " " << chi_square << " (" << p << ")\n"
+ << kChiSquared << " @ 0.98 = " << threshold;
+ // clang-format on
}
return p;
}
diff --git a/absl/random/internal/BUILD.bazel b/absl/random/internal/BUILD.bazel
index a51c9375..37f4d6e2 100644
--- a/absl/random/internal/BUILD.bazel
+++ b/absl/random/internal/BUILD.bazel
@@ -601,7 +601,7 @@ cc_test(
deps = [
":explicit_seed_seq",
":randen_engine",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/strings",
"//absl/time",
"@com_google_googletest//:gtest_main",
@@ -646,7 +646,7 @@ cc_test(
":platform",
":randen_hwaes",
":randen_hwaes_impl", # build_cleaner: keep
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/strings:str_format",
"@com_google_googletest//:gtest",
],
@@ -707,8 +707,10 @@ cc_test(
],
deps = [
":nanobenchmark",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
+ "//absl/log:check",
"//absl/strings",
+ "//absl/strings:str_format",
],
)
diff --git a/absl/random/internal/nanobenchmark_test.cc b/absl/random/internal/nanobenchmark_test.cc
index f1571e26..d4f1028d 100644
--- a/absl/random/internal/nanobenchmark_test.cc
+++ b/absl/random/internal/nanobenchmark_test.cc
@@ -14,8 +14,10 @@
#include "absl/random/internal/nanobenchmark.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "absl/strings/numbers.h"
+#include "absl/strings/str_format.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
@@ -36,16 +38,16 @@ void MeasureDiv(const FuncInput (&inputs)[N]) {
params.max_evals = 6; // avoid test timeout
const size_t num_results = Measure(&Div, nullptr, inputs, N, results, params);
if (num_results == 0) {
- ABSL_RAW_LOG(
- WARNING,
- "WARNING: Measurement failed, should not happen when using "
- "PinThreadToCPU unless the region to measure takes > 1 second.\n");
+ LOG(WARNING)
+ << "WARNING: Measurement failed, should not happen when using "
+ "PinThreadToCPU unless the region to measure takes > 1 second.";
return;
}
for (size_t i = 0; i < num_results; ++i) {
- ABSL_RAW_LOG(INFO, "%5zu: %6.2f ticks; MAD=%4.2f%%\n", results[i].input,
- results[i].ticks, results[i].variability * 100.0);
- ABSL_RAW_CHECK(results[i].ticks != 0.0f, "Zero duration");
+ LOG(INFO) << absl::StreamFormat("%5u: %6.2f ticks; MAD=%4.2f%%\n",
+ results[i].input, results[i].ticks,
+ results[i].variability * 100.0);
+ CHECK_NE(results[i].ticks, 0.0f) << "Zero duration";
}
}
@@ -54,7 +56,7 @@ void RunAll(const int argc, char* argv[]) {
int cpu = -1;
if (argc == 2) {
if (!absl::SimpleAtoi(argv[1], &cpu)) {
- ABSL_RAW_LOG(FATAL, "The optional argument must be a CPU number >= 0.\n");
+ LOG(FATAL) << "The optional argument must be a CPU number >= 0.";
}
}
PinThreadToCPU(cpu);
diff --git a/absl/random/internal/randen_engine_test.cc b/absl/random/internal/randen_engine_test.cc
index c8e7685b..a94f4916 100644
--- a/absl/random/internal/randen_engine_test.cc
+++ b/absl/random/internal/randen_engine_test.cc
@@ -21,7 +21,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/log.h"
#include "absl/random/internal/explicit_seed_seq.h"
#include "absl/strings/str_cat.h"
#include "absl/time/clock.h"
@@ -645,9 +645,8 @@ TEST(RandenTest, IsFastOrSlow) {
}
auto duration = absl::GetCurrentTimeNanos() - start;
- ABSL_INTERNAL_LOG(INFO, absl::StrCat(static_cast<double>(duration) /
- static_cast<double>(kCount),
- "ns"));
+ LOG(INFO) << static_cast<double>(duration) / static_cast<double>(kCount)
+ << "ns";
EXPECT_GT(sum, 0);
EXPECT_GE(duration, kCount); // Should be slower than 1ns per call.
diff --git a/absl/random/internal/randen_hwaes_test.cc b/absl/random/internal/randen_hwaes_test.cc
index 2348b55c..00d96efd 100644
--- a/absl/random/internal/randen_hwaes_test.cc
+++ b/absl/random/internal/randen_hwaes_test.cc
@@ -16,7 +16,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/log.h"
#include "absl/random/internal/platform.h"
#include "absl/random/internal/randen_detect.h"
#include "absl/random/internal/randen_traits.h"
@@ -67,32 +67,32 @@ TEST(RandenHwAesTest, Default) {
int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
- ABSL_RAW_LOG(INFO, "ABSL_HAVE_ACCELERATED_AES=%d", ABSL_HAVE_ACCELERATED_AES);
- ABSL_RAW_LOG(INFO, "ABSL_RANDOM_INTERNAL_AES_DISPATCH=%d",
- ABSL_RANDOM_INTERNAL_AES_DISPATCH);
+ LOG(INFO) << "ABSL_HAVE_ACCELERATED_AES=" << ABSL_HAVE_ACCELERATED_AES;
+ LOG(INFO) << "ABSL_RANDOM_INTERNAL_AES_DISPATCH="
+ << ABSL_RANDOM_INTERNAL_AES_DISPATCH;
#if defined(ABSL_ARCH_X86_64)
- ABSL_RAW_LOG(INFO, "ABSL_ARCH_X86_64");
+ LOG(INFO) << "ABSL_ARCH_X86_64";
#elif defined(ABSL_ARCH_X86_32)
- ABSL_RAW_LOG(INFO, "ABSL_ARCH_X86_32");
+ LOG(INFO) << "ABSL_ARCH_X86_32";
#elif defined(ABSL_ARCH_AARCH64)
- ABSL_RAW_LOG(INFO, "ABSL_ARCH_AARCH64");
+ LOG(INFO) << "ABSL_ARCH_AARCH64";
#elif defined(ABSL_ARCH_ARM)
- ABSL_RAW_LOG(INFO, "ABSL_ARCH_ARM");
+ LOG(INFO) << "ABSL_ARCH_ARM";
#elif defined(ABSL_ARCH_PPC)
- ABSL_RAW_LOG(INFO, "ABSL_ARCH_PPC");
+ LOG(INFO) << "ABSL_ARCH_PPC";
#else
- ABSL_RAW_LOG(INFO, "ARCH Unknown");
+ LOG(INFO) << "ARCH Unknown";
#endif
int x = absl::random_internal::HasRandenHwAesImplementation();
- ABSL_RAW_LOG(INFO, "HasRandenHwAesImplementation = %d", x);
+ LOG(INFO) << "HasRandenHwAesImplementation = " << x;
int y = absl::random_internal::CPUSupportsRandenHwAes();
- ABSL_RAW_LOG(INFO, "CPUSupportsRandenHwAes = %d", x);
+ LOG(INFO) << "CPUSupportsRandenHwAes = " << x;
if (!x || !y) {
- ABSL_RAW_LOG(INFO, "Skipping Randen HWAES tests.");
+ LOG(INFO) << "Skipping Randen HWAES tests.";
return 0;
}
return RUN_ALL_TESTS();
diff --git a/absl/random/log_uniform_int_distribution_test.cc b/absl/random/log_uniform_int_distribution_test.cc
index 0d0fcb95..5df3edac 100644
--- a/absl/random/log_uniform_int_distribution_test.cc
+++ b/absl/random/log_uniform_int_distribution_test.cc
@@ -24,7 +24,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/log.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
#include "absl/random/internal/pcg_engine.h"
@@ -108,8 +108,7 @@ TYPED_TEST(LogUniformIntDistributionTypeTest, SerializeTest) {
if (sample > sample_max) sample_max = sample;
if (sample < sample_min) sample_min = sample;
}
- ABSL_INTERNAL_LOG(INFO,
- absl::StrCat("Range: ", +sample_min, ", ", +sample_max));
+ LOG(INFO) << "Range: " << sample_min << ", " << sample_max;
}
}
@@ -182,16 +181,14 @@ double LogUniformIntChiSquaredTest::ChiSquaredTestImpl() {
const double p = absl::random_internal::ChiSquarePValue(chi_square, dof);
if (chi_square > threshold) {
- ABSL_INTERNAL_LOG(INFO, "values");
+ LOG(INFO) << "values";
for (size_t i = 0; i < buckets.size(); i++) {
- ABSL_INTERNAL_LOG(INFO, absl::StrCat(i, ": ", buckets[i]));
+ LOG(INFO) << i << ": " << buckets[i];
}
- ABSL_INTERNAL_LOG(INFO,
- absl::StrFormat("trials=%d\n"
- "%s(data, %d) = %f (%f)\n"
- "%s @ 0.98 = %f",
- trials, kChiSquared, dof, chi_square, p,
- kChiSquared, threshold));
+ LOG(INFO) << "trials=" << trials << "\n"
+ << kChiSquared << "(data, " << dof << ") = " << chi_square << " ("
+ << p << ")\n"
+ << kChiSquared << " @ 0.98 = " << threshold;
}
return p;
}
diff --git a/absl/random/poisson_distribution_test.cc b/absl/random/poisson_distribution_test.cc
index 4f585b9b..54755960 100644
--- a/absl/random/poisson_distribution_test.cc
+++ b/absl/random/poisson_distribution_test.cc
@@ -25,9 +25,9 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
#include "absl/container/flat_hash_map.h"
+#include "absl/log/log.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
#include "absl/random/internal/pcg_engine.h"
@@ -134,8 +134,8 @@ TYPED_TEST(PoissonDistributionInterfaceTest, SerializeTest) {
if (sample < sample_min) sample_min = sample;
}
- ABSL_INTERNAL_LOG(INFO, absl::StrCat("Range {", param.mean(), "}: ",
- +sample_min, ", ", +sample_max));
+ LOG(INFO) << "Range {" << param.mean() << "}: " << sample_min << ", "
+ << sample_max;
// Validate stream serialization.
std::stringstream ss;
@@ -188,10 +188,9 @@ class PoissonModel {
}
void LogCDF() {
- ABSL_INTERNAL_LOG(INFO, absl::StrCat("CDF (mean = ", mean_, ")"));
+ LOG(INFO) << "CDF (mean = " << mean_ << ")";
for (const auto c : cdf_) {
- ABSL_INTERNAL_LOG(INFO,
- absl::StrCat(c.index, ": pmf=", c.pmf, " cdf=", c.cdf));
+ LOG(INFO) << c.index << ": pmf=" << c.pmf << " cdf=" << c.cdf;
}
}
@@ -286,16 +285,15 @@ bool PoissonDistributionZTest::SingleZTest(const double p,
const bool pass = absl::random_internal::Near("z", z, 0.0, max_err);
if (!pass) {
- ABSL_INTERNAL_LOG(
- INFO, absl::StrFormat("p=%f max_err=%f\n"
- " mean=%f vs. %f\n"
- " stddev=%f vs. %f\n"
- " skewness=%f vs. %f\n"
- " kurtosis=%f vs. %f\n"
- " z=%f",
- p, max_err, m.mean, mean(), std::sqrt(m.variance),
- stddev(), m.skewness, skew(), m.kurtosis,
- kurtosis(), z));
+ // clang-format off
+ LOG(INFO)
+ << "p=" << p << " max_err=" << max_err << "\n"
+ " mean=" << m.mean << " vs. " << mean() << "\n"
+ " stddev=" << std::sqrt(m.variance) << " vs. " << stddev() << "\n"
+ " skewness=" << m.skewness << " vs. " << skew() << "\n"
+ " kurtosis=" << m.kurtosis << " vs. " << kurtosis() << "\n"
+ " z=" << z;
+ // clang-format on
}
return pass;
}
@@ -439,17 +437,16 @@ double PoissonDistributionChiSquaredTest::ChiSquaredTestImpl() {
if (chi_square > threshold) {
LogCDF();
- ABSL_INTERNAL_LOG(INFO, absl::StrCat("VALUES buckets=", counts.size(),
- " samples=", kSamples));
+ LOG(INFO) << "VALUES buckets=" << counts.size()
+ << " samples=" << kSamples;
for (size_t i = 0; i < counts.size(); i++) {
- ABSL_INTERNAL_LOG(
- INFO, absl::StrCat(cutoffs_[i], ": ", counts[i], " vs. E=", e[i]));
+ LOG(INFO) << cutoffs_[i] << ": " << counts[i] << " vs. E=" << e[i];
}
- ABSL_INTERNAL_LOG(
- INFO,
- absl::StrCat(kChiSquared, "(data, dof=", dof, ") = ", chi_square, " (",
- p, ")\n", " vs.\n", kChiSquared, " @ 0.98 = ", threshold));
+ LOG(INFO) << kChiSquared << "(data, dof=" << dof << ") = " << chi_square
+ << " (" << p << ")\n"
+ << " vs.\n"
+ << kChiSquared << " @ 0.98 = " << threshold;
}
return p;
}
diff --git a/absl/random/uniform_int_distribution_test.cc b/absl/random/uniform_int_distribution_test.cc
index a830117a..b40d6185 100644
--- a/absl/random/uniform_int_distribution_test.cc
+++ b/absl/random/uniform_int_distribution_test.cc
@@ -24,7 +24,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/log.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
#include "absl/random/internal/pcg_engine.h"
@@ -107,8 +107,7 @@ TYPED_TEST(UniformIntDistributionTest, ParamSerializeTest) {
sample_min = sample;
}
}
- std::string msg = absl::StrCat("Range: ", +sample_min, ", ", +sample_max);
- ABSL_RAW_LOG(INFO, "%s", msg.c_str());
+ LOG(INFO) << "Range: " << sample_min << ", " << sample_max;
}
}
@@ -210,7 +209,7 @@ TYPED_TEST(UniformIntDistributionTest, ChiSquaredTest50) {
absl::StrAppend(&msg, kChiSquared, " p-value ", p_value, "\n");
absl::StrAppend(&msg, "High ", kChiSquared, " value: ", chi_square, " > ",
kThreshold);
- ABSL_RAW_LOG(INFO, "%s", msg.c_str());
+ LOG(INFO) << msg;
FAIL() << msg;
}
}
diff --git a/absl/random/uniform_real_distribution_test.cc b/absl/random/uniform_real_distribution_test.cc
index 07f199d3..260aac96 100644
--- a/absl/random/uniform_real_distribution_test.cc
+++ b/absl/random/uniform_real_distribution_test.cc
@@ -26,7 +26,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/log.h"
#include "absl/numeric/internal/representation.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/distribution_test_util.h"
@@ -182,9 +182,8 @@ TYPED_TEST(UniformRealDistributionTest, ParamSerializeTest) {
if (!std::is_same<real_type, long double>::value) {
// static_cast<double>(long double) can overflow.
- std::string msg = absl::StrCat("Range: ", static_cast<double>(sample_min),
- ", ", static_cast<double>(sample_max));
- ABSL_RAW_LOG(INFO, "%s", msg.c_str());
+ LOG(INFO) << "Range: " << static_cast<double>(sample_min) << ", "
+ << static_cast<double>(sample_max);
}
}
}
@@ -324,7 +323,7 @@ TYPED_TEST(UniformRealDistributionTest, ChiSquaredTest50) {
absl::StrAppend(&msg, kChiSquared, " p-value ", p_value, "\n");
absl::StrAppend(&msg, "High ", kChiSquared, " value: ", chi_square, " > ",
kThreshold);
- ABSL_RAW_LOG(INFO, "%s", msg.c_str());
+ LOG(INFO) << msg;
FAIL() << msg;
}
}
diff --git a/absl/random/zipf_distribution_test.cc b/absl/random/zipf_distribution_test.cc
index c8bb89db..801ec4f6 100644
--- a/absl/random/zipf_distribution_test.cc
+++ b/absl/random/zipf_distribution_test.cc
@@ -25,7 +25,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/log.h"
#include "absl/random/internal/chi_square.h"
#include "absl/random/internal/pcg_engine.h"
#include "absl/random/internal/sequence_urbg.h"
@@ -102,8 +102,7 @@ TYPED_TEST(ZipfDistributionTypedTest, SerializeTest) {
if (sample > sample_max) sample_max = sample;
if (sample < sample_min) sample_min = sample;
}
- ABSL_INTERNAL_LOG(INFO,
- absl::StrCat("Range: ", +sample_min, ", ", +sample_max));
+ LOG(INFO) << "Range: " << sample_min << ", " << sample_max;
}
}
@@ -303,18 +302,15 @@ TEST_P(ZipfTest, ChiSquaredTest) {
// Log if the chi_squared value is above the threshold.
if (chi_square > threshold) {
- ABSL_INTERNAL_LOG(INFO, "values");
+ LOG(INFO) << "values";
for (size_t i = 0; i < expected.size(); i++) {
- ABSL_INTERNAL_LOG(INFO, absl::StrCat(points[i], ": ", buckets[i],
- " vs. E=", expected[i]));
+ LOG(INFO) << points[i] << ": " << buckets[i] << " vs. E=" << expected[i];
}
- ABSL_INTERNAL_LOG(INFO, absl::StrCat("trials ", trials));
- ABSL_INTERNAL_LOG(INFO,
- absl::StrCat("mean ", avg, " vs. expected ", mean()));
- ABSL_INTERNAL_LOG(INFO, absl::StrCat(kChiSquared, "(data, ", dof, ") = ",
- chi_square, " (", p_actual, ")"));
- ABSL_INTERNAL_LOG(INFO,
- absl::StrCat(kChiSquared, " @ 0.9995 = ", threshold));
+ LOG(INFO) << "trials " << trials;
+ LOG(INFO) << "mean " << avg << " vs. expected " << mean();
+ LOG(INFO) << kChiSquared << "(data, " << dof << ") = " << chi_square << " ("
+ << p_actual << ")";
+ LOG(INFO) << kChiSquared << " @ 0.9995 = " << threshold;
FAIL() << kChiSquared << " value of " << chi_square
<< " is above the threshold.";
}
diff --git a/absl/strings/BUILD.bazel b/absl/strings/BUILD.bazel
index e48a9a0a..bd33c533 100644
--- a/absl/strings/BUILD.bazel
+++ b/absl/strings/BUILD.bazel
@@ -774,10 +774,10 @@ cc_test(
"//absl/base:config",
"//absl/base:core_headers",
"//absl/base:endian",
- "//absl/base:raw_logging_internal",
"//absl/container:fixed_array",
"//absl/hash",
"//absl/log",
+ "//absl/log:check",
"//absl/random",
"@com_google_googletest//:gtest_main",
],
@@ -1019,7 +1019,7 @@ cc_test(
":pow10_helper",
":strings",
"//absl/base:config",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/random",
"//absl/random:distributions",
"@com_google_googletest//:gtest_main",
@@ -1096,7 +1096,7 @@ cc_test(
deps = [
":strings",
"//absl/base:config",
- "//absl/base:raw_logging_internal",
+ "//absl/log:check",
"@com_google_googletest//:gtest_main",
],
)
@@ -1253,6 +1253,7 @@ cc_test(
":strings",
"//absl/base:core_headers",
"//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/types:optional",
"@com_google_googletest//:gtest_main",
],
diff --git a/absl/strings/CMakeLists.txt b/absl/strings/CMakeLists.txt
index d2928bd7..9aaa7932 100644
--- a/absl/strings/CMakeLists.txt
+++ b/absl/strings/CMakeLists.txt
@@ -317,7 +317,7 @@ absl_cc_test(
absl::core_headers
absl::pow10_helper
absl::config
- absl::raw_logging_internal
+ absl::log
absl::random_random
absl::random_distributions
absl::strings_internal
@@ -372,9 +372,9 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
- absl::strings
+ absl::check
absl::config
- absl::raw_logging_internal
+ absl::strings
GTest::gmock_main
)
@@ -516,6 +516,7 @@ absl_cc_test(
absl::strings
absl::str_format_internal
absl::core_headers
+ absl::log
absl::raw_logging_internal
absl::int128
GTest::gmock_main
@@ -960,19 +961,20 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
- absl::cord
- absl::str_format
- absl::strings
absl::base
+ absl::check
absl::config
+ absl::cord
absl::cord_test_helpers
absl::cordz_test_helpers
absl::core_headers
absl::endian
+ absl::fixed_array
absl::hash
+ absl::log
absl::random_random
- absl::raw_logging_internal
- absl::fixed_array
+ absl::str_format
+ absl::strings
GTest::gmock_main
)
diff --git a/absl/strings/cord_test.cc b/absl/strings/cord_test.cc
index 3fe3967f..55412c7f 100644
--- a/absl/strings/cord_test.cc
+++ b/absl/strings/cord_test.cc
@@ -30,10 +30,11 @@
#include "gtest/gtest.h"
#include "absl/base/config.h"
#include "absl/base/internal/endian.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
#include "absl/container/fixed_array.h"
#include "absl/hash/hash.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "absl/random/random.h"
#include "absl/strings/cord_test_helpers.h"
#include "absl/strings/cordz_test_helpers.h"
@@ -210,9 +211,8 @@ class CordTestPeer {
}
static Cord MakeSubstring(Cord src, size_t offset, size_t length) {
- ABSL_RAW_CHECK(src.contents_.is_tree(), "Can not be inlined");
- ABSL_RAW_CHECK(src.ExpectedChecksum() == absl::nullopt,
- "Can not be hardened");
+ CHECK(src.contents_.is_tree()) << "Can not be inlined";
+ CHECK(!src.ExpectedChecksum().has_value()) << "Can not be hardened";
Cord cord;
auto* tree = cord_internal::SkipCrcNode(src.contents_.tree());
auto* rep = CordRepSubstring::Create(CordRep::Ref(tree), offset, length);
@@ -374,7 +374,7 @@ TEST_P(CordTest, GigabyteCordFromExternal) {
for (int i = 0; i < 1024; ++i) {
c.Append(from);
}
- ABSL_RAW_LOG(INFO, "Made a Cord with %zu bytes!", c.size());
+ LOG(INFO) << "Made a Cord with " << c.size() << " bytes!";
// Note: on a 32-bit build, this comes out to 2,818,048,000 bytes.
// Note: on a 64-bit build, this comes out to 171,932,385,280 bytes.
}
@@ -1247,15 +1247,15 @@ absl::Cord BigCord(size_t len, char v) {
// Splice block into cord.
absl::Cord SpliceCord(const absl::Cord& blob, int64_t offset,
const absl::Cord& block) {
- ABSL_RAW_CHECK(offset >= 0, "");
- ABSL_RAW_CHECK(offset + block.size() <= blob.size(), "");
+ CHECK_GE(offset, 0);
+ CHECK_LE(static_cast<size_t>(offset) + block.size(), blob.size());
absl::Cord result(blob);
result.RemoveSuffix(blob.size() - offset);
result.Append(block);
absl::Cord suffix(blob);
suffix.RemovePrefix(offset + block.size());
result.Append(suffix);
- ABSL_RAW_CHECK(blob.size() == result.size(), "");
+ CHECK_EQ(blob.size(), result.size());
return result;
}
@@ -1855,7 +1855,7 @@ TEST(CordTest, CordMemoryUsageBTree) {
// windows DLL, we may have ODR like effects on the flag, meaning the DLL
// code will run with the picked up default.
if (!absl::CordTestPeer::Tree(cord1)->IsBtree()) {
- ABSL_RAW_LOG(WARNING, "Cord library code not respecting btree flag");
+ LOG(WARNING) << "Cord library code not respecting btree flag";
return;
}
@@ -1940,8 +1940,7 @@ TEST_P(CordTest, DiabolicalGrowth) {
std::string value;
absl::CopyCordToString(cord, &value);
EXPECT_EQ(value, expected);
- ABSL_RAW_LOG(INFO, "Diabolical size allocated = %zu",
- cord.EstimatedMemoryUsage());
+ LOG(INFO) << "Diabolical size allocated = " << cord.EstimatedMemoryUsage();
}
// The following tests check support for >4GB cords in 64-bit binaries, and
diff --git a/absl/strings/internal/charconv_parse_test.cc b/absl/strings/internal/charconv_parse_test.cc
index bc2d1118..2b7b0821 100644
--- a/absl/strings/internal/charconv_parse_test.cc
+++ b/absl/strings/internal/charconv_parse_test.cc
@@ -19,7 +19,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/check.h"
#include "absl/strings/str_cat.h"
using absl::chars_format;
@@ -56,14 +56,14 @@ void ExpectParsedFloat(std::string s, absl::chars_format format_flags,
begin_subrange = static_cast<int>(open_bracket_pos);
s.replace(open_bracket_pos, 1, "");
std::string::size_type close_bracket_pos = s.find(']');
- ABSL_RAW_CHECK(close_bracket_pos != absl::string_view::npos,
- "Test input contains [ without matching ]");
+ CHECK_NE(close_bracket_pos, absl::string_view::npos)
+ << "Test input contains [ without matching ]";
end_subrange = static_cast<int>(close_bracket_pos);
s.replace(close_bracket_pos, 1, "");
}
const std::string::size_type expected_characters_matched = s.find('$');
- ABSL_RAW_CHECK(expected_characters_matched != std::string::npos,
- "Input string must contain $");
+ CHECK_NE(expected_characters_matched, std::string::npos)
+ << "Input string must contain $";
s.replace(expected_characters_matched, 1, "");
ParsedFloat parsed =
diff --git a/absl/strings/internal/str_format/convert_test.cc b/absl/strings/internal/str_format/convert_test.cc
index 8b5a27ed..16ff9879 100644
--- a/absl/strings/internal/str_format/convert_test.cc
+++ b/absl/strings/internal/str_format/convert_test.cc
@@ -26,6 +26,7 @@
#include "gtest/gtest.h"
#include "absl/base/attributes.h"
#include "absl/base/internal/raw_logging.h"
+#include "absl/log/log.h"
#include "absl/strings/internal/str_format/bind.h"
#include "absl/strings/match.h"
#include "absl/types/optional.h"
@@ -264,7 +265,7 @@ MATCHER_P(MatchesPointerString, ptr, "") {
}
void* parsed = nullptr;
if (sscanf(arg.c_str(), "%p", &parsed) != 1) {
- ABSL_RAW_LOG(FATAL, "Could not parse %s", arg.c_str());
+ LOG(FATAL) << "Could not parse " << arg;
}
return ptr == parsed;
}
diff --git a/absl/strings/numbers_test.cc b/absl/strings/numbers_test.cc
index b3c098d1..2864bda2 100644
--- a/absl/strings/numbers_test.cc
+++ b/absl/strings/numbers_test.cc
@@ -37,7 +37,7 @@
#include "gmock/gmock.h"
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/log.h"
#include "absl/random/distributions.h"
#include "absl/random/random.h"
#include "absl/strings/internal/numbers_test_common.h"
@@ -1337,11 +1337,9 @@ TEST_F(SimpleDtoaTest, ExhaustiveDoubleToSixDigits) {
if (strcmp(sixdigitsbuf, snprintfbuf) != 0) {
mismatches.push_back(d);
if (mismatches.size() < 10) {
- ABSL_RAW_LOG(ERROR, "%s",
- absl::StrCat("Six-digit failure with double. ", "d=", d,
- "=", d, " sixdigits=", sixdigitsbuf,
- " printf(%g)=", snprintfbuf)
- .c_str());
+ LOG(ERROR) << "Six-digit failure with double. d=" << d
+ << " sixdigits=" << sixdigitsbuf
+ << " printf(%g)=" << snprintfbuf;
}
}
};
@@ -1389,12 +1387,10 @@ TEST_F(SimpleDtoaTest, ExhaustiveDoubleToSixDigits) {
if (kFloatNumCases >= 1e9) {
// The exhaustive test takes a very long time, so log progress.
char buf[kSixDigitsToBufferSize];
- ABSL_RAW_LOG(
- INFO, "%s",
- absl::StrCat("Exp ", exponent, " powten=", powten, "(", powten,
- ") (",
- std::string(buf, SixDigitsToBuffer(powten, buf)), ")")
- .c_str());
+ LOG(INFO) << "Exp " << exponent << " powten=" << powten << "(" << powten
+ << ") ("
+ << absl::string_view(buf, SixDigitsToBuffer(powten, buf))
+ << ")";
}
for (int digits : digit_testcases) {
if (exponent == 308 && digits >= 179769) break; // don't overflow!
@@ -1419,20 +1415,17 @@ TEST_F(SimpleDtoaTest, ExhaustiveDoubleToSixDigits) {
double before = nextafter(d, 0.0);
double after = nextafter(d, 1.7976931348623157e308);
char b1[32], b2[kSixDigitsToBufferSize];
- ABSL_RAW_LOG(
- ERROR, "%s",
- absl::StrCat(
- "Mismatch #", i, " d=", d, " (", ToNineDigits(d), ")",
- " sixdigits='", sixdigitsbuf, "'", " snprintf='", snprintfbuf,
- "'", " Before.=", PerfectDtoa(before), " ",
- (SixDigitsToBuffer(before, b2), b2),
- " vs snprintf=", (snprintf(b1, sizeof(b1), "%g", before), b1),
- " Perfect=", PerfectDtoa(d), " ", (SixDigitsToBuffer(d, b2), b2),
- " vs snprintf=", (snprintf(b1, sizeof(b1), "%g", d), b1),
- " After.=.", PerfectDtoa(after), " ",
- (SixDigitsToBuffer(after, b2), b2),
- " vs snprintf=", (snprintf(b1, sizeof(b1), "%g", after), b1))
- .c_str());
+ LOG(ERROR) << "Mismatch #" << i << " d=" << d << " (" << ToNineDigits(d)
+ << ") sixdigits='" << sixdigitsbuf << "' snprintf='"
+ << snprintfbuf << "' Before.=" << PerfectDtoa(before) << " "
+ << (SixDigitsToBuffer(before, b2), b2) << " vs snprintf="
+ << (snprintf(b1, sizeof(b1), "%g", before), b1)
+ << " Perfect=" << PerfectDtoa(d) << " "
+ << (SixDigitsToBuffer(d, b2), b2)
+ << " vs snprintf=" << (snprintf(b1, sizeof(b1), "%g", d), b1)
+ << " After.=." << PerfectDtoa(after) << " "
+ << (SixDigitsToBuffer(after, b2), b2) << " vs snprintf="
+ << (snprintf(b1, sizeof(b1), "%g", after), b1);
}
}
}
diff --git a/absl/synchronization/BUILD.bazel b/absl/synchronization/BUILD.bazel
index 5074044e..3d405df8 100644
--- a/absl/synchronization/BUILD.bazel
+++ b/absl/synchronization/BUILD.bazel
@@ -198,7 +198,8 @@ cc_test(
deps = [
":graphcycles_internal",
"//absl/base:core_headers",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
+ "//absl/log:check",
"@com_google_googletest//:gtest_main",
],
)
@@ -247,7 +248,8 @@ cc_test(
"//absl/base",
"//absl/base:config",
"//absl/base:core_headers",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
+ "//absl/log:check",
"//absl/memory",
"//absl/time",
"@com_google_googletest//:gtest_main",
@@ -376,6 +378,6 @@ cc_test(
deps = [
":synchronization",
"//absl/base:core_headers",
- "//absl/base:raw_logging_internal",
+ "//absl/log:check",
],
)
diff --git a/absl/synchronization/CMakeLists.txt b/absl/synchronization/CMakeLists.txt
index 86278349..a0f64e5c 100644
--- a/absl/synchronization/CMakeLists.txt
+++ b/absl/synchronization/CMakeLists.txt
@@ -151,9 +151,10 @@ absl_cc_test(
COPTS
${ABSL_TEST_COPTS}
DEPS
- absl::graphcycles_internal
+ absl::check
absl::core_headers
- absl::raw_logging_internal
+ absl::graphcycles_internal
+ absl::log
GTest::gmock_main
)
@@ -183,10 +184,11 @@ absl_cc_test(
absl::synchronization
absl::thread_pool
absl::base
+ absl::check
absl::config
absl::core_headers
+ absl::log
absl::memory
- absl::raw_logging_internal
absl::time
GTest::gmock_main
)
@@ -278,5 +280,5 @@ absl_cc_test(
DEPS
absl::synchronization
absl::core_headers
- absl::raw_logging_internal
+ absl::check
)
diff --git a/absl/synchronization/internal/graphcycles_test.cc b/absl/synchronization/internal/graphcycles_test.cc
index 74eaffe7..3c6ef798 100644
--- a/absl/synchronization/internal/graphcycles_test.cc
+++ b/absl/synchronization/internal/graphcycles_test.cc
@@ -21,8 +21,9 @@
#include <vector>
#include "gtest/gtest.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/macros.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
namespace absl {
ABSL_NAMESPACE_BEGIN
@@ -65,51 +66,51 @@ static bool IsReachable(Edges *edges, int from, int to,
}
static void PrintEdges(Edges *edges) {
- ABSL_RAW_LOG(INFO, "EDGES (%zu)", edges->size());
+ LOG(INFO) << "EDGES (" << edges->size() << ")";
for (const auto &edge : *edges) {
int a = edge.from;
int b = edge.to;
- ABSL_RAW_LOG(INFO, "%d %d", a, b);
+ LOG(INFO) << a << " " << b;
}
- ABSL_RAW_LOG(INFO, "---");
+ LOG(INFO) << "---";
}
static void PrintGCEdges(Nodes *nodes, const IdMap &id, GraphCycles *gc) {
- ABSL_RAW_LOG(INFO, "GC EDGES");
+ LOG(INFO) << "GC EDGES";
for (int a : *nodes) {
for (int b : *nodes) {
if (gc->HasEdge(Get(id, a), Get(id, b))) {
- ABSL_RAW_LOG(INFO, "%d %d", a, b);
+ LOG(INFO) << a << " " << b;
}
}
}
- ABSL_RAW_LOG(INFO, "---");
+ LOG(INFO) << "---";
}
static void PrintTransitiveClosure(Nodes *nodes, Edges *edges) {
- ABSL_RAW_LOG(INFO, "Transitive closure");
+ LOG(INFO) << "Transitive closure";
for (int a : *nodes) {
for (int b : *nodes) {
std::unordered_set<int> seen;
if (IsReachable(edges, a, b, &seen)) {
- ABSL_RAW_LOG(INFO, "%d %d", a, b);
+ LOG(INFO) << a << " " << b;
}
}
}
- ABSL_RAW_LOG(INFO, "---");
+ LOG(INFO) << "---";
}
static void PrintGCTransitiveClosure(Nodes *nodes, const IdMap &id,
GraphCycles *gc) {
- ABSL_RAW_LOG(INFO, "GC Transitive closure");
+ LOG(INFO) << "GC Transitive closure";
for (int a : *nodes) {
for (int b : *nodes) {
if (gc->IsReachable(Get(id, a), Get(id, b))) {
- ABSL_RAW_LOG(INFO, "%d %d", a, b);
+ LOG(INFO) << a << " " << b;
}
}
}
- ABSL_RAW_LOG(INFO, "---");
+ LOG(INFO) << "---";
}
static void CheckTransitiveClosure(Nodes *nodes, Edges *edges, const IdMap &id,
@@ -125,9 +126,8 @@ static void CheckTransitiveClosure(Nodes *nodes, Edges *edges, const IdMap &id,
PrintGCEdges(nodes, id, gc);
PrintTransitiveClosure(nodes, edges);
PrintGCTransitiveClosure(nodes, id, gc);
- ABSL_RAW_LOG(FATAL, "gc_reachable %s reachable %s a %d b %d",
- gc_reachable ? "true" : "false",
- reachable ? "true" : "false", a, b);
+ LOG(FATAL) << "gc_reachable " << gc_reachable << " reachable "
+ << reachable << " a " << a << " b " << b;
}
}
}
@@ -142,7 +142,7 @@ static void CheckEdges(Nodes *nodes, Edges *edges, const IdMap &id,
if (!gc->HasEdge(Get(id, a), Get(id, b))) {
PrintEdges(edges);
PrintGCEdges(nodes, id, gc);
- ABSL_RAW_LOG(FATAL, "!gc->HasEdge(%d, %d)", a, b);
+ LOG(FATAL) << "!gc->HasEdge(" << a << ", " << b << ")";
}
}
for (const auto &a : *nodes) {
@@ -155,13 +155,12 @@ static void CheckEdges(Nodes *nodes, Edges *edges, const IdMap &id,
if (count != edges->size()) {
PrintEdges(edges);
PrintGCEdges(nodes, id, gc);
- ABSL_RAW_LOG(FATAL, "edges->size() %zu count %d", edges->size(), count);
+ LOG(FATAL) << "edges->size() " << edges->size() << " count " << count;
}
}
static void CheckInvariants(const GraphCycles &gc) {
- if (ABSL_PREDICT_FALSE(!gc.CheckInvariants()))
- ABSL_RAW_LOG(FATAL, "CheckInvariants");
+ CHECK(gc.CheckInvariants()) << "CheckInvariants";
}
// Returns the index of a randomly chosen node in *nodes.
@@ -309,7 +308,7 @@ TEST(GraphCycles, RandomizedTest) {
break;
default:
- ABSL_RAW_LOG(FATAL, "op %d", op);
+ LOG(FATAL) << "op " << op;
}
// Very rarely, test graph expansion by adding then removing many nodes.
diff --git a/absl/synchronization/lifetime_test.cc b/absl/synchronization/lifetime_test.cc
index e6274232..d5ce35a1 100644
--- a/absl/synchronization/lifetime_test.cc
+++ b/absl/synchronization/lifetime_test.cc
@@ -18,8 +18,8 @@
#include "absl/base/attributes.h"
#include "absl/base/const_init.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/thread_annotations.h"
+#include "absl/log/check.h"
#include "absl/synchronization/mutex.h"
#include "absl/synchronization/notification.h"
@@ -35,20 +35,20 @@ namespace {
// Thread two waits on 'notification', then sets 'state' inside the 'mutex',
// signalling the change via 'condvar'.
//
-// These tests use ABSL_RAW_CHECK to validate invariants, rather than EXPECT or
-// ASSERT from gUnit, because we need to invoke them during global destructors,
-// when gUnit teardown would have already begun.
+// These tests use CHECK to validate invariants, rather than EXPECT or ASSERT
+// from gUnit, because we need to invoke them during global destructors, when
+// gUnit teardown would have already begun.
void ThreadOne(absl::Mutex* mutex, absl::CondVar* condvar,
absl::Notification* notification, bool* state) {
// Test that the notification is in a valid initial state.
- ABSL_RAW_CHECK(!notification->HasBeenNotified(), "invalid Notification");
- ABSL_RAW_CHECK(*state == false, "*state not initialized");
+ CHECK(!notification->HasBeenNotified()) << "invalid Notification";
+ CHECK(!*state) << "*state not initialized";
{
absl::MutexLock lock(mutex);
notification->Notify();
- ABSL_RAW_CHECK(notification->HasBeenNotified(), "invalid Notification");
+ CHECK(notification->HasBeenNotified()) << "invalid Notification";
while (*state == false) {
condvar->Wait(mutex);
@@ -58,11 +58,11 @@ void ThreadOne(absl::Mutex* mutex, absl::CondVar* condvar,
void ThreadTwo(absl::Mutex* mutex, absl::CondVar* condvar,
absl::Notification* notification, bool* state) {
- ABSL_RAW_CHECK(*state == false, "*state not initialized");
+ CHECK(!*state) << "*state not initialized";
// Wake thread one
notification->WaitForNotification();
- ABSL_RAW_CHECK(notification->HasBeenNotified(), "invalid Notification");
+ CHECK(notification->HasBeenNotified()) << "invalid Notification";
{
absl::MutexLock lock(mutex);
*state = true;
diff --git a/absl/synchronization/mutex_test.cc b/absl/synchronization/mutex_test.cc
index ec039a70..4ae4d7e7 100644
--- a/absl/synchronization/mutex_test.cc
+++ b/absl/synchronization/mutex_test.cc
@@ -32,8 +32,9 @@
#include "gtest/gtest.h"
#include "absl/base/attributes.h"
#include "absl/base/config.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/base/internal/sysinfo.h"
+#include "absl/log/check.h"
+#include "absl/log/log.h"
#include "absl/memory/memory.h"
#include "absl/synchronization/internal/thread_pool.h"
#include "absl/time/clock.h"
@@ -87,7 +88,7 @@ static void SetInvariantChecked(bool new_value) {
static void CheckSumG0G1(void *v) {
TestContext *cxt = static_cast<TestContext *>(v);
- ABSL_RAW_CHECK(cxt->g0 == -cxt->g1, "Error in CheckSumG0G1");
+ CHECK_EQ(cxt->g0, -cxt->g1) << "Error in CheckSumG0G1";
SetInvariantChecked(true);
}
@@ -132,7 +133,7 @@ static void TestRW(TestContext *cxt, int c) {
} else {
for (int i = 0; i != cxt->iterations; i++) {
absl::ReaderMutexLock l(&cxt->mu);
- ABSL_RAW_CHECK(cxt->g0 == -cxt->g1, "Error in TestRW");
+ CHECK_EQ(cxt->g0, -cxt->g1) << "Error in TestRW";
cxt->mu.AssertReaderHeld();
}
}
@@ -157,7 +158,7 @@ static void TestAwait(TestContext *cxt, int c) {
cxt->mu.AssertHeld();
while (cxt->g0 < cxt->iterations) {
cxt->mu.Await(absl::Condition(&mc, &MyContext::MyTurn));
- ABSL_RAW_CHECK(mc.MyTurn(), "Error in TestAwait");
+ CHECK(mc.MyTurn()) << "Error in TestAwait";
cxt->mu.AssertHeld();
if (cxt->g0 < cxt->iterations) {
int a = cxt->g0 + 1;
@@ -185,7 +186,7 @@ static void TestSignalAll(TestContext *cxt, int c) {
}
static void TestSignal(TestContext *cxt, int c) {
- ABSL_RAW_CHECK(cxt->threads == 2, "TestSignal should use 2 threads");
+ CHECK_EQ(cxt->threads, 2) << "TestSignal should use 2 threads";
int target = c;
absl::MutexLock l(&cxt->mu);
cxt->mu.AssertHeld();
@@ -222,8 +223,8 @@ static void TestCVTimeout(TestContext *cxt, int c) {
static bool G0GE2(TestContext *cxt) { return cxt->g0 >= 2; }
static void TestTime(TestContext *cxt, int c, bool use_cv) {
- ABSL_RAW_CHECK(cxt->iterations == 1, "TestTime should only use 1 iteration");
- ABSL_RAW_CHECK(cxt->threads > 2, "TestTime should use more than 2 threads");
+ CHECK_EQ(cxt->iterations, 1) << "TestTime should only use 1 iteration";
+ CHECK_GT(cxt->threads, 2) << "TestTime should use more than 2 threads";
const bool kFalse = false;
absl::Condition false_cond(&kFalse);
absl::Condition g0ge2(G0GE2, cxt);
@@ -234,26 +235,24 @@ static void TestTime(TestContext *cxt, int c, bool use_cv) {
if (use_cv) {
cxt->cv.WaitWithTimeout(&cxt->mu, absl::Seconds(1));
} else {
- ABSL_RAW_CHECK(!cxt->mu.AwaitWithTimeout(false_cond, absl::Seconds(1)),
- "TestTime failed");
+ CHECK(!cxt->mu.AwaitWithTimeout(false_cond, absl::Seconds(1)))
+ << "TestTime failed";
}
absl::Duration elapsed = absl::Now() - start;
- ABSL_RAW_CHECK(
- absl::Seconds(0.9) <= elapsed && elapsed <= absl::Seconds(2.0),
- "TestTime failed");
- ABSL_RAW_CHECK(cxt->g0 == 1, "TestTime failed");
+ CHECK(absl::Seconds(0.9) <= elapsed && elapsed <= absl::Seconds(2.0))
+ << "TestTime failed";
+ CHECK_EQ(cxt->g0, 1) << "TestTime failed";
start = absl::Now();
if (use_cv) {
cxt->cv.WaitWithTimeout(&cxt->mu, absl::Seconds(1));
} else {
- ABSL_RAW_CHECK(!cxt->mu.AwaitWithTimeout(false_cond, absl::Seconds(1)),
- "TestTime failed");
+ CHECK(!cxt->mu.AwaitWithTimeout(false_cond, absl::Seconds(1)))
+ << "TestTime failed";
}
elapsed = absl::Now() - start;
- ABSL_RAW_CHECK(
- absl::Seconds(0.9) <= elapsed && elapsed <= absl::Seconds(2.0),
- "TestTime failed");
+ CHECK(absl::Seconds(0.9) <= elapsed && elapsed <= absl::Seconds(2.0))
+ << "TestTime failed";
cxt->g0++;
if (use_cv) {
cxt->cv.Signal();
@@ -263,26 +262,24 @@ static void TestTime(TestContext *cxt, int c, bool use_cv) {
if (use_cv) {
cxt->cv.WaitWithTimeout(&cxt->mu, absl::Seconds(4));
} else {
- ABSL_RAW_CHECK(!cxt->mu.AwaitWithTimeout(false_cond, absl::Seconds(4)),
- "TestTime failed");
+ CHECK(!cxt->mu.AwaitWithTimeout(false_cond, absl::Seconds(4)))
+ << "TestTime failed";
}
elapsed = absl::Now() - start;
- ABSL_RAW_CHECK(
- absl::Seconds(3.9) <= elapsed && elapsed <= absl::Seconds(6.0),
- "TestTime failed");
- ABSL_RAW_CHECK(cxt->g0 >= 3, "TestTime failed");
+ CHECK(absl::Seconds(3.9) <= elapsed && elapsed <= absl::Seconds(6.0))
+ << "TestTime failed";
+ CHECK_GE(cxt->g0, 3) << "TestTime failed";
start = absl::Now();
if (use_cv) {
cxt->cv.WaitWithTimeout(&cxt->mu, absl::Seconds(1));
} else {
- ABSL_RAW_CHECK(!cxt->mu.AwaitWithTimeout(false_cond, absl::Seconds(1)),
- "TestTime failed");
+ CHECK(!cxt->mu.AwaitWithTimeout(false_cond, absl::Seconds(1)))
+ << "TestTime failed";
}
elapsed = absl::Now() - start;
- ABSL_RAW_CHECK(
- absl::Seconds(0.9) <= elapsed && elapsed <= absl::Seconds(2.0),
- "TestTime failed");
+ CHECK(absl::Seconds(0.9) <= elapsed && elapsed <= absl::Seconds(2.0))
+ << "TestTime failed";
if (use_cv) {
cxt->cv.SignalAll();
}
@@ -291,14 +288,13 @@ static void TestTime(TestContext *cxt, int c, bool use_cv) {
if (use_cv) {
cxt->cv.WaitWithTimeout(&cxt->mu, absl::Seconds(1));
} else {
- ABSL_RAW_CHECK(!cxt->mu.AwaitWithTimeout(false_cond, absl::Seconds(1)),
- "TestTime failed");
+ CHECK(!cxt->mu.AwaitWithTimeout(false_cond, absl::Seconds(1)))
+ << "TestTime failed";
}
elapsed = absl::Now() - start;
- ABSL_RAW_CHECK(
- absl::Seconds(0.9) <= elapsed && elapsed <= absl::Seconds(2.0),
- "TestTime failed");
- ABSL_RAW_CHECK(cxt->g0 == cxt->threads, "TestTime failed");
+ CHECK(absl::Seconds(0.9) <= elapsed && elapsed <= absl::Seconds(2.0))
+ << "TestTime failed";
+ CHECK_EQ(cxt->g0, cxt->threads) << "TestTime failed";
} else if (c == 1) {
absl::MutexLock l(&cxt->mu);
@@ -306,14 +302,12 @@ static void TestTime(TestContext *cxt, int c, bool use_cv) {
if (use_cv) {
cxt->cv.WaitWithTimeout(&cxt->mu, absl::Milliseconds(500));
} else {
- ABSL_RAW_CHECK(
- !cxt->mu.AwaitWithTimeout(false_cond, absl::Milliseconds(500)),
- "TestTime failed");
+ CHECK(!cxt->mu.AwaitWithTimeout(false_cond, absl::Milliseconds(500)))
+ << "TestTime failed";
}
const absl::Duration elapsed = absl::Now() - start;
- ABSL_RAW_CHECK(
- absl::Seconds(0.4) <= elapsed && elapsed <= absl::Seconds(0.9),
- "TestTime failed");
+ CHECK(absl::Seconds(0.4) <= elapsed && elapsed <= absl::Seconds(0.9))
+ << "TestTime failed";
cxt->g0++;
} else if (c == 2) {
absl::MutexLock l(&cxt->mu);
@@ -322,8 +316,8 @@ static void TestTime(TestContext *cxt, int c, bool use_cv) {
cxt->cv.WaitWithTimeout(&cxt->mu, absl::Seconds(100));
}
} else {
- ABSL_RAW_CHECK(cxt->mu.AwaitWithTimeout(g0ge2, absl::Seconds(100)),
- "TestTime failed");
+ CHECK(cxt->mu.AwaitWithTimeout(g0ge2, absl::Seconds(100)))
+ << "TestTime failed";
}
cxt->g0++;
} else {
@@ -400,7 +394,7 @@ static int RunTestWithInvariantDebugging(void (*test)(TestContext *cxt, int),
TestContext cxt;
cxt.mu.EnableInvariantDebugging(invariant, &cxt);
int ret = RunTestCommon(&cxt, test, threads, iterations, operations);
- ABSL_RAW_CHECK(GetInvariantChecked(), "Invariant not checked");
+ CHECK(GetInvariantChecked()) << "Invariant not checked";
absl::EnableMutexInvariantDebugging(false); // Restore.
return ret;
}
@@ -1093,7 +1087,7 @@ static bool ConditionWithAcquire(AcquireFromConditionStruct *x) {
absl::Milliseconds(100));
x->mu1.Unlock();
}
- ABSL_RAW_CHECK(x->value < 4, "should not be invoked a fourth time");
+ CHECK_LT(x->value, 4) << "should not be invoked a fourth time";
// We arrange for the condition to return true on only the 2nd and 3rd calls.
return x->value == 2 || x->value == 3;
@@ -1340,11 +1334,9 @@ static bool DelayIsWithinBounds(absl::Duration expected_delay,
// different clock than absl::Now(), but these cases should be handled by the
// the retry mechanism in each TimeoutTest.
if (actual_delay < expected_delay) {
- ABSL_RAW_LOG(WARNING,
- "Actual delay %s was too short, expected %s (difference %s)",
- absl::FormatDuration(actual_delay).c_str(),
- absl::FormatDuration(expected_delay).c_str(),
- absl::FormatDuration(actual_delay - expected_delay).c_str());
+ LOG(WARNING) << "Actual delay " << actual_delay
+ << " was too short, expected " << expected_delay
+ << " (difference " << actual_delay - expected_delay << ")";
pass = false;
}
// If the expected delay is <= zero then allow a small error tolerance, since
@@ -1355,11 +1347,9 @@ static bool DelayIsWithinBounds(absl::Duration expected_delay,
? absl::Milliseconds(10)
: TimeoutTestAllowedSchedulingDelay();
if (actual_delay > expected_delay + tolerance) {
- ABSL_RAW_LOG(WARNING,
- "Actual delay %s was too long, expected %s (difference %s)",
- absl::FormatDuration(actual_delay).c_str(),
- absl::FormatDuration(expected_delay).c_str(),
- absl::FormatDuration(actual_delay - expected_delay).c_str());
+ LOG(WARNING) << "Actual delay " << actual_delay
+ << " was too long, expected " << expected_delay
+ << " (difference " << actual_delay - expected_delay << ")";
pass = false;
}
return pass;
@@ -1409,12 +1399,6 @@ std::ostream &operator<<(std::ostream &os, const TimeoutTestParam &param) {
<< " expected_delay: " << param.expected_delay;
}
-std::string FormatString(const TimeoutTestParam &param) {
- std::ostringstream os;
- os << param;
- return os.str();
-}
-
// Like `thread::Executor::ScheduleAt` except:
// a) Delays zero or negative are executed immediately in the current thread.
// b) Infinite delays are never scheduled.
@@ -1544,13 +1528,13 @@ INSTANTIATE_TEST_SUITE_P(All, TimeoutTest,
TEST_P(TimeoutTest, Await) {
const TimeoutTestParam params = GetParam();
- ABSL_RAW_LOG(INFO, "Params: %s", FormatString(params).c_str());
+ LOG(INFO) << "Params: " << params;
// Because this test asserts bounds on scheduling delays it is flaky. To
// compensate it loops forever until it passes. Failures express as test
// timeouts, in which case the test log can be used to diagnose the issue.
for (int attempt = 1;; ++attempt) {
- ABSL_RAW_LOG(INFO, "Attempt %d", attempt);
+ LOG(INFO) << "Attempt " << attempt;
absl::Mutex mu;
bool value = false; // condition value (under mu)
@@ -1578,13 +1562,13 @@ TEST_P(TimeoutTest, Await) {
TEST_P(TimeoutTest, LockWhen) {
const TimeoutTestParam params = GetParam();
- ABSL_RAW_LOG(INFO, "Params: %s", FormatString(params).c_str());
+ LOG(INFO) << "Params: " << params;
// Because this test asserts bounds on scheduling delays it is flaky. To
// compensate it loops forever until it passes. Failures express as test
// timeouts, in which case the test log can be used to diagnose the issue.
for (int attempt = 1;; ++attempt) {
- ABSL_RAW_LOG(INFO, "Attempt %d", attempt);
+ LOG(INFO) << "Attempt " << attempt;
absl::Mutex mu;
bool value = false; // condition value (under mu)
@@ -1613,13 +1597,13 @@ TEST_P(TimeoutTest, LockWhen) {
TEST_P(TimeoutTest, ReaderLockWhen) {
const TimeoutTestParam params = GetParam();
- ABSL_RAW_LOG(INFO, "Params: %s", FormatString(params).c_str());
+ LOG(INFO) << "Params: " << params;
// Because this test asserts bounds on scheduling delays it is flaky. To
// compensate it loops forever until it passes. Failures express as test
// timeouts, in which case the test log can be used to diagnose the issue.
for (int attempt = 0;; ++attempt) {
- ABSL_RAW_LOG(INFO, "Attempt %d", attempt);
+ LOG(INFO) << "Attempt " << attempt;
absl::Mutex mu;
bool value = false; // condition value (under mu)
@@ -1649,13 +1633,13 @@ TEST_P(TimeoutTest, ReaderLockWhen) {
TEST_P(TimeoutTest, Wait) {
const TimeoutTestParam params = GetParam();
- ABSL_RAW_LOG(INFO, "Params: %s", FormatString(params).c_str());
+ LOG(INFO) << "Params: " << params;
// Because this test asserts bounds on scheduling delays it is flaky. To
// compensate it loops forever until it passes. Failures express as test
// timeouts, in which case the test log can be used to diagnose the issue.
for (int attempt = 0;; ++attempt) {
- ABSL_RAW_LOG(INFO, "Attempt %d", attempt);
+ LOG(INFO) << "Attempt " << attempt;
absl::Mutex mu;
bool value = false; // condition value (under mu)
diff --git a/absl/types/BUILD.bazel b/absl/types/BUILD.bazel
index bb801012..b57d3b9b 100644
--- a/absl/types/BUILD.bazel
+++ b/absl/types/BUILD.bazel
@@ -77,8 +77,8 @@ cc_test(
":any",
"//absl/base:config",
"//absl/base:exception_testing",
- "//absl/base:raw_logging_internal",
"//absl/container:test_instance_tracker",
+ "//absl/log",
"@com_google_googletest//:gtest_main",
],
)
@@ -185,7 +185,7 @@ cc_test(
deps = [
":optional",
"//absl/base:config",
- "//absl/base:raw_logging_internal",
+ "//absl/log",
"//absl/meta:type_traits",
"//absl/strings",
"@com_google_googletest//:gtest_main",
diff --git a/absl/types/CMakeLists.txt b/absl/types/CMakeLists.txt
index 830953ae..c0dcee79 100644
--- a/absl/types/CMakeLists.txt
+++ b/absl/types/CMakeLists.txt
@@ -68,7 +68,7 @@ absl_cc_test(
absl::any
absl::config
absl::exception_testing
- absl::raw_logging_internal
+ absl::log
absl::test_instance_tracker
GTest::gmock_main
)
@@ -220,7 +220,7 @@ absl_cc_test(
DEPS
absl::optional
absl::config
- absl::raw_logging_internal
+ absl::log
absl::strings
absl::type_traits
GTest::gmock_main
diff --git a/absl/types/any_test.cc b/absl/types/any_test.cc
index d382b927..666ea5b6 100644
--- a/absl/types/any_test.cc
+++ b/absl/types/any_test.cc
@@ -25,8 +25,8 @@
#include "gtest/gtest.h"
#include "absl/base/config.h"
#include "absl/base/internal/exception_testing.h"
-#include "absl/base/internal/raw_logging.h"
#include "absl/container/internal/test_instance_tracker.h"
+#include "absl/log/log.h"
namespace {
using absl::test_internal::CopyableOnlyInstance;
@@ -704,7 +704,7 @@ struct BadCopyable {
#ifdef ABSL_HAVE_EXCEPTIONS
throw BadCopy();
#else
- ABSL_RAW_LOG(FATAL, "Bad copy");
+ LOG(FATAL) << "Bad copy";
#endif
}
};
diff --git a/absl/types/optional_test.cc b/absl/types/optional_test.cc
index bd5fe082..5da297b0 100644
--- a/absl/types/optional_test.cc
+++ b/absl/types/optional_test.cc
@@ -23,7 +23,7 @@
#include "gtest/gtest.h"
#include "absl/base/config.h"
-#include "absl/base/internal/raw_logging.h"
+#include "absl/log/log.h"
#include "absl/meta/type_traits.h"
#include "absl/strings/string_view.h"
@@ -1542,8 +1542,7 @@ TEST(optionalTest, Hash) {
struct MoveMeNoThrow {
MoveMeNoThrow() : x(0) {}
[[noreturn]] MoveMeNoThrow(const MoveMeNoThrow& other) : x(other.x) {
- ABSL_RAW_LOG(FATAL, "Should not be called.");
- abort();
+ LOG(FATAL) << "Should not be called.";
}
MoveMeNoThrow(MoveMeNoThrow&& other) noexcept : x(other.x) {}
int x;