📄 log.h
字号:
// Log.h: interface for the CLog class.
//
//////////////////////////////////////////////////////////////////////
//写日志文件类
//author:huangjb
//date:2001/10/12
//copyright:linkage techonoly
//note:该类的方法fnWriteLog在指定的目录下的指定前缀名的文件中写入日志信息
//example:文件名:test20011012.log
// 内容:[09:10:13]
// This is the first log message
// [09:13:45]
// This is the second log message
/////////////////////////////////////////////////////////////////////
#if !defined(AFX_LOG_H__5812D562_BE2E_11D5_B774_0003476FC3D9__INCLUDED_)
#define AFX_LOG_H__5812D562_BE2E_11D5_B774_0003476FC3D9__INCLUDED_
#include <time.h>
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#define FILE_NAME_LEN 512
#define PREFIX_LEN 20
class CLog
{
public:
/*指定日志文件所要写入的目录,不调用此函数时,日志文件将默认写入./log/目录下面*/
int fnSetLogDir(char* strLogDir);
//失败返回-1,成功返回0
/*写日志文件*/
int fnWriteLog(char* strLogMsg);
//失败返回-1,成功返回0
/*构造函数,当使用参数时,日志文件将使用它作为文件名前缀*/
CLog(char* strPrefix=NULL);
virtual ~CLog();
private:
/*日志文件指针*/
FILE* m_fpLog;
/*日志文件*/
char m_strFile[FILE_NAME_LEN];
/*前缀*/
char m_strPrefix[PREFIX_LEN];
/*log file directory*/
char m_LogDir[FILE_NAME_LEN];
};
#endif // !defined(AFX_LOG_H__5812D562_BE2E_11D5_B774_0003476FC3D9__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -