summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-03-10 15:27:19 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-03-10 15:27:19 +0000
commit48db8129b4107b135bbc679992fa8c66560c9f9b (patch)
treedcc5327148d15308a78dd23d4d2d491525d42afd
parent1825a479de6272b60a139d0675162469d8ee1d03 (diff)
mir_closeLog - function to close a logger
git-svn-id: http://svn.miranda-ng.org/main/trunk@8543 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--bin10/lib/mir_core.libbin57836 -> 58042 bytes
-rw-r--r--bin10/lib/mir_core64.libbin52906 -> 53092 bytes
-rw-r--r--bin12/lib/mir_core.libbin57836 -> 58042 bytes
-rw-r--r--bin12/lib/mir_core64.libbin52906 -> 53092 bytes
-rw-r--r--include/m_core.h9
-rw-r--r--src/mir_core/logger.cpp37
-rw-r--r--src/mir_core/mir_core.def1
7 files changed, 29 insertions, 18 deletions
diff --git a/bin10/lib/mir_core.lib b/bin10/lib/mir_core.lib
index b71d6698e8..057f5434c2 100644
--- a/bin10/lib/mir_core.lib
+++ b/bin10/lib/mir_core.lib
Binary files differ
diff --git a/bin10/lib/mir_core64.lib b/bin10/lib/mir_core64.lib
index 224b1a9f9b..16730a7938 100644
--- a/bin10/lib/mir_core64.lib
+++ b/bin10/lib/mir_core64.lib
Binary files differ
diff --git a/bin12/lib/mir_core.lib b/bin12/lib/mir_core.lib
index 65dafe1ba7..19a4a5814c 100644
--- a/bin12/lib/mir_core.lib
+++ b/bin12/lib/mir_core.lib
Binary files differ
diff --git a/bin12/lib/mir_core64.lib b/bin12/lib/mir_core64.lib
index be5ed5f863..4427f5aa3c 100644
--- a/bin12/lib/mir_core64.lib
+++ b/bin12/lib/mir_core64.lib
Binary files differ
diff --git a/include/m_core.h b/include/m_core.h
index 8e07713656..921b87b2ce 100644
--- a/include/m_core.h
+++ b/include/m_core.h
@@ -534,12 +534,13 @@ MIR_CORE_DLL(void) List_ObjCopy(SortedList* s, SortedList* d, size_t item
// logging functions
MIR_CORE_DLL(HANDLE) mir_createLog(const char *pszName, const TCHAR *ptszDescr, const TCHAR *ptszFile, unsigned options);
+MIR_CORE_DLL(void) mir_closeLog(HANDLE hLogger);
-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_C_CORE_DLL(int) mir_writeLogA(HANDLE hLogger, const char *format, ...);
+MIR_C_CORE_DLL(int) mir_writeLogW(HANDLE hLogger, 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);
+MIR_CORE_DLL(int) mir_writeLogVA(HANDLE hLogger, const char *format, va_list args);
+MIR_CORE_DLL(int) mir_writeLogVW(HANDLE hLogger, const WCHAR *format, va_list args);
///////////////////////////////////////////////////////////////////////////////
// md5 functions
diff --git a/src/mir_core/logger.cpp b/src/mir_core/logger.cpp
index bb42e0444c..4f4aa1a353 100644
--- a/src/mir_core/logger.cpp
+++ b/src/mir_core/logger.cpp
@@ -29,9 +29,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
struct Logger
{
Logger(const char* pszName, const TCHAR *ptszDescr, const TCHAR *ptszFilename, unsigned options) :
- m_name( mir_strdup(pszName)),
- m_descr( mir_tstrdup(ptszDescr)),
- m_fileName( mir_tstrdup(ptszFilename)),
+ m_name(mir_strdup(pszName)),
+ m_descr(mir_tstrdup(ptszDescr)),
+ m_fileName(mir_tstrdup(ptszFilename)),
m_options(options),
m_signature(SECRET_SIGNATURE),
m_out(NULL),
@@ -127,18 +127,27 @@ MIR_CORE_DLL(HANDLE) mir_createLog(const char* pszName, const TCHAR *ptszDescr,
////////////////////////////////////////////////////////////////////////////////////////////////
-static Logger* prepareLogger(HANDLE logger)
+static Logger* prepareLogger(HANDLE hLogger)
{
- if (logger == NULL)
+ if (hLogger == NULL)
return NULL;
- Logger *p = (Logger*)logger;
+ Logger *p = (Logger*)hLogger;
return (p->m_signature == SECRET_SIGNATURE) ? p : NULL;
}
-MIR_C_CORE_DLL(int) mir_writeLogA(HANDLE logger, const char *format, ...)
+MIR_CORE_DLL(void) mir_closeLog(HANDLE hLogger)
{
- Logger *p = prepareLogger(logger);
+ Logger *p = prepareLogger(hLogger);
+ if (p != NULL)
+ arLoggers.remove(p);
+}
+
+////////////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_C_CORE_DLL(int) mir_writeLogA(HANDLE hLogger, const char *format, ...)
+{
+ Logger *p = prepareLogger(hLogger);
if (p == NULL)
return 1;
@@ -157,9 +166,9 @@ MIR_C_CORE_DLL(int) mir_writeLogA(HANDLE logger, const char *format, ...)
return 0;
}
-MIR_C_CORE_DLL(int) mir_writeLogW(HANDLE logger, const WCHAR *format, ...)
+MIR_C_CORE_DLL(int) mir_writeLogW(HANDLE hLogger, const WCHAR *format, ...)
{
- Logger *p = prepareLogger(logger);
+ Logger *p = prepareLogger(hLogger);
if (p == NULL)
return 1;
@@ -180,9 +189,9 @@ 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_writeLogVA(HANDLE hLogger, const char *format, va_list args)
{
- Logger *p = prepareLogger(logger);
+ Logger *p = prepareLogger(hLogger);
if (p == NULL)
return 1;
@@ -199,9 +208,9 @@ MIR_CORE_DLL(int) mir_writeLogVA(HANDLE logger, const char *format, va_list args
return 0;
}
-MIR_CORE_DLL(int) mir_writeLogVW(HANDLE logger, const WCHAR *format, va_list args)
+MIR_CORE_DLL(int) mir_writeLogVW(HANDLE hLogger, const WCHAR *format, va_list args)
{
- Logger *p = prepareLogger(logger);
+ Logger *p = prepareLogger(hLogger);
if (p == NULL)
return 1;
diff --git a/src/mir_core/mir_core.def b/src/mir_core/mir_core.def
index 647a78b946..b017a5f246 100644
--- a/src/mir_core/mir_core.def
+++ b/src/mir_core/mir_core.def
@@ -258,3 +258,4 @@ db_mc_getSubCount @255
db_mc_getSub @256
db_mc_setDefault @257
db_mc_setDefaultNum @258
+mir_closeLog @259