Пример #1
0
//构造函数
Logger::Logger(const char * strLogPath, EnumLogLevel nLogLevel):m_nLogLevel(nLogLevel)
{
	//初始化
	m_pFileStream = NULL;
	strcpy(m_strLogPath, strLogPath);
	InitializeCriticalSection(&m_cs);
	CreateLogPath();
	GenerateLogName();
}
Пример #2
0
//构造函数
void Logger::init(const char * strLogPath, EnumLogLevel nLogLevel)
{
	//初始化
	//初始化
	memset(m_strLogPath, 0, MAX_STR_LEN);
	memset(m_strCurLogName, 0, MAX_STR_LEN);
	m_nLogLevel=nLogLevel;
	m_pFileStream = NULL;
	strcpy_s(m_strLogPath, strLogPath);
	InitializeCriticalSection(&m_cs);
	CreateLogPath();
	GenerateLogName();
}
Пример #3
0
//默认构造函数
Logger::Logger()
{
	//初始化
	memset(m_strLogPath, 0, MAX_STR_LEN);
	memset(m_strCurLogName, 0, MAX_STR_LEN);
	strcat(m_strLogPath,"log\\");

	m_pFileStream = NULL;
	//设置默认的写日志级别
	m_nLogLevel = EnumLogLevel::LogLevelAll;
	//初始化临界区变量
	InitializeCriticalSection(&m_cs);
	//创建日志文件名
	GenerateLogName();
}