aboutsummaryrefslogtreecommitdiff
path: root/lib/base/eerror.h
blob: bf9139595b2b93282205def21d83167f16ba94e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef __E_ERROR__
#define __E_ERROR__

#include "config.h"
#include <string>
#include <map>       
#include <new>
#include <libsig_comp.h>

void eFatal(const char* fmt, ...);

class eString;

enum { lvlDebug=1, lvlWarning=2, lvlFatal=4 };

extern Signal2<void, int, const eString&> logOutput;
extern int logOutputConsole;

#ifdef ASSERT
#undef ASSERT
#endif

#ifdef DEBUG
    void eDebug(const char* fmt, ...);
    void eDebugNoNewLine(const char* fmt, ...);
    void eWarning(const char* fmt, ...);
    #define ASSERT(x) { if (!(x)) eFatal("%s:%d ASSERTION %s FAILED!", __FILE__, __LINE__, #x); }
#else
    inline void eDebug(const char* fmt, ...)
    {
    }

    inline void eDebugNoNewLine(const char* fmt, ...)
    {
    }

    inline void eWarning(const char* fmt, ...)
    {
    }
    #define ASSERT(x) do { } while (0)
#endif //DEBUG

#endif // __E_ERROR__