⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 log.cpp

📁 COM 组建的开发
💻 CPP
字号:
// Log.cpp: implementation of the CLog class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "resource.h"
#include "Log.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CLog::CLog()
{

}

CLog::~CLog()
{

}
// 输出调试日志 [12/13/2007 Add by Willing]
void CLog::OutDebugLog(const char* pszModule,const char* pszClass,const char* pszFunc,const char* pszLog)
{
	if (pszModule == NULL)	return;
	if (pszClass == NULL)	return;
	if (pszFunc == NULL)	return;
	if (pszLog == NULL)		return;
			
	int nLen = strlen(pszModule)+strlen(pszClass)+strlen(pszFunc)+strlen(pszLog);
	char *pszBuffer = new char[nLen+4];
	ZeroMemory(pszBuffer,nLen+4);
	// 格式化日志 [12/13/2007 Add by Willing]
	sprintf(pszBuffer,"%s|%s|%s|%s",pszModule,pszClass,pszFunc,pszLog);
	
	ST_IOITEM ioItem;
	ioItem.dwSize = nLen+4;
	ioItem.pData = (BYTE*)pszBuffer;
	ioItem.stType.wDataType = DEBUG_LOG;
	ioItem.stType.nSrcModID = SELF_NUM;
	ioItem.stType.nDesModID = LOG_NUM;
	ioItem.stType.lParam1 = 0;
	ioItem.stType.lParam2 = 0;
	_DataCenter.AddGetPacket(ioItem);
	return;
}
// 输出系统日志 [12/13/2007 Add by Willing]
void CLog::OutSysLog(const char* pszLog)
{
	if (pszLog == NULL)
	{
		return;
	}
	int nLen = strlen(pszLog);
	char *pszBuffer = new char[nLen+1];
	ZeroMemory(pszBuffer,nLen+1);
	memcpy(pszBuffer,pszLog,nLen);

	ST_IOITEM ioItem;
	ioItem.dwSize = nLen+4;
	ioItem.pData = (BYTE*)pszBuffer;
	ioItem.stType.wDataType = SYS_LOG;
	ioItem.stType.nSrcModID = SELF_NUM;
	ioItem.stType.nDesModID = LOG_NUM;
	ioItem.stType.lParam1 = 0;
	ioItem.stType.lParam2 = 0;

	_DataCenter.AddGetPacket(ioItem);
	return;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -