1 #ifndef DEBUG_DEBUGGING_H
2 #define DEBUG_DEBUGGING_H
4 #include <boost/filesystem/fstream.hpp>
5 #include <boost/iostreams/stream.hpp>
9 #include <SDL_messagebox.h>
33 virtual std::streamsize
write(
const char *str, std::streamsize size);
40 virtual std::streamsize
writeImpl(
const char *str, std::streamsize size,
Level debugLevel)
46 #if defined(_WIN32) && defined(_DEBUG)
47 class DebugOutput :
public DebugOutputBase
50 std::streamsize writeImpl(
const char *str, std::streamsize size,
Level debugLevel)
53 std::string tmp (str, static_cast<unsigned int>(size));
55 OutputDebugString (tmp.c_str ());
59 virtual ~DebugOutput() {}
66 Tee(std::ostream &stream, std::ostream &stream2)
79 virtual std::streamsize
writeImpl(
const char *str, std::streamsize size,
Level debugLevel)
81 out.write (str, size);
87 out2.write (str, size);
92 out2.write(str, size);
109 char *term = getenv(
"TERM");
110 bool useColor = term && !getenv(
"NO_COLOR") && isatty(fileno(
stderr));
125 int wrapApplication(
int (*innerApplication)(
int argc,
char *argv[]),
int argc,
char *argv[],
const std::string& appName);
Definition: debugging.hpp:19
bool mUseColor
Definition: debugging.hpp:118
Definition: debuglog.hpp:12
Definition: debuglog.hpp:13
Definition: debugging.hpp:20
Definition: debugging.hpp:24
virtual std::streamsize writeImpl(const char *str, std::streamsize size, Level debugLevel)
Definition: debugging.hpp:40
static void fillCurrentDebugLevel()
Definition: debugging.cpp:31
Level
Definition: debuglog.hpp:9
Definition: debugging.hpp:18
Definition: debuglog.hpp:14
virtual std::streamsize write(const char *str, std::streamsize size)
Definition: debugging.cpp:7
DebugOutputBase()
Definition: debugging.hpp:27
std::ostream & out
Definition: debugging.hpp:116
Level CurrentDebugLevel
Definition: debuglog.cpp:5
std::ostream & out2
Definition: debugging.hpp:117
Definition: debuglog.hpp:15
virtual std::streamsize writeImpl(const char *str, std::streamsize size, Level debugLevel)
Definition: debugging.hpp:79
Definition: debuglog.hpp:11
int stderr
Definition: android_main.c:1
Tee(std::ostream &stream, std::ostream &stream2)
Definition: debugging.hpp:66
virtual ~Tee()
Definition: debugging.hpp:99
static Level getLevelMarker(const char *str)
Definition: debugging.cpp:21
static bool useColoredOutput()
Definition: debugging.hpp:103
Definition: debugging.hpp:21
Definition: debugging.hpp:63
Color
Definition: debugging.hpp:16
int wrapApplication(int(*innerApplication)(int argc, char *argv[]), int argc, char *argv[], const std::string &appName)
Definition: debugging.cpp:53
std::map< Level, int > mColors
Definition: debugging.hpp:120