logger.h
来自「这是整套横扫千军3D版游戏的源码」· C头文件 代码 · 共 55 行
H
55 行
/* Author: Tobi Vollebregt */
#ifndef LOGGER_H
#define LOGGER_H
#ifdef SYNCDEBUG
#include <stdio.h>
#include <boost/thread/mutex.hpp>
#include <string>
#include <vector>
/**
* @brief logging class for sync debugger
*
* Logging class with the special feature that it can replace "{hex address}"
* with "function [filename:lineno]".
*
* Specifically written for & used by the sync debugger.
*/
class CLogger {
public:
CLogger() : filename(NULL), logfile(NULL) {}
void AddLine(const char* fmt, ...)
#ifdef __GNUC__
__attribute__((format(printf, 2, 3)))
#endif
;
void CloseSession();
void SetFilename(const char* fn) { filename = fn; }
private:
// no copying
CLogger(const CLogger&);
CLogger& operator=(const CLogger&);
void FlushBuffer();
void CppFilt(char* sym, int size);
boost::mutex logmutex;
const char* filename;
FILE* logfile;
std::vector<std::string> buffer;
std::string exename;
};
#endif // SYNCDEBUG
#endif // LOGGER_H
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?