|
|
@ -19,9 +19,11 @@ |
|
|
|
#include <iostream> |
|
|
|
#include <iostream> |
|
|
|
#include <string> |
|
|
|
#include <string> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include "absl/base/attributes.h" |
|
|
|
#include "absl/base/config.h" |
|
|
|
#include "absl/base/config.h" |
|
|
|
#include "absl/log/internal/config.h" |
|
|
|
#include "absl/log/internal/config.h" |
|
|
|
#include "absl/strings/escaping.h" |
|
|
|
#include "absl/strings/escaping.h" |
|
|
|
|
|
|
|
#include "absl/strings/str_cat.h" |
|
|
|
#include "absl/strings/string_view.h" |
|
|
|
#include "absl/strings/string_view.h" |
|
|
|
#include "absl/time/time.h" |
|
|
|
#include "absl/time/time.h" |
|
|
|
|
|
|
|
|
|
|
@ -30,37 +32,38 @@ ABSL_NAMESPACE_BEGIN |
|
|
|
namespace log_internal { |
|
|
|
namespace log_internal { |
|
|
|
|
|
|
|
|
|
|
|
void WriteToStderrWithFilename::operator()(const absl::LogEntry& entry) const { |
|
|
|
void WriteToStderrWithFilename::operator()(const absl::LogEntry& entry) const { |
|
|
|
std::cerr << message << " (file: " << entry.source_filename() << ")" |
|
|
|
std::cerr << message << " (file: " << entry.source_filename() << ")\n"; |
|
|
|
<< std::endl; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WriteEntryToStderr::operator()(const absl::LogEntry& entry) const { |
|
|
|
void WriteEntryToStderr::operator()(const absl::LogEntry& entry) const { |
|
|
|
if (!message.empty()) std::cerr << message << std::endl; |
|
|
|
if (!message.empty()) std::cerr << message << "\n"; |
|
|
|
|
|
|
|
|
|
|
|
std::cerr << "LogEntry{\n" |
|
|
|
const std::string source_filename = absl::CHexEscape(entry.source_filename()); |
|
|
|
<< " source_filename: \"" |
|
|
|
const std::string source_basename = absl::CHexEscape(entry.source_basename()); |
|
|
|
<< absl::CHexEscape(entry.source_filename()) << "\"\n" |
|
|
|
const std::string text_message = absl::CHexEscape(entry.text_message()); |
|
|
|
<< " source_basename: \"" |
|
|
|
std::cerr << "LogEntry{\n" //
|
|
|
|
<< absl::CHexEscape(entry.source_basename()) << "\"\n" |
|
|
|
<< " source_filename: \"" << source_filename << "\"\n" //
|
|
|
|
<< " source_line: " << entry.source_line() << "\n" |
|
|
|
<< " source_basename: \"" << source_basename << "\"\n" //
|
|
|
|
<< " prefix: " << (entry.prefix() ? "true\n" : "false\n") |
|
|
|
<< " source_line: " << entry.source_line() << "\n" //
|
|
|
|
<< " log_severity: " << entry.log_severity() << "\n" |
|
|
|
<< " prefix: " << (entry.prefix() ? "true\n" : "false\n") //
|
|
|
|
<< " timestamp: " << entry.timestamp() << "\n" |
|
|
|
<< " log_severity: " << entry.log_severity() << "\n" //
|
|
|
|
<< " text_message: \"" << absl::CHexEscape(entry.text_message()) |
|
|
|
<< " timestamp: " << entry.timestamp() << "\n" //
|
|
|
|
<< "\"\n verbosity: " << entry.verbosity() << "\n" |
|
|
|
<< " text_message: \"" << text_message << "\"\n" //
|
|
|
|
<< "}" << std::endl; |
|
|
|
<< " verbosity: " << entry.verbosity() << "\n" //
|
|
|
|
|
|
|
|
<< "}\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void WriteEntryToStderr::operator()(absl::LogSeverity severity, |
|
|
|
void WriteEntryToStderr::operator()(absl::LogSeverity severity, |
|
|
|
absl::string_view filename, |
|
|
|
absl::string_view filename, |
|
|
|
absl::string_view log_message) const { |
|
|
|
absl::string_view log_message) const { |
|
|
|
if (!message.empty()) std::cerr << message << std::endl; |
|
|
|
if (!message.empty()) std::cerr << message << "\n"; |
|
|
|
|
|
|
|
const std::string source_filename = absl::CHexEscape(filename); |
|
|
|
std::cerr << "LogEntry{\n" |
|
|
|
const std::string text_message = absl::CHexEscape(log_message); |
|
|
|
<< " source_filename: \"" << absl::CHexEscape(filename) << "\"\n" |
|
|
|
std::cerr << "LogEntry{\n" //
|
|
|
|
<< " log_severity: " << severity << "\n" |
|
|
|
<< " source_filename: \"" << source_filename << "\"\n" //
|
|
|
|
<< " text_message: \"" << absl::CHexEscape(log_message) << "}" |
|
|
|
<< " log_severity: " << severity << "\n" //
|
|
|
|
<< std::endl; |
|
|
|
<< " text_message: \"" << text_message << "\"\n" //
|
|
|
|
|
|
|
|
<< "}\n"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} // namespace log_internal
|
|
|
|
} // namespace log_internal
|
|
|
|