summaryrefslogtreecommitdiff
path: root/CMake
diff options
context:
space:
mode:
authorMalkierian <malkierian@gmail.com>2025-11-03 18:54:01 -0700
committerGitHub <noreply@github.com>2025-11-03 18:54:01 -0700
commitcf275b1a6c25a79a96a28cf5d73421d80ee4d15a (patch)
treec2b5f7dff876d7ab3302b16a48c765143f9e7995 /CMake
parent0014f406762bcbff75b5c69a09a0496050078498 (diff)
Implement logger changes (#5914)
* Implement logger changes, and make default log level dynamic based on debug/release. * Bump LUS. * typo Co-authored-by: Eblo <7004497+Eblo@users.noreply.github.com> --------- Co-authored-by: Eblo <7004497+Eblo@users.noreply.github.com>
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..268ad27b4
--- /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}
+) \ No newline at end of file