diff options
Diffstat (limited to 'absl/log/internal')
-rw-r--r-- | absl/log/internal/BUILD.bazel | 3 | ||||
-rw-r--r-- | absl/log/internal/log_message.cc | 27 | ||||
-rw-r--r-- | absl/log/internal/log_message.h | 18 | ||||
-rw-r--r-- | absl/log/internal/test_actions.cc | 4 | ||||
-rw-r--r-- | absl/log/internal/test_matchers.cc | 1 | ||||
-rw-r--r-- | absl/log/internal/test_matchers.h | 1 |
6 files changed, 26 insertions, 28 deletions
diff --git a/absl/log/internal/BUILD.bazel b/absl/log/internal/BUILD.bazel index b4eb1df1..4f600753 100644 --- a/absl/log/internal/BUILD.bazel +++ b/absl/log/internal/BUILD.bazel @@ -134,7 +134,6 @@ cc_library( ], deps = [ ":append_truncated", - ":config", ":format", ":globals", ":log_sink_set", @@ -241,7 +240,6 @@ cc_library( copts = ABSL_DEFAULT_COPTS, linkopts = ABSL_DEFAULT_LINKOPTS, deps = [ - ":config", "//absl/base:config", "//absl/base:core_headers", "//absl/base:log_severity", @@ -276,7 +274,6 @@ cc_library( copts = ABSL_DEFAULT_COPTS, linkopts = ABSL_DEFAULT_LINKOPTS, deps = [ - ":config", ":test_helpers", "//absl/base:config", "//absl/base:core_headers", diff --git a/absl/log/internal/log_message.cc b/absl/log/internal/log_message.cc index 648086e9..8329597e 100644 --- a/absl/log/internal/log_message.cc +++ b/absl/log/internal/log_message.cc @@ -42,7 +42,6 @@ #include "absl/debugging/internal/examine_stack.h" #include "absl/log/globals.h" #include "absl/log/internal/append_truncated.h" -#include "absl/log/internal/config.h" #include "absl/log/internal/globals.h" #include "absl/log/internal/log_format.h" #include "absl/log/internal/log_sink_set.h" @@ -87,8 +86,8 @@ void WriteToStream(const char* data, void* os) { // A write-only `std::streambuf` that writes into an `absl::Span<char>`. // -// This class is responsible for writing a metadata prefix just before the first -// data are streamed in. The metadata are subject to change (cf. +// This class is responsible for writing a metadata prefix just before the +// first data are streamed in. The metadata are subject to change (cf. // `LogMessage::AtLocation`) until then, so we wait as long as possible. // // This class is also responsible for reserving space for a trailing newline @@ -96,7 +95,8 @@ void WriteToStream(const char* data, void* os) { // streamed in. class LogEntryStreambuf final : public std::streambuf { public: - explicit LogEntryStreambuf(absl::Span<char> buf, const absl::LogEntry& entry) + explicit LogEntryStreambuf(absl::Span<char> buf, + const absl::LogEntry& entry) : buf_(buf), entry_(entry), prefix_len_(0), finalized_(false) { // To detect when data are first written, we leave the put area null, // override `overflow`, and check ourselves in `xsputn`. @@ -107,7 +107,8 @@ class LogEntryStreambuf final : public std::streambuf { absl::Span<const char> Finalize() { assert(!finalized_); - // If no data were ever streamed in, this is where we must write the prefix. + // If no data were ever streamed in, this is where we must write the + // prefix. if (pbase() == nullptr) Initialize(); // Here we reclaim the two bytes we reserved. ptrdiff_t idx = pptr() - pbase(); @@ -140,8 +141,8 @@ class LogEntryStreambuf final : public std::streambuf { private: void Initialize() { - // Here we reserve two bytes in our buffer to guarantee `Finalize` space to - // add a trailing "\n\0". + // Here we reserve two bytes in our buffer to guarantee `Finalize` space + // to add a trailing "\n\0". assert(buf_.size() >= 2); setp(buf_.data(), buf_.data() + buf_.size() - 2); if (entry_.prefix()) { @@ -157,7 +158,8 @@ class LogEntryStreambuf final : public std::streambuf { } size_t Append(absl::string_view data) { - absl::Span<char> remaining(pptr(), static_cast<size_t>(epptr() - pptr())); + absl::Span<char> remaining(pptr(), + static_cast<size_t>(epptr() - pptr())); const size_t written = log_internal::AppendTruncated(data, remaining); pbump(static_cast<int>(written)); return written; @@ -202,7 +204,7 @@ LogMessage::LogMessageData::LogMessageData(const char* file, int line, absl::LogSeverity severity, absl::Time timestamp) : extra_sinks_only(false), - streambuf_(absl::MakeSpan(string_buf), entry) { + streambuf_(absl::MakeSpan(string_buf), entry) { entry.full_filename_ = file; entry.base_filename_ = Basename(file); entry.line_ = line; @@ -216,8 +218,7 @@ LogMessage::LogMessageData::LogMessageData(const char* file, int line, LogMessage::LogMessage(const char* file, int line, absl::LogSeverity severity) : data_( absl::make_unique<LogMessageData>(file, line, severity, absl::Now())) - , - stream_(&data_->streambuf_) +, stream_(&data_->streambuf_) { data_->first_fatal = false; data_->is_perror = false; @@ -225,8 +226,8 @@ LogMessage::LogMessage(const char* file, int line, absl::LogSeverity severity) // Legacy defaults for LOG's ostream: stream_.setf(std::ios_base::showbase | std::ios_base::boolalpha); - // `fill('0')` is omitted here because its effects are very different without - // structured logging. Resolution is tracked in b/111310488. + // `fill('0')` is omitted here because its effects are very different + // without structured logging. Resolution is tracked in b/111310488. // This logs a backtrace even if the location is subsequently changed using // AtLocation. This quirk, and the behavior when AtLocation is called twice, diff --git a/absl/log/internal/log_message.h b/absl/log/internal/log_message.h index 992bb630..8868f8c8 100644 --- a/absl/log/internal/log_message.h +++ b/absl/log/internal/log_message.h @@ -37,7 +37,6 @@ #include "absl/base/config.h" #include "absl/base/internal/errno_saver.h" #include "absl/base/log_severity.h" -#include "absl/log/internal/config.h" #include "absl/log/internal/nullguard.h" #include "absl/log/log_entry.h" #include "absl/log/log_sink.h" @@ -234,9 +233,10 @@ class StringifySink final { }; // Note: the following is declared `ABSL_ATTRIBUTE_NOINLINE` -template <typename T, - typename std::enable_if<strings_internal::HasAbslStringify<T>::value, - int>::type> +template < + typename T, + typename std::enable_if<strings_internal::HasAbslStringify<T>::value, + int>::type> LogMessage& LogMessage::operator<<(const T& v) { StringifySink sink(*this); // Replace with public API. @@ -245,9 +245,10 @@ LogMessage& LogMessage::operator<<(const T& v) { } // Note: the following is declared `ABSL_ATTRIBUTE_NOINLINE` -template <typename T, - typename std::enable_if<!strings_internal::HasAbslStringify<T>::value, - int>::type> +template < + typename T, + typename std::enable_if<!strings_internal::HasAbslStringify<T>::value, + int>::type> LogMessage& LogMessage::operator<<(const T& v) { stream_ << log_internal::NullGuard<T>().Guard(v); return *this; @@ -299,7 +300,8 @@ extern template LogMessage& LogMessage::operator<<(const float& v); extern template LogMessage& LogMessage::operator<<(const double& v); extern template LogMessage& LogMessage::operator<<(const bool& v); extern template LogMessage& LogMessage::operator<<(const std::string& v); -extern template LogMessage& LogMessage::operator<<(const absl::string_view& v); +extern template LogMessage& LogMessage::operator<<( + const absl::string_view& v); // `LogMessageFatal` ensures the process will exit in failure after logging this // message. diff --git a/absl/log/internal/test_actions.cc b/absl/log/internal/test_actions.cc index c0d04e18..6c8a7b13 100644 --- a/absl/log/internal/test_actions.cc +++ b/absl/log/internal/test_actions.cc @@ -21,7 +21,6 @@ #include "absl/base/attributes.h" #include "absl/base/config.h" -#include "absl/log/internal/config.h" #include "absl/strings/escaping.h" #include "absl/strings/str_cat.h" #include "absl/strings/string_view.h" @@ -49,7 +48,8 @@ void WriteEntryToStderr::operator()(const absl::LogEntry& entry) const { << " log_severity: " << entry.log_severity() << "\n" // << " timestamp: " << entry.timestamp() << "\n" // << " text_message: \"" << text_message << "\"\n" // - << " verbosity: " << entry.verbosity() << "\n" // + << " verbosity: " << entry.verbosity() + << "\n" // << "}\n"; } diff --git a/absl/log/internal/test_matchers.cc b/absl/log/internal/test_matchers.cc index 10f4111f..72ca704e 100644 --- a/absl/log/internal/test_matchers.cc +++ b/absl/log/internal/test_matchers.cc @@ -24,7 +24,6 @@ #include "gtest/gtest.h" #include "absl/base/attributes.h" #include "absl/base/config.h" -#include "absl/log/internal/config.h" #include "absl/log/internal/test_helpers.h" #include "absl/strings/string_view.h" #include "absl/time/clock.h" diff --git a/absl/log/internal/test_matchers.h b/absl/log/internal/test_matchers.h index b8179ccc..98cb33d3 100644 --- a/absl/log/internal/test_matchers.h +++ b/absl/log/internal/test_matchers.h @@ -30,7 +30,6 @@ #include "gtest/gtest.h" #include "absl/base/config.h" #include "absl/base/log_severity.h" -#include "absl/log/internal/config.h" #include "absl/log/internal/test_helpers.h" #include "absl/log/log_entry.h" #include "absl/strings/string_view.h" |