📄 debuglog.h
字号:
// Debug.h: interface for the CDebugLog class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_DEBUG_H__78933F14_CBDC_417D_B700_95257702E393__INCLUDED_)
#define AFX_DEBUG_H__78933F14_CBDC_417D_B700_95257702E393__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
/*--------------------------------------------------------------------
SynCzone open source project
Debug-Tracer v0.1.0
Prototype By NetSerenity.
Modify By HwoarangSangwoo(E-Mail: hwoarang_sangwoo@hotmail.com)
----------------------------------------------------------------------*/
namespace DebugLog
{
enum eSZDTOT//SyncZone Debug Tracer Ouptput Types
{
OUTPUT_NOT_SET = 0x00000000,
OUTPUT_JUST_FILE = 0x00000001,
OUTPUT_JUST_TRACE = 0x00000002,
OUTPUT_JUST_CONSOLE = 0x00000004,
OUTPUT_FILE_AND_TRACE = OUTPUT_JUST_FILE|OUTPUT_JUST_TRACE,
OUTPUT_FILE_AND_CONSOLE = OUTPUT_JUST_FILE|OUTPUT_JUST_CONSOLE,
OUTPUT_ALL = OUTPUT_JUST_FILE|OUTPUT_JUST_TRACE|OUTPUT_JUST_CONSOLE,
};
enum eSZDTLT//SyncZone Debug Tracer Log Types
{
LOG_NORMAL = 0,
LOG_LV1 = 1,
LOG_LV2 = 2,
LOG_LV3 = 3,
LOG_LV4 = 4,
LOG_LV5 = 5,
LOG_LV6 = 6,
LOG_LV7 = 7,
LOG_LV8 = 8,
LOG_LV9 = 9,
LOG_LV10 = 10,
};
const int MAX_ERROR_MSG_SIZE = 1024;//肺弊扁废 弥措 辨捞
const char szLogFolder[] = "./CustomerService";//SyncZone Debug Tracer Log
class CDebugLog
{
public:
CDebugLog();
virtual ~CDebugLog();
public:
bool Init(const eSZDTOT OutputMode, const char* strIdentifyName);//葛靛 悸泼 扁废 瞪 颇老狼 绊蜡 捞抚涝聪促.
void Log(const eSZDTLT LogLv, const char *szLogMsg, ...);//扁废何
private:
void Start(){::InitializeCriticalSection(&m_ThreadCS);}//矫累矫 馆靛矫 龋免 秦具窃 Example 曼炼
void End(){::DeleteCriticalSection(&m_ThreadCS);}//辆丰矫 馆靛矫 龋免 秦具窃 Example 曼炼
void Clear();//函荐 檬扁拳
void SetTime();//矫埃 包府何
void SetWriteFile();//扁废瞪 颇老 汲沥// 馆靛矫 龋免 傈俊 SetTime阑 龋免 窍技夸 SetTime 第俊 坷霸 窍技夸
void OutFile(const char *szLogMsg);
void OutTrace(const char *szLogMsg);
void OutConsole(const char *szLogMsg);
bool OpenConsole();
void CloseConsole();
private:
__int32 m_iMode;//葛靛历厘家.
char m_szIdentify[MAX_PATH];
FILE* m_fp;//颇老 勤甸
HANDLE m_hConsole;//能贾狼 勤甸.
CRITICAL_SECTION m_ThreadCS;//胶饭靛狼 勤甸.
__int32 m_iYear,m_iMon,m_iDay;
__int32 m_iHour,m_iMin,m_iSec;
private:
CDebugLog operator=(const CDebugLog &old);//措涝楷魂磊 荤侩 阂啊.
CDebugLog(const CDebugLog &old);//汗荤积己磊 荤侩 阂啊.
};
/*-------------------------------------------------------------------
Example>
void Garbage()
{
CDebugLog Dbg;
Dbg.Init(OUTPUT_JUST_FILE,"Func1");
Dbg.Log(LOG_LV1,"咯扁辑 公菌阑 %d甫 龋免 沁瘤", 100);
.
.
.
Dbg.Log(LOG_LV1,"甸绢坷搁 救登绰镑");
.
.
.
}
//------------------------------------------------------------------*/
}
using namespace DebugLog;
extern CDebugLog g_CrashLog;
extern CDebugLog g_DBGLog;
#endif // !defined(AFX_DEBUG_H__78933F14_CBDC_417D_B700_95257702E393__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -