#ifndef _INCLUDE_BINLOG_H #define _INCLUDE_BINLOG_H #if defined BINLOG_ENABLED #include "CString.h" #define BINLOG_MAGIC 0x414D424C #define BINLOG_VERSION 0x0300 /** * Format of binlog: * uint32 magic * uint16 version * uint8 sizeof(time_t) * uint32 num plugins * [ * uint8 status codes * str[int8] filename * if(status==2) * uint32 num filenames * uint32 num natives * uint32 num publics * if (status==2) * [ * str[uint8] file name * ] * [ * str[uint8] native name * ] * [ * str[uint8] public name * ] * ] * [ * uint8 operation code * time_t realtime * float gametime * int32 plugin id * * ] * If filename id is 0 skip as plugin was not in debug mode, if -1 there was an error. */ enum BinLogOp { BinLog_Start=1, BinLog_End, BinLog_NativeCall, // BinLog_NativeError, // BinLog_NativeRet, // BinLog_CallPubFunc, // BinLog_SetLine, // BinLog_Registered, // BinLog_FormatString, // BinLog_NativeParams, // BinLog_GetString, // BinLog_SetString, // }; class BinLog { public: BinLog() : m_state(false) { }; public: bool Open(); void Close(); void WriteOp(BinLogOp op, int plug, ...); private: void WritePluginDB(FILE *fp); private: String m_logfile; bool m_state; }; extern BinLog g_BinLog; extern int g_binlog_level; extern int g_binlog_maxsize; #endif //BINLOG_ENABLED #endif //_INCLUDE_BINLOG_H