aboutsummaryrefslogtreecommitdiff
path: root/zenserver/diag/logging.cpp
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2021-09-17 15:42:30 +0200
committerStefan Boberg <[email protected]>2021-09-17 15:42:30 +0200
commit0080e35ddb363dcac604cd77c1a07c98e4e75f4b (patch)
tree4b869f37c9384ec0c6cf3e0c56c017e4fde694ab /zenserver/diag/logging.cpp
parentAdded IsDebuggerPresent() query function to query whether a debugger is curre... (diff)
downloadzen-0080e35ddb363dcac604cd77c1a07c98e4e75f4b.tar.xz
zen-0080e35ddb363dcac604cd77c1a07c98e4e75f4b.zip
clang-format
Diffstat (limited to 'zenserver/diag/logging.cpp')
-rw-r--r--zenserver/diag/logging.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/zenserver/diag/logging.cpp b/zenserver/diag/logging.cpp
index 4ba4835af..48c87dd68 100644
--- a/zenserver/diag/logging.cpp
+++ b/zenserver/diag/logging.cpp
@@ -9,6 +9,7 @@
#include <spdlog/pattern_formatter.h>
#include <spdlog/sinks/ansicolor_sink.h>
#include <spdlog/sinks/basic_file_sink.h>
+#include <spdlog/sinks/msvc_sink.h>
#include <spdlog/sinks/stdout_color_sinks.h>
#include <spdlog/spdlog.h>
#include <zencore/string.h>
@@ -207,7 +208,7 @@ InitializeLogging(const ZenServerOptions& GlobalOptions)
if (GlobalOptions.IsTest)
{
LogLevel = spdlog::level::trace;
- IsAsync = false;
+ IsAsync = false;
}
if (IsAsync)
@@ -234,6 +235,15 @@ InitializeLogging(const ZenServerOptions& GlobalOptions)
Sinks.push_back(ConsoleSink);
Sinks.push_back(FileSink);
+#if ZEN_PLATFORM_WINDOWS
+ if (zen::IsDebuggerPresent())
+ {
+ auto DebugSink = std::make_shared<spdlog::sinks::msvc_sink_mt>();
+ DebugSink->set_level(spdlog::level::debug);
+ Sinks.push_back(DebugSink);
+ }
+#endif
+
// Jupiter - only log HTTP traffic to file
auto JupiterLogger = std::make_shared<spdlog::logger>("jupiter", FileSink);