【文件属性】:
文件名称:专业的log类(C++)类
文件大小:3KB
文件格式:RAR
更新时间:2015-07-05 10:00:19
log类 c++ 类 专业 c
Log.cpp
Log.h
Thread.cpp
Thread.h
CriticalSection.cpp
CriticalSection.h
#ifndef _LOG_H_
#define _LOG_H_
#ifndef _CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#include "CriticalSection.h"
#include "Thread.h"
#include
#include
#include
#include
namespace common_utils
{
typedef struct _LogItem
{
std::string line;
int grade;
} LogItem;
class Log : public Thread
{
private:
CriticalSection m_cs;
std::vector *m_pCache;
void InitLogCache();
void LogThreadEnd();
virtual unsigned long OnExecute();
protected:
int m_sleepInterval;
void LogHead();
void SeparatorLine(const std::string &str;, char c = '=');
virtual void CalcInterval();
virtual void Flush(std::vector *p) = 0;
virtual void Write(const char *str, const int &grade;);
public:
Log();
~Log();
virtual std::string LogTime();
void WriteLog(const char *str, const int &grade; = 0);
void WriteLog(const std::string &str;, const int &grade; = 0) { WriteLog(str.c_str(), grade); };
void WriteTimeLog(const char *str, const int &grade; = 0);
void WriteTimeLog(const std::string &str;, const int &grade; = 0) { WriteTimeLog(str.c_str(), grade); }
};
};
#endif
【文件预览】:
Log.cpp
Log.h
Thread.cpp
CriticalSection.cpp
CriticalSection.h
www.pudn.com.txt
Thread.h