|
|
@@ -0,0 +1,26 @@
|
|
|
+#pragma once
|
|
|
+#include <windows.h>
|
|
|
+#include <sstream>
|
|
|
+#include <cstdio>
|
|
|
+
|
|
|
+#define DEBUG_LOG_BUFFER_SIZE 1024
|
|
|
+
|
|
|
+#define DEBUG_LOG(msg) do { \
|
|
|
+ std::wostringstream __oss; \
|
|
|
+ __oss << L"[" << __func__ << L"]@" << __FILE__ << L":" << __LINE__ << L": " << msg << L"\n"; \
|
|
|
+ OutputDebugString(__oss.str().c_str()); \
|
|
|
+} while(0)
|
|
|
+
|
|
|
+#define DEBUG_LOG_VAR(msg, val) do { \
|
|
|
+ std::wostringstream __oss; \
|
|
|
+ __oss << L"[" << __func__ << L"]@" << __FILE__ << L":" << __LINE__ << L": " << msg << L": " << val << L"\n"; \
|
|
|
+ OutputDebugString(__oss.str().c_str()); \
|
|
|
+} while(0)
|
|
|
+
|
|
|
+#define DEBUG_LOG_FMT(format, ...) do { \
|
|
|
+ wchar __logbuf[DEBUG_LOG_BUFFER_SIZE]; \
|
|
|
+ std::swprintf(__logbuf, DEBUG_LOG_BUFFER_SIZE, format, ##__VA_ARGS__); \
|
|
|
+ wchar __fullmsg[DEBUG_LOG_BUFFER_SIZE + 128]; \
|
|
|
+ std::swprintf(__fullmsg, sizeof(__fullmsg), L"[%s]@%s:%d: %s\n", __func__, __FILE__, __LINE__, __logbuf); \
|
|
|
+ OutputDebugString(__fullmsg); \
|
|
|
+} while(0)
|