From d63d2c3c6cbbd574dda4f8b00ebe6c661735edd5 Mon Sep 17 00:00:00 2001 From: Felix Domke Date: Fri, 17 Oct 2003 15:36:42 +0000 Subject: import of enigma2 --- lib/base/eerror.cpp | 69 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 lib/base/eerror.cpp (limited to 'lib/base/eerror.cpp') diff --git a/lib/base/eerror.cpp b/lib/base/eerror.cpp new file mode 100644 index 00000000..0871bb71 --- /dev/null +++ b/lib/base/eerror.cpp @@ -0,0 +1,69 @@ +#include +#include +#include +#include +#include + +#include + +int infatal=0; + +Signal2 logOutput; +int logOutputConsole=1; + +void eFatal(const char* fmt, ...) +{ + char buf[1024]; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, 1024, fmt, ap); + va_end(ap); + logOutput(lvlFatal, buf); + fprintf(stderr, "%s\n",buf ); + if (!infatal) + { + infatal=1; + eMessageBox msg(buf, "FATAL ERROR", eMessageBox::iconError|eMessageBox::btOK); + msg.show(); + msg.exec(); + } + _exit(0); +} + +#ifdef DEBUG +void eDebug(const char* fmt, ...) +{ + char buf[1024]; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, 1024, fmt, ap); + va_end(ap); + logOutput(lvlDebug, eString(buf) + "\n"); + if (logOutputConsole) + fprintf(stderr, "%s\n", buf); +} + +void eDebugNoNewLine(const char* fmt, ...) +{ + char buf[1024]; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, 1024, fmt, ap); + va_end(ap); + logOutput(lvlDebug, buf); + if (logOutputConsole) + fprintf(stderr, "%s", buf); +} + +void eWarning(const char* fmt, ...) +{ + char buf[1024]; + va_list ap; + va_start(ap, fmt); + vsnprintf(buf, 1024, fmt, ap); + va_end(ap); + logOutput(lvlWarning, eString(buf) + "\n"); + if (logOutputConsole) + fprintf(stderr, "%s\n", buf); +} +#endif // DEBUG -- cgit v1.2.3