From be94a568ef65120465b49f5c6db90cd4ec3c3eb2 Mon Sep 17 00:00:00 2001 From: pescuma Date: Sat, 24 Jan 2009 00:29:50 +0000 Subject: utils: sync with BerliOS git-svn-id: http://pescuma.googlecode.com/svn/trunk/Miranda@132 c086bb3d-8645-0410-b8da-73a8550f86e7 --- Plugins/utils/mir_log.h | 53 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 46 insertions(+), 7 deletions(-) (limited to 'Plugins/utils/mir_log.h') diff --git a/Plugins/utils/mir_log.h b/Plugins/utils/mir_log.h index 395c7e1..3ceca42 100644 --- a/Plugins/utils/mir_log.h +++ b/Plugins/utils/mir_log.h @@ -22,20 +22,59 @@ Boston, MA 02111-1307, USA. # define __LOG_H__ #include +#include + + +int mlog(const char *module, const char *function, const char *fmt, ...); +int mlog(const char *module, const char *function, const char *fmt, va_list va); +int mlogC(const char *module, const char *function, HANDLE hContact, const char *fmt, ...); + #ifdef __cplusplus -extern "C" + +class MLog { -#endif +private: + std::string module; + std::string function; + static int deep; -int mlog(const char *module, const char *function, const char *fmt, ...); -int mlogC(const char *module, const char *function, HANDLE hContact, const char *fmt, ...); +public: + MLog(const char *aModule, const char *aFunction) : module(aModule) + { + function = ""; + for(int i = 0; i < deep; i++) + function += " "; + function += aFunction; + deep ++; + + mlog(module.c_str(), function.c_str(), "BEGIN"); + } + + ~MLog() + { + mlog(module.c_str(), function.c_str(), "END"); + deep --; + } + + int log(const char *fmt, ...) + { + va_list va; + va_start(va, fmt); + + int ret = mlog(module.c_str(), function.c_str(), fmt, va); + + va_end(va); + + return ret; + } +}; + + +#endif __cplusplus -#ifdef __cplusplus -} -#endif #endif // __LOG_H__ -- cgit v1.2.3