summaryrefslogtreecommitdiff
path: root/plugins/!NotAdopted/XSoundNotify/DebugLogger.hpp
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2013-04-02 13:26:06 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2013-04-02 13:26:06 +0000
commit8d3307adf7ba64b75fb4de363f873c97286b0e9b (patch)
tree1f89dccbcd641f2df5d793ee3a3a5c6c745d898c /plugins/!NotAdopted/XSoundNotify/DebugLogger.hpp
parent626e01829f5d9946e831cbf66ad49a13103f91bb (diff)
- XSoundNotify - adopted
git-svn-id: http://svn.miranda-ng.org/main/trunk@4284 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/!NotAdopted/XSoundNotify/DebugLogger.hpp')
-rw-r--r--plugins/!NotAdopted/XSoundNotify/DebugLogger.hpp91
1 files changed, 0 insertions, 91 deletions
diff --git a/plugins/!NotAdopted/XSoundNotify/DebugLogger.hpp b/plugins/!NotAdopted/XSoundNotify/DebugLogger.hpp
deleted file mode 100644
index 3b2c5a5fc1..0000000000
--- a/plugins/!NotAdopted/XSoundNotify/DebugLogger.hpp
+++ /dev/null
@@ -1,91 +0,0 @@
-#ifndef _GRS_DEBUG_LOGGER_H
-#define _GRS_DEBUG_LOGGER_H
-
-#include <fstream>
-#include <sstream>
-#include <ctime>
-#include <memory>
-
-/**
- * Простой логгер, который можно использовать в любом месте для вывода отладочной информации
- * При выводе обычного сообщения надо использовать макрос GRS_DEBUG_LOG
- * Для вывода сложного сообщения с использованием операторов ввода/вывода макрос GRS_DEBUG_FORMAT_LOG
- * Лог сохраняется в рабочем каталоге под именем : grs_debug.log
- */
-
-namespace grs
-{
-
-class DebugLogger
-{
-public:
- class Except : public std::exception
- {
- public:
- virtual const char * what() const throw() { return "pizda rulu"; }
- };
-
- DebugLogger()
- {
- try
- {
- _strm.open("D:\\grs_debug.log", std::ios::app);
- }
- catch (...)
- {
- throw Except();
- }
- if (!_strm.is_open())
- throw Except();
-
- log("Logger started");
- }
-
- void log(const std::string & str, const char * fileStr = 0, int line = 0)
- {
- if (!_strm.is_open())
- return ;
-
- time_t t(time(0));
- struct tm * timeinfo;
- timeinfo = localtime (&t);
- char timeStr[9];
- strftime (timeStr, 9, "%H:%M:%S", timeinfo);
- _strm << "[" << timeStr << "] ";
- if (fileStr)
- _strm << fileStr << ":" << line<<" ";
- _strm <<"# "<< str << std::endl;
- }
-
- static DebugLogger * instance()
- {
- //static DebugLogger * logger = 0;
- static std::auto_ptr<DebugLogger> loggerPtr;
- if (loggerPtr.get() == 0)
- loggerPtr.reset(new DebugLogger());
- return loggerPtr.get();
- }
-
-private:
- std::ofstream _strm;
-};
-
-}
-
-#define GRS_DEBUG_FORMAT_LOG(data) {\
- grs::DebugLogger * l = grs::DebugLogger::instance();\
- if (l != 0) \
- {\
- std::stringstream strm;\
- strm << data;\
- l->log(strm.str(), __FILE__, __LINE__);\
- }\
- }
-
-#define GRS_DEBUG_LOG(data) {\
- grs::DebugLogger * l = grs::DebugLogger::instance();\
- if (l != 0)\
- l->log(data, __FILE__, __LINE__);\
- }
-
-#endif