TRACE()-like log function
来源:互联网 发布:java json转map 编辑:程序博客网 时间:2024/06/01 08:56
#pragma once
// inspire by MFC TRACE() marco
class CXLog
{
public:
CXLog(const char *pszFileName, int nLineNo, const char *pszFunction)
: m_pszFileName(pszFileName), m_nLineNo(nLineNo), m_pszFunction(pszFunction)
{}
void __cdecl operator()(const char *format, ...) const
{
_snprintf((char*)szBuf, sizeof(szBuf), "[%s(%d):%s],",
m_pszFileName, m_nLineNo, m_pszFunction);
int nLen = (int)strlen(szBuf);
va_list argptr;
va_start(argptr, format);
_vsnprintf((char*)szBuf + nLen, sizeof(szBuf) - nLen, format, argptr);
va_end(argptr);
printf("%s/n", szBuf);
}
private:
/* unimplemented */
CXLog &__cdecl operator=(const CXLog &right);
const char *const m_pszFileName;
const char *const m_pszFunction;
const int m_nLineNo;
char szBuf[1024];
};
#define XLOG CXLog(__FILE__, __LINE__, __FUNCTION__)
// sample
// XLOG("Hello, val = %d/n", 1);
- TRACE()-like log function
- Trace Log Example
- SQL_UDF:Split like VB function
- debug log print function
- C LOG function
- Negative log-likelihood function
- Trace Function Enter, Exit and Leave
- 做出自己的back trace function
- Trace and profile function calls with GCC
- Trace and profile function calls with GCC
- Trace Function Enter, Exit and Leave
- A Class for Creating a Trace Log
- 日志功能--yii::trace()和yii::log()
- print log trace (I forgot it )
- 一个简单明了的c++ trace log 实现
- 开启关闭、操作日志文件alter.LOG trace.LOG
- java log ,c /c++ log add function
- Android筆記-Linux Kernel Ftrace (Function Trace)解析
- Crichedit超链接(只能自动检测超链接)
- MySQL导出导入数据库命令
- 如何向网页中加入多媒体
- MySQL中MyISAM引擎与InnoDB引擎性能简单测试
- MySQL学习笔记:InnoDB和MyISAM的差别
- TRACE()-like log function
- [转]类型,转换,数组,协变及其他
- 甲始终领先乙的概率
- MySQL配置文件my.cnf中文版
- 延长石油内幕
- SSAS : 数据挖掘分析器
- 请你再给我三分钟时间好吗?
- C++开源跨平台类库集
- 一个虽然复杂但可直接套用的线程池实例