diff options
author | George Hazan <george.hazan@gmail.com> | 2014-03-10 15:27:19 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2014-03-10 15:27:19 +0000 |
commit | 48db8129b4107b135bbc679992fa8c66560c9f9b (patch) | |
tree | dcc5327148d15308a78dd23d4d2d491525d42afd /src/mir_core | |
parent | 1825a479de6272b60a139d0675162469d8ee1d03 (diff) |
mir_closeLog - function to close a logger
git-svn-id: http://svn.miranda-ng.org/main/trunk@8543 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/mir_core')
-rw-r--r-- | src/mir_core/logger.cpp | 37 | ||||
-rw-r--r-- | src/mir_core/mir_core.def | 1 |
2 files changed, 24 insertions, 14 deletions
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
|