diff options
Diffstat (limited to 'Plugins/utils/mir_log.h')
-rw-r--r-- | Plugins/utils/mir_log.h | 53 |
1 files changed, 46 insertions, 7 deletions
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 <windows.h>
+#include <string>
+
+
+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__
|