From f00198876b25b4710260c9583eccda7320bcae34 Mon Sep 17 00:00:00 2001
From: Tobias Frisch <tfrisch@uni-koblenz.de>
Date: Sat, 12 Jun 2021 17:20:26 +0200
Subject: [PATCH] [#41] Classical MSVC extra branching

Signed-off-by: Tobias Frisch <tfrisch@uni-koblenz.de>
---
 include/vkcv/Logger.hpp | 42 ++++++++++++++++++++++++-----------------
 1 file changed, 25 insertions(+), 17 deletions(-)

diff --git a/include/vkcv/Logger.hpp b/include/vkcv/Logger.hpp
index bc8758f1..251b6b52 100644
--- a/include/vkcv/Logger.hpp
+++ b/include/vkcv/Logger.hpp
@@ -33,24 +33,32 @@ namespace vkcv {
 	}
 	
 #ifndef NDEBUG
+#ifndef VKCV_DEBUG_MESSAGE_LEN
+#define VKCV_DEBUG_MESSAGE_LEN 1024
+#endif
+
+#ifdef _MSC_VER
+#define __PRETTY_FUNCTION__ __FUNCSIG__
+#endif
 
-#define vkcv_log(level, ...) { \
-  char output_message [1024];           \
-                                        \
-  sprintf(                              \
-    output_message,                     \
-    __VA_ARGS__                         \
-  );                                    \
-                                        \
-  std::fprintf(                         \
-    getLogOutput(level),                \
-    "[%s]: %s [%s, line %d: %s]\n",     \
-  	vkcv::getLogName(level),            \
-    output_message,                     \
-    __FILE__,                           \
-    __LINE__,                           \
-    __PRETTY_FUNCTION__                 \
-  );                                    \
+#define vkcv_log(level, ...) {      \
+  char output_message [             \
+    VKCV_DEBUG_MESSAGE_LEN          \
+  ];                                \
+  std::snprintf(                    \
+    output_message,                 \
+    VKCV_DEBUG_MESSAGE_LEN,         \
+    __VA_ARGS__                     \
+  );                                \
+  std::fprintf(                     \
+    getLogOutput(level),            \
+    "[%s]: %s [%s, line %d: %s]\n", \
+  	vkcv::getLogName(level),        \
+    output_message,                 \
+    __FILE__,                       \
+    __LINE__,                       \
+    __PRETTY_FUNCTION__             \
+  );                                \
 }
 
 #else
-- 
GitLab