Use ABSL_LOG in MediaPipe.
This is needed in Chrome builds to avoid collisions with its own LOG. PiperOrigin-RevId: 561436864
This commit is contained in:
committed by
Copybara-Service
parent
f60da2120d
commit
c92570f844
@@ -66,10 +66,12 @@ cc_library(
|
||||
deps = [
|
||||
"//mediapipe/framework:calculator_cc_proto",
|
||||
"//mediapipe/framework/port:advanced_proto",
|
||||
"//mediapipe/framework/port:logging",
|
||||
"//mediapipe/framework/port:ret_check",
|
||||
"//mediapipe/framework/port:status",
|
||||
"@com_google_absl//absl/flags:flag",
|
||||
"@com_google_absl//absl/flags:parse",
|
||||
"@com_google_absl//absl/log:absl_log",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -403,6 +405,7 @@ cc_library(
|
||||
"//mediapipe/framework/port:source_location",
|
||||
"//mediapipe/framework/port:status",
|
||||
"@com_google_absl//absl/base:core_headers",
|
||||
"@com_google_absl//absl/log:absl_log",
|
||||
"@com_google_absl//absl/log:check",
|
||||
"@com_google_absl//absl/status",
|
||||
"@com_google_absl//absl/strings",
|
||||
@@ -509,6 +512,8 @@ cc_library(
|
||||
"//mediapipe/framework/port:numbers",
|
||||
"//mediapipe/framework/port:ret_check",
|
||||
"//mediapipe/framework/port:status",
|
||||
"@com_google_absl//absl/log:absl_log",
|
||||
"@com_google_absl//absl/log:check",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
@@ -529,12 +534,12 @@ cc_library(
|
||||
"//mediapipe/framework/deps:proto_descriptor_cc_proto",
|
||||
"//mediapipe/framework/port:advanced_proto",
|
||||
"//mediapipe/framework/port:integral_types",
|
||||
"//mediapipe/framework/port:logging",
|
||||
"//mediapipe/framework/port:map_util",
|
||||
"//mediapipe/framework/port:ret_check",
|
||||
"//mediapipe/framework/port:status",
|
||||
"@com_google_absl//absl/base:core_headers",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/log:absl_log",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
@@ -630,6 +635,7 @@ cc_test(
|
||||
":tag_map_helper",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"//mediapipe/framework/port:map_util",
|
||||
"@com_google_absl//absl/log:absl_log",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
@@ -787,11 +793,12 @@ cc_library(
|
||||
"//mediapipe/framework/formats:image_frame",
|
||||
"//mediapipe/framework/port:advanced_proto",
|
||||
"//mediapipe/framework/port:file_helpers",
|
||||
"//mediapipe/framework/port:logging",
|
||||
"//mediapipe/framework/port:ret_check",
|
||||
"//mediapipe/framework/port:status",
|
||||
"@com_google_absl//absl/cleanup",
|
||||
"@com_google_absl//absl/container:flat_hash_set",
|
||||
"@com_google_absl//absl/log:absl_log",
|
||||
"@com_google_absl//absl/log:check",
|
||||
"@com_google_absl//absl/memory",
|
||||
"@com_google_absl//absl/status",
|
||||
"@com_google_absl//absl/status:statusor",
|
||||
@@ -945,11 +952,11 @@ cc_test(
|
||||
"//mediapipe/framework:subgraph",
|
||||
"//mediapipe/framework:test_calculators",
|
||||
"//mediapipe/framework/port:gtest_main",
|
||||
"//mediapipe/framework/port:logging",
|
||||
"//mediapipe/framework/port:parse_text_proto",
|
||||
"//mediapipe/framework/port:ret_check",
|
||||
"//mediapipe/framework/port:status",
|
||||
"//mediapipe/framework/stream_handler:immediate_input_stream_handler",
|
||||
"@com_google_absl//absl/log:absl_log",
|
||||
"@com_google_absl//absl/strings",
|
||||
],
|
||||
)
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/log/absl_log.h"
|
||||
#include "absl/log/check.h"
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
@@ -166,7 +167,7 @@ void AddCallbackCalculator(const std::string& stream_name,
|
||||
sink_node->add_input_side_packet(
|
||||
absl::StrCat("CALLBACK:", input_side_packet_name));
|
||||
} else {
|
||||
LOG(FATAL) << "AddCallbackCalculator must use std::function";
|
||||
ABSL_LOG(FATAL) << "AddCallbackCalculator must use std::function";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -241,7 +242,7 @@ void AddCallbackWithHeaderCalculator(const std::string& stream_name,
|
||||
sink_node->add_input_side_packet(
|
||||
absl::StrCat("CALLBACK:", input_side_packet_name));
|
||||
} else {
|
||||
LOG(FATAL) << "AddCallbackWithHeaderCalculator must use std::function";
|
||||
ABSL_LOG(FATAL) << "AddCallbackWithHeaderCalculator must use std::function";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -290,7 +291,7 @@ absl::Status CallbackCalculator::Open(CalculatorContext* cc) {
|
||||
.Tag("VECTOR_CALLBACK")
|
||||
.Get<std::function<void(const std::vector<Packet>&)>>();
|
||||
} else {
|
||||
LOG(FATAL) << "InputSidePackets must use tags.";
|
||||
ABSL_LOG(FATAL) << "InputSidePackets must use tags.";
|
||||
}
|
||||
if (callback_ == nullptr && vector_callback_ == nullptr) {
|
||||
return mediapipe::InvalidArgumentErrorBuilder(MEDIAPIPE_LOC)
|
||||
@@ -347,7 +348,7 @@ absl::Status CallbackWithHeaderCalculator::Open(CalculatorContext* cc) {
|
||||
.Tag("CALLBACK")
|
||||
.Get<std::function<void(const Packet&, const Packet&)>>();
|
||||
} else {
|
||||
LOG(FATAL) << "InputSidePackets must use tags.";
|
||||
ABSL_LOG(FATAL) << "InputSidePackets must use tags.";
|
||||
}
|
||||
if (callback_ == nullptr) {
|
||||
return mediapipe::InvalidArgumentErrorBuilder(MEDIAPIPE_LOC)
|
||||
|
||||
@@ -17,13 +17,13 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/log/absl_log.h"
|
||||
#include "absl/strings/str_replace.h"
|
||||
#include "absl/strings/string_view.h"
|
||||
#include "mediapipe/framework/calculator.pb.h"
|
||||
#include "mediapipe/framework/calculator_framework.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
#include "mediapipe/framework/port/gtest.h"
|
||||
#include "mediapipe/framework/port/logging.h"
|
||||
#include "mediapipe/framework/port/parse_text_proto.h"
|
||||
#include "mediapipe/framework/port/proto_ns.h"
|
||||
#include "mediapipe/framework/port/ret_check.h"
|
||||
@@ -385,7 +385,7 @@ TEST(SwitchContainerTest, RunsWithInputStreamHandler) {
|
||||
CalculatorGraphConfig supergraph =
|
||||
SubnodeContainerExample(R"pb(synchronize_io: true)pb");
|
||||
MP_EXPECT_OK(tool::ExpandSubgraphs(&supergraph));
|
||||
LOG(INFO) << supergraph.DebugString();
|
||||
ABSL_LOG(INFO) << supergraph.DebugString();
|
||||
RunTestContainer(supergraph, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
|
||||
#include "mediapipe/framework/tool/tag_map.h"
|
||||
|
||||
#include "absl/log/absl_log.h"
|
||||
#include "absl/strings/str_join.h"
|
||||
#include "mediapipe/framework/port/gmock.h"
|
||||
#include "mediapipe/framework/port/gtest.h"
|
||||
@@ -329,8 +330,8 @@ void TestDebugString(
|
||||
tool::TagMap& tag_map = *statusor_tag_map.value();
|
||||
std::string debug_string = tag_map.DebugString();
|
||||
std::string short_string = tag_map.ShortDebugString();
|
||||
LOG(INFO) << "ShortDebugString:\n" << short_string << "\n";
|
||||
LOG(INFO) << "DebugString:\n" << debug_string << "\n\n";
|
||||
ABSL_LOG(INFO) << "ShortDebugString:\n" << short_string << "\n";
|
||||
ABSL_LOG(INFO) << "DebugString:\n" << debug_string << "\n\n";
|
||||
|
||||
std::vector<std::string> actual_entries;
|
||||
for (const auto& field : tag_map.CanonicalEntries()) {
|
||||
|
||||
@@ -19,6 +19,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "absl/log/absl_log.h"
|
||||
#include "absl/log/check.h"
|
||||
#include "absl/strings/ascii.h"
|
||||
#include "absl/strings/match.h"
|
||||
#include "absl/strings/numbers.h"
|
||||
@@ -687,7 +689,7 @@ absl::Status TemplateExpander::ExpandTemplates(
|
||||
}
|
||||
absl::Status status;
|
||||
for (const absl::Status& error : errors_) {
|
||||
LOG(ERROR) << error;
|
||||
ABSL_LOG(ERROR) << error;
|
||||
status.Update(error);
|
||||
}
|
||||
return status;
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/container/flat_hash_set.h"
|
||||
#include "absl/log/absl_log.h"
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/strings/ascii.h"
|
||||
#include "absl/strings/numbers.h"
|
||||
@@ -31,7 +32,6 @@
|
||||
#include "mediapipe/framework/deps/proto_descriptor.pb.h"
|
||||
#include "mediapipe/framework/port/canonical_errors.h"
|
||||
#include "mediapipe/framework/port/integral_types.h"
|
||||
#include "mediapipe/framework/port/logging.h"
|
||||
#include "mediapipe/framework/port/map_util.h"
|
||||
#include "mediapipe/framework/port/ret_check.h"
|
||||
#include "mediapipe/framework/port/status.h"
|
||||
@@ -181,11 +181,11 @@ void CheckFieldIndex(const FieldDescriptor* field, int index) {
|
||||
}
|
||||
|
||||
if (field->is_repeated() && index == -1) {
|
||||
LOG(DFATAL) << "Index must be in range of repeated field values. "
|
||||
<< "Field: " << field->name();
|
||||
ABSL_LOG(ERROR) << "Index must be in range of repeated field values. "
|
||||
<< "Field: " << field->name();
|
||||
} else if (!field->is_repeated() && index != -1) {
|
||||
LOG(DFATAL) << "Index must be -1 for singular fields."
|
||||
<< "Field: " << field->name();
|
||||
ABSL_LOG(ERROR) << "Index must be -1 for singular fields."
|
||||
<< "Field: " << field->name();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ class TemplateParser::Parser::ParserImpl {
|
||||
// Parses the ASCII representation specified in input and saves the
|
||||
// information into the output pointer (a Message). Returns
|
||||
// false if an error occurs (an error will also be logged to
|
||||
// LOG(ERROR)).
|
||||
// ABSL_LOG(ERROR)).
|
||||
virtual bool Parse(Message* output) {
|
||||
// Consume fields until we cannot do so anymore.
|
||||
while (true) {
|
||||
@@ -335,12 +335,12 @@ class TemplateParser::Parser::ParserImpl {
|
||||
had_errors_ = true;
|
||||
if (error_collector_ == NULL) {
|
||||
if (line >= 0) {
|
||||
LOG(ERROR) << "Error parsing text-format "
|
||||
<< root_message_type_->full_name() << ": " << (line + 1)
|
||||
<< ":" << (col + 1) << ": " << message;
|
||||
ABSL_LOG(ERROR) << "Error parsing text-format "
|
||||
<< root_message_type_->full_name() << ": " << (line + 1)
|
||||
<< ":" << (col + 1) << ": " << message;
|
||||
} else {
|
||||
LOG(ERROR) << "Error parsing text-format "
|
||||
<< root_message_type_->full_name() << ": " << message;
|
||||
ABSL_LOG(ERROR) << "Error parsing text-format "
|
||||
<< root_message_type_->full_name() << ": " << message;
|
||||
}
|
||||
} else {
|
||||
error_collector_->AddError(line, col, std::string(message));
|
||||
@@ -350,12 +350,12 @@ class TemplateParser::Parser::ParserImpl {
|
||||
void ReportWarning(int line, int col, absl::string_view message) {
|
||||
if (error_collector_ == NULL) {
|
||||
if (line >= 0) {
|
||||
LOG(WARNING) << "Warning parsing text-format "
|
||||
<< root_message_type_->full_name() << ": " << (line + 1)
|
||||
<< ":" << (col + 1) << ": " << message;
|
||||
ABSL_LOG(WARNING) << "Warning parsing text-format "
|
||||
<< root_message_type_->full_name() << ": "
|
||||
<< (line + 1) << ":" << (col + 1) << ": " << message;
|
||||
} else {
|
||||
LOG(WARNING) << "Warning parsing text-format "
|
||||
<< root_message_type_->full_name() << ": " << message;
|
||||
ABSL_LOG(WARNING) << "Warning parsing text-format "
|
||||
<< root_message_type_->full_name() << ": " << message;
|
||||
}
|
||||
} else {
|
||||
error_collector_->AddWarning(line, col, std::string(message));
|
||||
@@ -884,7 +884,7 @@ class TemplateParser::Parser::ParserImpl {
|
||||
case FieldDescriptor::CPPTYPE_MESSAGE: {
|
||||
// We should never get here. Put here instead of a default
|
||||
// so that if new types are added, we get a nice compiler warning.
|
||||
LOG(FATAL) << "Reached an unintended state: CPPTYPE_MESSAGE";
|
||||
ABSL_LOG(FATAL) << "Reached an unintended state: CPPTYPE_MESSAGE";
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@
|
||||
|
||||
#include "absl/cleanup/cleanup.h"
|
||||
#include "absl/container/flat_hash_set.h"
|
||||
#include "absl/log/absl_log.h"
|
||||
#include "absl/log/check.h"
|
||||
#include "absl/memory/memory.h"
|
||||
#include "absl/status/status.h"
|
||||
#include "absl/strings/match.h"
|
||||
@@ -35,7 +37,6 @@
|
||||
#include "mediapipe/framework/formats/image_format.pb.h"
|
||||
#include "mediapipe/framework/port/advanced_proto_inc.h"
|
||||
#include "mediapipe/framework/port/file_helpers.h"
|
||||
#include "mediapipe/framework/port/logging.h"
|
||||
#include "mediapipe/framework/port/proto_ns.h"
|
||||
#include "mediapipe/framework/port/ret_check.h"
|
||||
#include "mediapipe/framework/port/status_macros.h"
|
||||
@@ -196,7 +197,7 @@ absl::Status CompareImageFrames(const ImageFrame& image1,
|
||||
return CompareDiff<float>(image1, image2, max_color_diff, max_alpha_diff,
|
||||
max_avg_diff, diff_image);
|
||||
default:
|
||||
LOG(FATAL) << ImageFrame::InvalidFormatString(image1.Format());
|
||||
ABSL_LOG(FATAL) << ImageFrame::InvalidFormatString(image1.Format());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,15 +337,15 @@ absl::StatusOr<std::string> SavePngTestOutput(
|
||||
bool LoadTestGraph(CalculatorGraphConfig* proto, const std::string& path) {
|
||||
int fd = open(path.c_str(), O_RDONLY);
|
||||
if (fd == -1) {
|
||||
LOG(ERROR) << "could not open test graph: " << path
|
||||
<< ", error: " << strerror(errno);
|
||||
ABSL_LOG(ERROR) << "could not open test graph: " << path
|
||||
<< ", error: " << strerror(errno);
|
||||
return false;
|
||||
}
|
||||
proto_ns::io::FileInputStream input(fd);
|
||||
bool success = proto->ParseFromZeroCopyStream(&input);
|
||||
close(fd);
|
||||
if (!success) {
|
||||
LOG(ERROR) << "could not parse test graph: " << path;
|
||||
ABSL_LOG(ERROR) << "could not parse test graph: " << path;
|
||||
}
|
||||
return success;
|
||||
}
|
||||
@@ -355,7 +356,7 @@ std::unique_ptr<ImageFrame> GenerateLuminanceImage(
|
||||
const int height = original_image.Height();
|
||||
const int channels = original_image.NumberOfChannels();
|
||||
if (channels != 3 && channels != 4) {
|
||||
LOG(ERROR) << "Invalid number of image channels: " << channels;
|
||||
ABSL_LOG(ERROR) << "Invalid number of image channels: " << channels;
|
||||
return nullptr;
|
||||
}
|
||||
auto luminance_image =
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
|
||||
#include "absl/flags/flag.h"
|
||||
#include "absl/flags/parse.h"
|
||||
#include "absl/log/absl_log.h"
|
||||
#include "mediapipe/framework/calculator.pb.h"
|
||||
#include "mediapipe/framework/port/advanced_proto_inc.h"
|
||||
#include "mediapipe/framework/port/canonical_errors.h"
|
||||
#include "mediapipe/framework/port/logging.h"
|
||||
#include "mediapipe/framework/port/ret_check.h"
|
||||
#include "mediapipe/framework/port/status.h"
|
||||
|
||||
@@ -33,10 +35,10 @@ ABSL_FLAG(std::string, proto_source, "",
|
||||
ABSL_FLAG(std::string, proto_output, "",
|
||||
"An output template file in binary CalculatorGraphTemplate form.");
|
||||
|
||||
#define EXIT_IF_ERROR(status) \
|
||||
if (!status.ok()) { \
|
||||
LOG(ERROR) << status; \
|
||||
return EXIT_FAILURE; \
|
||||
#define EXIT_IF_ERROR(status) \
|
||||
if (!status.ok()) { \
|
||||
ABSL_LOG(ERROR) << status; \
|
||||
return EXIT_FAILURE; \
|
||||
}
|
||||
|
||||
namespace mediapipe {
|
||||
|
||||
Reference in New Issue
Block a user