diff --git a/spy/Spy.vcxproj b/spy/Spy.vcxproj
index 8f0beb7..e30d2c5 100644
--- a/spy/Spy.vcxproj
+++ b/spy/Spy.vcxproj
@@ -77,7 +77,7 @@
false
- true
+ false
true
@@ -88,14 +88,21 @@
true
+
+ true
+
Level3
true
WIN32;_DEBUG;SPY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
true
- Use
- pch.h
+ NotUsing
+
+
+ stdcpp17
+ $(SolutionDir)rpc;$(SolutionDir)rpc\nanopb;$(SolutionDir)rpc\proto;$(SolutionDir)spy;C:\Tools\vcpkg\installed\x86-windows-static\include
+
Windows
@@ -110,7 +117,7 @@
true
true
true
- WIN32;NDEBUG;SPY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
+ WIN32;NDEBUG;SPY_EXPORTS;_WINDOWS;_USRDLL;ENABLE_DEBUG_LOG;%(PreprocessorDefinitions)
true
NotUsing
diff --git a/spy/log.cpp b/spy/log.cpp
index 9fff914..3ea1d13 100644
--- a/spy/log.cpp
+++ b/spy/log.cpp
@@ -7,6 +7,9 @@
void InitLogger()
{
+#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_DEBUG
+ spdlog::set_level(spdlog::level::debug);
+#endif
static std::shared_ptr gLogger = nullptr;
if (gLogger != nullptr) {
return;
@@ -18,4 +21,6 @@ void InitLogger()
spdlog::set_default_logger(gLogger);
gLogger->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%l] [%n] [%s::%#::%!] %v");
gLogger->flush_on(spdlog::level::info);
+
+ LOG_DEBUG("InitLogger with debug level");
}
diff --git a/spy/log.h b/spy/log.h
index 1a989de..c3e04ca 100644
--- a/spy/log.h
+++ b/spy/log.h
@@ -1,11 +1,13 @@
-#pragma once
+#pragma once
+
+#ifdef ENABLE_DEBUG_LOG
+#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_DEBUG
+#endif
#include "spdlog/sinks/rotating_file_sink.h"
#include "spdlog/sinks/stdout_color_sinks.h"
#include "spdlog/spdlog.h"
-extern std::shared_ptr gLogger;
-
#define LOG_DEBUG(...) SPDLOG_DEBUG(__VA_ARGS__);
#define LOG_INFO(...) SPDLOG_INFO(__VA_ARGS__);
#define LOG_WARN(...) SPDLOG_WARN(__VA_ARGS__);