Skip to content

Commit

Permalink
Add cmake command-line setting for spdlog logging level (#6215)
Browse files Browse the repository at this point in the history
* Add cmake command-line setting for spdlog logging level

* changelog

* Change cmake logging option to LOGGING_LEVEL

* Change default RMM logging level to INFO
  • Loading branch information
jlowe authored Sep 15, 2020
1 parent 338968e commit c2d544b
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
- PR #6214 Small clean up to use more algorithms
- PR #6209 Remove CXX11 ABI handling from CMake
- PR #6223 Remove CXX11 ABI flag from JNI build
- PR #6215 Add cmake command-line setting for spdlog logging level

## Bug Fixes

Expand Down
16 changes: 16 additions & 0 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,22 @@ if(HT_DEFAULT_ALLOCATOR)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -DHT_DEFAULT_ALLOCATOR")
endif(HT_DEFAULT_ALLOCATOR)

# Set a default logging level if none was specified
set(DEFAULT_LOGGING_LEVEL INFO)

if(NOT LOGGING_LEVEL)
message(STATUS "Setting logging level to '${DEFAULT_LOGGING_LEVEL}' since none specified.")
set(LOGGING_LEVEL "${DEFAULT_LOGGING_LEVEL}" CACHE
STRING "Choose the logging level." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE LOGGING_LEVEL PROPERTY STRINGS
"TRACE" "DEBUG" "INFO" "WARN" "ERROR" "CRITICAL" "OFF")
else()
message(STATUS "Setting logging level to '${LOGGING_LEVEL}'")
endif(NOT LOGGING_LEVEL)

target_compile_definitions(cudf PUBLIC SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${LOGGING_LEVEL})

###################################################################################################
# - link libraries --------------------------------------------------------------------------------

Expand Down
2 changes: 2 additions & 0 deletions java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@
<CMAKE_EXPORT_COMPILE_COMMANDS>OFF</CMAKE_EXPORT_COMPILE_COMMANDS>
<CUDA_STATIC_RUNTIME>OFF</CUDA_STATIC_RUNTIME>
<PER_THREAD_DEFAULT_STREAM>OFF</PER_THREAD_DEFAULT_STREAM>
<LOGGING_LEVEL>INFO</LOGGING_LEVEL>
<native.build.path>${project.build.directory}/cmake-build</native.build.path>
<slf4j.version>1.7.30</slf4j.version>
</properties>
Expand Down Expand Up @@ -347,6 +348,7 @@
<arg value="${basedir}/src/main/native"/>
<arg value="-DCUDA_STATIC_RUNTIME=${CUDA_STATIC_RUNTIME}" />
<arg value="-DPER_THREAD_DEFAULT_STREAM=${PER_THREAD_DEFAULT_STREAM}" />
<arg value="-DLOGGING_LEVEL=${LOGGING_LEVEL}" />
<arg value="-DCMAKE_CXX_FLAGS=${cxx.flags}"/>
<arg value="-DCMAKE_EXPORT_COMPILE_COMMANDS=${CMAKE_EXPORT_COMPILE_COMMANDS}"/>
</exec>
Expand Down
16 changes: 16 additions & 0 deletions java/src/main/native/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,22 @@ if(PER_THREAD_DEFAULT_STREAM)
add_compile_definitions(CUDA_API_PER_THREAD_DEFAULT_STREAM)
endif(PER_THREAD_DEFAULT_STREAM)

# Set a default logging level if none was specified
set(DEFAULT_LOGGING_LEVEL INFO)

if(NOT LOGGING_LEVEL)
message(STATUS "Setting logging level to '${DEFAULT_LOGGING_LEVEL}' since none specified.")
set(LOGGING_LEVEL "${DEFAULT_LOGGING_LEVEL}" CACHE
STRING "Choose the logging level." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE LOGGING_LEVEL PROPERTY STRINGS
"TRACE" "DEBUG" "INFO" "WARN" "ERROR" "CRITICAL" "OFF")
else()
message(STATUS "Setting logging level to '${LOGGING_LEVEL}'")
endif(NOT LOGGING_LEVEL)

target_compile_definitions(cudfjni PUBLIC SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${LOGGING_LEVEL})

###################################################################################################
# - link libraries --------------------------------------------------------------------------------

Expand Down

0 comments on commit c2d544b

Please sign in to comment.