diff options
author | George Hazan <george.hazan@gmail.com> | 2013-08-12 21:55:48 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-08-12 21:55:48 +0000 |
commit | 9f06e7ffdd6458dd25bfd5b915cb788bab03bea0 (patch) | |
tree | 28acaca0e311896ee60299e4ca055a5cc7a5cb3a | |
parent | d60f928fe512a067719cfc6e9a88eb9d56ad47ac (diff) |
simple core logger
git-svn-id: http://svn.miranda-ng.org/main/trunk@5664 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | bin10/lib/mir_core.lib | bin | 48902 -> 50032 bytes | |||
-rw-r--r-- | bin10/lib/mir_core64.lib | bin | 44508 -> 45590 bytes | |||
-rw-r--r-- | bin11/lib/mir_core.lib | bin | 48902 -> 50032 bytes | |||
-rw-r--r-- | bin11/lib/mir_core64.lib | bin | 44508 -> 45590 bytes | |||
-rw-r--r-- | include/delphi/m_core.inc | 11 | ||||
-rw-r--r-- | include/m_core.h | 17 | ||||
-rw-r--r-- | src/mir_core/mir_core.def | 5 | ||||
-rw-r--r-- | src/mir_core/mir_core_10.vcxproj | 1 | ||||
-rw-r--r-- | src/mir_core/mir_core_10.vcxproj.filters | 3 | ||||
-rw-r--r-- | src/mir_core/mir_core_11.vcxproj | 1 | ||||
-rw-r--r-- | src/mir_core/mir_core_11.vcxproj.filters | 3 | ||||
-rw-r--r-- | src/mir_core/miranda.cpp | 11 |
12 files changed, 52 insertions, 0 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib Binary files differindex 732702727a..46ad2b046b 100644 --- a/bin10/lib/mir_core.lib +++ b/bin10/lib/mir_core.lib diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib Binary files differindex e7c7c251df..643c58ccf0 100644 --- a/bin10/lib/mir_core64.lib +++ b/bin10/lib/mir_core64.lib diff --git a/bin11/lib/mir_core.lib b/bin11/lib/mir_core.lib Binary files differindex b4c0a7d628..d149aa9bb3 100644 --- a/bin11/lib/mir_core.lib +++ b/bin11/lib/mir_core.lib diff --git a/bin11/lib/mir_core64.lib b/bin11/lib/mir_core64.lib Binary files differindex 6a5eac5e41..61c24cb265 100644 --- a/bin11/lib/mir_core64.lib +++ b/bin11/lib/mir_core64.lib diff --git a/include/delphi/m_core.inc b/include/delphi/m_core.inc index 0bfd0aec8f..a8ecb0227d 100644 --- a/include/delphi/m_core.inc +++ b/include/delphi/m_core.inc @@ -426,6 +426,17 @@ procedure List_ObjCopy(src:PSortedList; dst:PSortedList; size:size_t); stdcall; ///////////////////////////////////////////////////////////////////////////////
+// log functions
+
+function mir_createLog(pszName:PAnsiChar; ptszDescr, ptszFile:PWideChar; options:Cardinal):THandle;stdcall;
+ external CoreDLL name 'mir_createLog';
+
+function mir_writeLogA(hLog:THandle; format:PAnsiChar):int;cdecl;
+ external CoreDLL name 'mir_writeLogA';
+function mir_writeLogW(hLog:THandle; format:PWideChar):int;cdecl;
+ external CoreDLL name 'mir_writeLogW';
+
+///////////////////////////////////////////////////////////////////////////////
// md5 functions
// Define the state of the MD5 Algorithm.
diff --git a/include/m_core.h b/include/m_core.h index 9c4461b407..a800afe873 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -521,6 +521,17 @@ MIR_CORE_DLL(void) List_Copy(SortedList* s, SortedList* d, size_t itemSiz MIR_CORE_DLL(void) List_ObjCopy(SortedList* s, SortedList* d, size_t itemSize);
///////////////////////////////////////////////////////////////////////////////
+// logging functions
+
+MIR_CORE_DLL(HANDLE) mir_createLog(const TCHAR *ptszFile, unsigned options);
+
+MIR_C_CORE_DLL(int) mir_writeLogA(HANDLE logger, const char *format, ...);
+MIR_C_CORE_DLL(int) mir_writeLogW(HANDLE logger, const WCHAR *format, ...);
+
+MIR_CORE_DLL(int) mir_writeLogVA(HANDLE logger, const char *format, va_list args);
+MIR_CORE_DLL(int) mir_writeLogVW(HANDLE logger, const WCHAR *format, va_list args);
+
+///////////////////////////////////////////////////////////////////////////////
// md5 functions
/* Define the state of the MD5 Algorithm. */
@@ -719,6 +730,9 @@ __forceinline char* lrtrimp(char *str) { return ltrimp(rtrim(str)); }; #define mir_sntprintf mir_snwprintf
#define mir_vsntprintf mir_vsnwprintf
+
+ #define mir_writeLogT mir_writeLogW
+ #define mir_writeLogVT mir_writeLogVW
#else
#define mir_t2a(s) mir_strdup(s)
#define mir_a2t(s) mir_strdup(s)
@@ -743,6 +757,9 @@ __forceinline char* lrtrimp(char *str) { return ltrimp(rtrim(str)); }; #define mir_sntprintf mir_snprintf
#define mir_vsntprintf mir_vsnprintf
+
+ #define mir_writeLogT mir_writeLogA
+ #define mir_writeLogVT mir_writeLogVA
#endif
MIR_CORE_DLL(WCHAR*) mir_a2u_cp(const char* src, int codepage);
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def index 32b1adecd8..c820c2dd59 100644 --- a/src/mir_core/mir_core.def +++ b/src/mir_core/mir_core.def @@ -222,3 +222,8 @@ ProtoGetAvatarFormat @219 ProtoGetAvatarExtension @220
ProtoGetBufferFormat @221
ProtoGetAvatarFileFormat @222
+mir_createLog @223
+mir_writeLogA @224
+mir_writeLogW @225
+mir_writeLogVA @226
+mir_writeLogVW @227
diff --git a/src/mir_core/mir_core_10.vcxproj b/src/mir_core/mir_core_10.vcxproj index d8c3514a63..0b5efe22f5 100644 --- a/src/mir_core/mir_core_10.vcxproj +++ b/src/mir_core/mir_core_10.vcxproj @@ -98,6 +98,7 @@ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">..\commonheaders.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
+ <ClCompile Include="logger.cpp" />
<ClCompile Include="protos.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
diff --git a/src/mir_core/mir_core_10.vcxproj.filters b/src/mir_core/mir_core_10.vcxproj.filters index 6d0a431685..1fafc175f9 100644 --- a/src/mir_core/mir_core_10.vcxproj.filters +++ b/src/mir_core/mir_core_10.vcxproj.filters @@ -97,6 +97,9 @@ <ClCompile Include="json\libJSON.cpp">
<Filter>Source Files\json</Filter>
</ClCompile>
+ <ClCompile Include="logger.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="commonheaders.h">
diff --git a/src/mir_core/mir_core_11.vcxproj b/src/mir_core/mir_core_11.vcxproj index f65e731e1d..e30f2719cc 100644 --- a/src/mir_core/mir_core_11.vcxproj +++ b/src/mir_core/mir_core_11.vcxproj @@ -93,6 +93,7 @@ <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">../commonheaders.h</PrecompiledHeaderFile>
<PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">../commonheaders.h</PrecompiledHeaderFile>
</ClCompile>
+ <ClCompile Include="logger.cpp" />
<ClCompile Include="protos.cpp" />
<ClCompile Include="stdafx.cpp">
<PrecompiledHeader>Create</PrecompiledHeader>
diff --git a/src/mir_core/mir_core_11.vcxproj.filters b/src/mir_core/mir_core_11.vcxproj.filters index 5603f49551..75eaf973e4 100644 --- a/src/mir_core/mir_core_11.vcxproj.filters +++ b/src/mir_core/mir_core_11.vcxproj.filters @@ -94,6 +94,9 @@ <ClCompile Include="json\libJSON.cpp">
<Filter>Source Files\json</Filter>
</ClCompile>
+ <ClCompile Include="logger.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="commonheaders.h">
diff --git a/src/mir_core/miranda.cpp b/src/mir_core/miranda.cpp index 571bbb811a..1508e3f4e7 100644 --- a/src/mir_core/miranda.cpp +++ b/src/mir_core/miranda.cpp @@ -29,6 +29,10 @@ HWND hAPCWindow = NULL; int InitPathUtils(void);
void (*RecalculateTime)(void);
+void CheckLogs();
+void InitLogs();
+void UninitLogs();
+
int hLangpack = 0;
HINSTANCE hInst = 0;
@@ -47,8 +51,12 @@ static LRESULT CALLBACK APCWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lP return 0;
}
+ if (msg == WM_TIMER)
+ CheckLogs();
+
if (msg == WM_TIMECHANGE && RecalculateTime)
RecalculateTime();
+
return DefWindowProc(hwnd, msg, wParam, lParam);
}
@@ -68,6 +76,7 @@ static void LoadCoreModule(void) hAPCWindow = CreateWindowEx(0, _T("STATIC"), NULL, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
SetWindowLongPtr(hAPCWindow, GWLP_WNDPROC, (LONG_PTR)APCWndProc);
+ SetTimer(hAPCWindow, 1, 60*1000, NULL);
hStackMutex = CreateMutex(NULL, FALSE, NULL);
hThreadQueueEmpty = CreateEvent(NULL, TRUE, TRUE, NULL);
@@ -79,6 +88,7 @@ static void LoadCoreModule(void) RecalculateTime = (void (*)()) GetProcAddress(mirInst, "RecalculateTime");
InitPathUtils();
+ InitLogs();
InitialiseModularEngine();
InitProtocols();
}
@@ -93,6 +103,7 @@ MIR_CORE_DLL(void) UnloadCoreModule(void) UninitSubclassing();
UninitProtocols();
DestroyModularEngine();
+ UninitLogs();
UnloadLangPackModule();
}
|