summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorEblo <7004497+Eblo@users.noreply.github.com>2025-11-03 23:08:06 -0500
committerGitHub <noreply@github.com>2025-11-03 21:08:06 -0700
commit5215c79dedd94b6042b96e6e5c446a0a36760311 (patch)
treec54d9e6abaac999d54845bb22d2e9c404fc19e2d /CMake
parent1c97d8f5dac4595b56dbe7d24c174c18caca9608 (diff)
Address logging issues (#1317)
* Address logging issues * Default log levels for debug and release
Diffstat (limited to 'CMake')
-rw-r--r--CMake/logging.cmake20
1 files changed, 20 insertions, 0 deletions
diff --git a/CMake/logging.cmake b/CMake/logging.cmake
new file mode 100644
index 000000000..12b201b53
--- /dev/null
+++ b/CMake/logging.cmake
@@ -0,0 +1,20 @@
+set(SPDLOG_LEVEL_TRACE 0)
+set(SPDLOG_LEVEL_DEBUG 1)
+set(SPDLOG_LEVEL_INFO 2)
+set(SPDLOG_LEVEL_WARN 3)
+set(SPDLOG_LEVEL_ERROR 4)
+set(SPDLOG_LEVEL_CRITICAL 5)
+set(SPDLOG_LEVEL_OFF 6)
+set(LOG_LEVELS "SPDLOG_LEVEL_TRACE;SPDLOG_LEVEL_DEBUG;SPDLOG_LEVEL_INFO;SPDLOG_LEVEL_WARN;SPDLOG_LEVEL_ERROR;SPDLOG_LEVEL_CRITICAL;SPDLOG_LEVEL_OFF")
+set(LOG_LEVEL SPDLOG_LEVEL_TRACE CACHE STRING "The spdlog level that prints will be logged out. Overridden to SPDLOG_LEVEL_ERROR on Release builds.")
+set_property(CACHE LOG_LEVEL PROPERTY STRINGS ${LOG_LEVELS})
+if(NOT LOG_LEVEL IN_LIST LOG_LEVELS)
+ message(FATAL_ERROR "LOG_LEVEL must be one of ${LOG_LEVELS}")
+endif()
+set(SPDLOG_ACTIVE_LEVEL ${${LOG_LEVEL}})
+set(LOG_LEVEL_GAME_PRINTS ${SPDLOG_LEVEL_OFF})
+
+add_compile_definitions(
+ LOG_LEVEL_GAME_PRINTS=${LOG_LEVEL_GAME_PRINTS}
+ SPDLOG_ACTIVE_LEVEL=${SPDLOG_ACTIVE_LEVEL}
+)