1 #ifndef __EIENLOG_HPP__ 2 #define __EIENLOG_HPP__ 10 #if defined(_MSC_VER) || defined(WIN32) 11 #pragma warning( disable: 4251 ) 12 #ifdef EIENLOG_DLL_EXPORTS 13 #define EIENLOG_DLL __declspec(dllexport) 15 #define EIENLOG_DLL __declspec(dllimport) 18 #define EIENLOG_API __stdcall 28 #define EIENLOG_FUNC_DECL(ret) EIENLOG_DLL ret EIENLOG_API 29 #define EIENLOG_FUNC_IMPL(ret) ret EIENLOG_API 33 #define LOG_CHUNK_SIZE 80 45 #define LOG_FG_COLOR( r, g, b ) (winux::uint16)( (r) | ( (g) << 5 ) | ( (b) << 10 ) ) 48 #define LOG_BG_COLOR( r, g, b ) (winux::uint16)( (r) | ( (g) << 4 ) | ( (b) << 8 ) ) 163 return this->logEx( data, useFgColor, fgColor, useBgColor, bgColor, 0,
true );
173 return this->log( str,
false, 0,
false, 0, logEncoding );
182 return this->logBin( data,
false, 0,
false, 0 );
194 return this->logBin( data, !fgColor.isNull(),
fgColor, !bgColor.isNull(),
bgColor );
197 int errNo()
const {
return _errno; }
212 std::vector< winux::Packet<LogChunk> >
chunks;
236 bool readRecord(
LogRecord * record, time_t waitTimeout = 3000, time_t updateTimeout = 3000 );
238 int errNo()
const {
return _errno; }
243 std::map< winux::uint32, LogChunksData > _chunksMap;
281 template <
typename... _ArgType >
284 std::basic_ostringstream<winux::tchar> sout;
291 #define LOG(s) eienlog::WriteLog(s) 292 #define LOG_BIN(d,s) eienlog::WriteLogBin((d),(s)) 302 #endif // __EIENLOG_HPP__
winux::uint32 flag
日志样式FLAG
Mixed const mxNull
Mixed(MT_NULL)常量对象
LogFlag(winux::uint32 value=0)
static void LogColorOutput(winux::Mixed const &fgColor, winux::Mixed const &bgColor, _ArgType &&...arg)
#define LOG_BG_COLOR(r, g, b)
背景色: R4G4B4
数据包,用来表示一些POD结构体用于网络通信。通常这类结构体实际大小 > sizeof(这类结构体) ...
winux::uint16 bgColor
背景色R4G4B4
size_t LogBin(winux::Buffer const &data)
写二进制日志
size_t log(winux::String const &str, winux::uint8 logEncoding=leUtf8)
发送字符串日志
size_t logBin(winux::Buffer const &data, bool useFgColor, winux::uint16 fgColor, bool useBgColor, winux::uint16 bgColor)
发送二进制日志
winux::uint16 bgColorUse
背景色是否使用
size_t logColor(winux::String const &str, winux::Mixed const &fgColor=winux::mxNull, winux::Mixed const &bgColor=winux::mxNull, winux::uint8 logEncoding=leUtf8)
发送字符串日志,可指定颜色
winux::uint16 fgColor
颜色R5G5B5
缓冲区,表示内存中一块二进制数据(利用malloc/realloc进行内存分配)
bool EnableLog(winux::String const &addr=$"127.0.0.1", winux::ushort port=22345, winux::uint16 chunkSize=80)
启用日志
#define LOG_FG_COLOR(r, g, b)
前景色: R5G5B5
size_t logBin(winux::Buffer const &data)
发送二进制日志
void WriteLog(winux::String const &str)
写字符串日志(带进程ID)
void WriteLogBin(void const *data, size_t size)
写二进制日志
#define EIENLOG_FUNC_DECL(ret)
winux::uint16 logEncoding
日志编码
std::vector< winux::Packet< LogChunk > > chunks
size_t LogBinColor(winux::Buffer const &data, winux::Mixed const &fgColor=winux::mxNull, winux::Mixed const &bgColor=winux::mxNull)
写二进制日志。可设置颜色参数
size_t logBinColor(winux::Buffer const &data, winux::Mixed const &fgColor=winux::mxNull, winux::Mixed const &bgColor=winux::mxNull)
发送二进制日志,可指定颜色
size_t Log(winux::String const &str, winux::uint8 logEncoding=leUtf8)
写字符串日志
winux::uint16 fgColorUse
颜色是否使用
static void OutputV(std::basic_ostream< _ChTy > &out)
size_t LogColor(winux::String const &str, winux::Mixed const &fgColor=winux::mxNull, winux::Mixed const &bgColor=winux::mxNull, winux::uint8 logEncoding=leUtf8)
写字符串日志。可设置颜色参数
winux::uint16 binary
是否二进制数据
LogEncoding
日志编码。Local表示本地多字节编码,不同国家可能不同