123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869 |
- // stdafx.h : 标准系统包含文件的包含文件,
- // 或是常用但不常更改的项目特定的包含文件
- //
- #pragma once
- #include <iostream>
- #include <tchar.h>
- #include "log4c.h"
- #if 0
- class CLogContext
- {
- public:
- CLogContext(const char *pFileName, const char *pFuncName, int nLineNo):
- m_pFileName(pFileName),
- m_pFuncName(pFuncName),
- m_nLinNo(nLineNo)
- {
- m_nLogNum = 0;
- }
- static SetInfo(const char *pFileName, const char *pFuncName, int nLineNo)
- {
- CLogContext(pFileName, pFuncName, nLineNo);
- }
- void Output(const char *pFormat, ...)
- {
- #if 0
- char *file_info;
- char *new_format;
- size_t info_len;
- size_t new_format_len;
- va_list va;
-
- info_len = strlen(format) + 50;
- file_info = (char *) malloc(info_len);
- sprintf(file_info, format, ++LOGNUM, func, line, file);
-
- new_format_len = strlen(file_info) + strlen(a_format) + 2;
- new_format = (char *) malloc(new_format_len);
- sprintf(new_format, "%s %s", file_info, a_format);
-
- va_start(va, a_format);
- log4c_category_vlog(mycat, LOG4C_PRIORITY_ERROR, new_format, va);
- va_end(va);
-
- free(file_info);
- free(new_format);
- #endif
- }
- log4c_category_t* m_pLogCategory;
- static CLogContext* m_pLogContext;
- private:
- const char *m_pFileName;
- const char *m_pFuncName;
- int m_nLinNo;
- int m_nLogNum;
- };
- #define LOG(fmt, arg...) CLogContext::SetInfo(__FILE__, __LINE__, __FUNCTION__).Output(fmt, arg...)
- #endif
- // TODO: 在此处引用程序要求的附加头文件
|