/* * File : logclient.h * Author : mzhb * Version : v1.0 * Description * 主要功能:sgd-5000系统日志客户端接口文件; * 1:基于操作系统的syslog接口写日志文件; * 2:日志接口区分进程和动态库日志文件; * History * ====================================================== * 10-05-02 mzhb created * 10-07-16 mzhb modified 删除头文件中多余的宏信息 * ====================================================== */ #ifndef _LOGCLIENT_H #define _LOGCLIENT_H //#include #ifndef _WINDOWS64 #include #include #endif #include "log_define.h" #include #ifdef _WINDOWS64 #ifdef LOGCLIENT_EXPORTS #define LOGCLIENT_API __declspec(dllexport) #else #define LOGCLIENT_API __declspec(dllimport) #pragma comment(lib,"liblogclient.lib") #endif #else #define LOGCLIENT_API #endif const int PROLOG = 0; /* the process write log */ const int LIBLOG = 1; /* the library write log */ struct LogInfo { int flag; /* 0 - process; 1 - library; */ char ctx_name[MAXNAMELEN]; char app_name[MAXNAMELEN]; char pro_name[MAXNAMELEN]; char lib_name[MAXNAMELEN]; }; struct LogRecord { public: LogRecord(); ~LogRecord(); LogRecord&operator=(const LogRecord&); int flag; /* 0 - process; 1 - library; */ char scn[MAXNAMELEN]; int scnInst; char subScn[MAXNAMELEN]; int subScnInst; char pro_name[MAXNAMELEN]; char lib_name[MAXNAMELEN]; }; #ifdef _WINDOWS64 extern "C" LOGCLIENT_API int LogWrite(int level, LogInfo *log_info,const char *format, ...); #else extern int LogWrite(int level, LogInfo *log_info,const char *format, ...); extern int LogWrite (int level, LogRecord *log_info, const char *format, ...); extern int LogWrite (int level, const char *format, ...); #endif #endif // end logclient.h