diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2003-10-17 15:35:43 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2003-10-17 15:35:43 +0000 |
| commit | fc2f5b2cd655f1391f2abda1b39e37cdec98a951 (patch) | |
| tree | 312efcea86a319de407a7c314fb981fb1c71019a /lib/base/eerror.cpp | |
| download | enigma2-fc2f5b2cd655f1391f2abda1b39e37cdec98a951.tar.gz enigma2-fc2f5b2cd655f1391f2abda1b39e37cdec98a951.zip | |
Initial revision
Diffstat (limited to 'lib/base/eerror.cpp')
| -rw-r--r-- | lib/base/eerror.cpp | 69 |
1 files changed, 69 insertions, 0 deletions
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 <lib/base/eerror.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include <lib/gui/emessage.h> + +int infatal=0; + +Signal2<void, int, const eString&> 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 |
