123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- #pragma once
- #include <stdio.h>
- #include <stdbool.h>
- #include <string.h>
- #ifdef _WIN32
- #include <windows.h>
- #else // Linux
- #define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
- #define __FUNCTION__ __func__
- #endif
- #ifdef _WIN32
- #ifdef _UNICODE
- #define DebugPrint DebugPrintW
- #else
- #define DebugPrint DebugPrintA
- #endif
- #else // Linux
- // Linux ÏÂĬÈÏʹÓà UTF-8 Õ×Ö·û
- #define DebugPrint DebugPrintA
- #endif
- void SetPrintLog(bool Enable);
- //extern BOOL dum_log_file;
- #define MAX_PATH 260
- #define ONE_LOG_MAX_SIZE (524288)
- #ifdef _DEBUG
- #define DebugPrintA(format,...) __DebugPrintA(__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define DebugPrintW(format,...) __DebugPrintW(__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #else
- #define DebugPrintA(format,...) __ReleasePrintA(__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #define DebugPrintW(format,...) __ReleasePrintW(__FILE__,__LINE__,__FUNCTION__,format,__VA_ARGS__)
- #endif
- //define project name before include debug.h
- #if defined _LISMSOCKET
- #define PROJECT_NAME "LISM_SOCKET"
- #elif defined _LISMSERVER
- #define PROJECT_NAME "LISM_SERVER"
- #elif defined _LISMCLIENT
- #define PROJECT_NAME "LISM_CLIENT"
- #elif defined _LISMCONSOLE
- #define PROJECT_NAME "LISM_CONSOLE"
- #elif defined _LISMDRIVERAPI
- #define PROJECT_NAME "LISM_DRIVERAPI"
- #elif defined _LISMDADTABASE
- #define PROJECT_NAME "LISM_DADTABASE"
- #elif 1
- #define PROJECT_NAME "UNKNOWN"
- #endif
- void __DebugPrintA(
- char* file,
- int line,
- char* function,
- char* format,
- ...
- );
- void __DebugPrintW(
- char* file,
- int line,
- char* function,
- wchar_t* format,
- ...
- );
- void __ReleasePrintA(
- char* file,
- int line,
- char* function,
- char* format,
- ...
- );
- void __ReleasePrintW(
- char* file,
- int line,
- char* function,
- wchar_t* format,
- ...
- );
|