Skip to content

Commit

Permalink
apacheGH-40181: [C++] Support glog 0.7 build (apache#40230)
Browse files Browse the repository at this point in the history
Fixes apache#40181 

### Are these changes tested?

These changes have been tested as part of the conda feedstocks for Arrow.
* GitHub Issue: apache#40181

Authored-by: Uwe L. Korn <[email protected]>
Signed-off-by: Sutou Kouhei <[email protected]>
  • Loading branch information
xhochy authored Feb 27, 2024
1 parent c5f60a0 commit 5ce060a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 7 additions & 1 deletion cpp/cmake_modules/FindGLOG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
#
# find_package(GLOG)

find_package(glog CONFIG)
if(glog_FOUND)
return()
endif()

if(GLOG_FOUND)
return()
endif()
Expand Down Expand Up @@ -56,5 +61,6 @@ if(GLOG_FOUND)
add_library(glog::glog UNKNOWN IMPORTED)
set_target_properties(glog::glog
PROPERTIES IMPORTED_LOCATION "${GLOG_LIB}"
INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIR}")
INTERFACE_INCLUDE_DIRECTORIES "${GLOG_INCLUDE_DIR}"
INTERFACE_COMPILE_DEFINITIONS "GLOG_USE_GLOG_EXPORT")
endif()
6 changes: 3 additions & 3 deletions cpp/src/arrow/util/logging.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ static std::unique_ptr<std::string> log_dir_;
#ifdef ARROW_USE_GLOG

// Glog's severity map.
static int GetMappedSeverity(ArrowLogLevel severity) {
static google::LogSeverity GetMappedSeverity(ArrowLogLevel severity) {
switch (severity) {
case ArrowLogLevel::ARROW_DEBUG:
return google::GLOG_INFO;
Expand Down Expand Up @@ -148,7 +148,7 @@ void ArrowLog::StartArrowLog(const std::string& app_name,
app_name_.reset(new std::string(app_name));
log_dir_.reset(new std::string(log_dir));
#ifdef ARROW_USE_GLOG
int mapped_severity_threshold = GetMappedSeverity(severity_threshold_);
google::LogSeverity mapped_severity_threshold = GetMappedSeverity(severity_threshold_);
google::SetStderrLogging(mapped_severity_threshold);
// Enable log file if log_dir is not empty.
if (!log_dir.empty()) {
Expand All @@ -173,7 +173,7 @@ void ArrowLog::StartArrowLog(const std::string& app_name,
google::SetLogFilenameExtension(app_name_without_path.c_str());
for (int i = static_cast<int>(severity_threshold_);
i <= static_cast<int>(ArrowLogLevel::ARROW_FATAL); ++i) {
int level = GetMappedSeverity(static_cast<ArrowLogLevel>(i));
google::LogSeverity level = GetMappedSeverity(static_cast<ArrowLogLevel>(i));
google::SetLogDestination(level, dir_ends_with_slash.c_str());
}
}
Expand Down

0 comments on commit 5ce060a

Please sign in to comment.