Skip to content

Commit

Permalink
Use ABSL_LOG macros over LOG macros
Browse files Browse the repository at this point in the history
LOG causes macro pollution and conflicts with ProxyWasm SDK (see proxy-wasm/proxy-wasm-cpp-sdk#154).

PiperOrigin-RevId: 533164114
  • Loading branch information
kyessenov committed May 18, 2023
1 parent 51bbf36 commit edf0ab8
Show file tree
Hide file tree
Showing 9 changed files with 20 additions and 21 deletions.
2 changes: 1 addition & 1 deletion eval/compiler/regex_precompilation_optimization_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ namespace {
using cel::ast::internal::CheckedExpr;
using google::api::expr::parser::Parse;

namespace exprpb = google::api::expr::v1alpha1;
namespace exprpb = google::api::expr;

class RegexPrecompilationExtensionTest : public testing::Test {
public:
Expand Down
1 change: 0 additions & 1 deletion eval/internal/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ cc_library(
"//internal:status_macros",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/container:flat_hash_map",
"@com_google_absl//absl/log",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
Expand Down
1 change: 0 additions & 1 deletion eval/internal/interop.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "google/protobuf/arena.h"
#include "absl/base/attributes.h"
#include "absl/container/flat_hash_map.h"
#include "absl/log/log.h"
#include "absl/status/status.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/string_view.h"
Expand Down
10 changes: 5 additions & 5 deletions eval/public/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ cc_library(
"//internal:status_macros",
"//internal:utf8",
"@com_google_absl//absl/base:core_headers",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/status",
"@com_google_absl//absl/status:statusor",
"@com_google_absl//absl/strings",
Expand Down Expand Up @@ -633,7 +633,7 @@ cc_library(
deps = [
":ast_visitor",
":source_position",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/types:variant",
"@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto",
],
Expand All @@ -651,7 +651,7 @@ cc_library(
":ast_visitor_native",
":source_position_native",
"//base:ast_internal",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/types:variant",
],
)
Expand Down Expand Up @@ -835,7 +835,7 @@ cc_library(
deps = [
":ast_visitor",
":source_position",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/types:span",
"@com_google_absl//absl/types:variant",
"@com_google_googleapis//google/api/expr/v1alpha1:syntax_cc_proto",
Expand Down Expand Up @@ -870,7 +870,7 @@ cc_library(
deps = [
":ast_visitor_native",
":source_position_native",
"@com_google_absl//absl/log",
"@com_google_absl//absl/log:absl_log",
"@com_google_absl//absl/types:span",
"@com_google_absl//absl/types:variant",
],
Expand Down
4 changes: 2 additions & 2 deletions eval/public/ast_rewrite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include <vector>

#include "google/api/expr/v1alpha1/syntax.pb.h"
#include "absl/log/log.h"
#include "absl/log/absl_log.h"
#include "absl/types/variant.h"
#include "eval/public/ast_visitor.h"
#include "eval/public/source_position.h"
Expand Down Expand Up @@ -196,7 +196,7 @@ struct PostVisitor {
case Expr::EXPR_KIND_NOT_SET:
break;
default:
LOG(ERROR) << "Unsupported Expr kind: " << expr->expr_kind_case();
ABSL_LOG(ERROR) << "Unsupported Expr kind: " << expr->expr_kind_case();
}

visitor->PostVisitExpr(expr, &position);
Expand Down
4 changes: 2 additions & 2 deletions eval/public/ast_rewrite_native.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <stack>
#include <vector>

#include "absl/log/log.h"
#include "absl/log/absl_log.h"
#include "absl/types/variant.h"
#include "eval/public/ast_visitor_native.h"
#include "eval/public/source_position_native.h"
Expand Down Expand Up @@ -199,7 +199,7 @@ struct PostVisitor {
visitor->PostVisitComprehension(&comprehension, expr, position);
}
void operator()(absl::monostate) {
LOG(ERROR) << "Unsupported Expr kind";
ABSL_LOG(ERROR) << "Unsupported Expr kind";
}
} handler{visitor, record.expr, &position};
absl::visit(handler, record.expr->expr_kind());
Expand Down
4 changes: 2 additions & 2 deletions eval/public/ast_traverse.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <stack>

#include "google/api/expr/v1alpha1/syntax.pb.h"
#include "absl/log/log.h"
#include "absl/log/absl_log.h"
#include "absl/types/variant.h"
#include "eval/public/ast_visitor.h"
#include "eval/public/source_position.h"
Expand Down Expand Up @@ -197,7 +197,7 @@ struct PostVisitor {
&position);
break;
default:
LOG(ERROR) << "Unsupported Expr kind: " << expr->expr_kind_case();
ABSL_LOG(ERROR) << "Unsupported Expr kind: " << expr->expr_kind_case();
}

visitor->PostVisitExpr(expr, &position);
Expand Down
4 changes: 2 additions & 2 deletions eval/public/ast_traverse_native.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

#include <stack>

#include "absl/log/log.h"
#include "absl/log/absl_log.h"
#include "absl/types/variant.h"
#include "base/ast_internal.h"
#include "eval/public/ast_visitor_native.h"
Expand Down Expand Up @@ -174,7 +174,7 @@ struct PostVisitor {
&position);
}
void operator()(absl::monostate) {
LOG(ERROR) << "Unsupported Expr kind";
ABSL_LOG(ERROR) << "Unsupported Expr kind";
}
} handler{visitor, record.expr,
SourcePosition(expr->id(), record.source_info)};
Expand Down
11 changes: 6 additions & 5 deletions eval/public/cel_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "absl/base/attributes.h"
#include "absl/base/macros.h"
#include "absl/base/optimization.h"
#include "absl/log/log.h"
#include "absl/log/absl_log.h"
#include "absl/status/status.h"
#include "absl/status/statusor.h"
#include "absl/strings/str_cat.h"
Expand Down Expand Up @@ -489,7 +489,8 @@ class CelValue {

// Crashes with a null pointer error.
static void CrashNullPointer(Type type) ABSL_ATTRIBUTE_COLD {
LOG(FATAL) << "Null pointer supplied for " << TypeName(type); // Crash ok
ABSL_LOG(FATAL) << "Null pointer supplied for "
<< TypeName(type); // Crash ok
}

// Null pointer checker for pointer-based types.
Expand All @@ -502,9 +503,9 @@ class CelValue {
// Crashes with a type mismatch error.
static void CrashTypeMismatch(Type requested_type,
Type actual_type) ABSL_ATTRIBUTE_COLD {
LOG(FATAL) << "Type mismatch" // Crash ok
<< ": expected " << TypeName(requested_type) // Crash ok
<< ", encountered " << TypeName(actual_type); // Crash ok
ABSL_LOG(FATAL) << "Type mismatch" // Crash ok
<< ": expected " << TypeName(requested_type) // Crash ok
<< ", encountered " << TypeName(actual_type); // Crash ok
}

// Gets value of type specified
Expand Down

0 comments on commit edf0ab8

Please sign in to comment.