Created
May 28, 2016 16:15
-
-
Save Usushiki/dca25f6e934ba329f1a19beaa2733e02 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//--------------------------------------------------// | |
// DebugLog.hpp // | |
// // | |
// About 出力ウィンドウへのログを表示 // | |
// Last Update 2016/05/26 // | |
//--------------------------------------------------// | |
//----------------------------- | |
//多重インクルード防止 | |
//----------------------------- | |
#pragma once | |
//----------------------------- | |
//ヘッダファイルのインクルード | |
//----------------------------- | |
#include"LogDefine.hpp" | |
#include<sstream> | |
#ifdef GAIA_DEBUG | |
#include<crtdbg.h> | |
#endif // DEBUG | |
//マクロ定義 | |
#define DebugLogFileLine(...)DebugProcess(Log(__VA_ARGS__,__FILE__,__LINE__) ) | |
#define DebugLog(...)DebugProcess(Log(__VA_ARGS__)) | |
template<typename T, typename... Args> | |
inline void Log(const T& message, const Args&... args) | |
{ | |
#ifdef GAIA_DEBUG | |
std::wstringstream wss; | |
wss << message; //メッセージをストリームに流し込む | |
wss << " "; | |
Log(wss, args...); //メッセージがなくなるまで再帰 | |
#endif | |
} | |
template<typename T, typename... Args> | |
inline void Log(std::wstringstream& wss, const T& message, const Args&... args) | |
{ | |
#ifdef GAIA_DEBUG | |
wss << message; | |
wss << " "; | |
Log(wss, args...); | |
#endif | |
} | |
inline void Log(std::wstringstream& wss) | |
{ | |
#ifdef GAIA_DEBUG | |
wss << " "; | |
wss << L'\n'; //終端文字を追加 | |
//表示 | |
OutputDebugString(wss.str().c_str()); | |
#endif | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment