5 * FIXME: It would be nice if, in lyx::use_gui mode, instead of
6 * outputting to the console, we would pipe all messages onto a file
7 * and visualise the contents dynamically in a Qt window if needed.
9 * This file is part of LyX, the document processor.
10 * Licence details can be found in the file COPYING.
12 * \author Lars Gullik Bjønnes
13 * \author Jean-Marc Lasgouttes
15 * Full author contact details are available in file CREDITS.
21 #include "support/debugstream.h"
22 #include "support/docstring.h"
27 /** Ideally this should have been a namespace, but since we try to be
28 * compilable on older C++ compilators too, we use a struct instead.
29 * This is all the different debug levels that we have.
31 class lyx_debug_trait {
46 PARSER = (1 << 4), // 16
48 LYXRC = (1 << 5), // 32
50 KBMAP = (1 << 6), // 64
52 LATEX = (1 << 7), // 128
54 MATHED = (1 << 8), // 256 // Alejandro, please use this.
56 FONT = (1 << 9), // 512
58 TCLASS = (1 << 10), // 1024
60 LYXVC = (1 << 11), // 2048
62 LYXSERVER = (1 << 12), // 4096
64 ROFF = (1 << 13), // 8192
66 ACTION = (1 << 14), // 16384
78 INSETTEXT = (1 << 20),
93 static bool match(type a, type b) {
97 /** A function to convert symbolic string names on debug levels
98 to their numerical value.
100 static type value(std::string const & val);
102 /** Display the tags and descriptions of the current debug level
105 static void showLevel(std::ostream & o, type level);
107 /** show all the possible tags that can be used for debugging */
108 static void showTags(std::ostream & o);
115 void operator|=(lyx_debug_trait::type & d1, lyx_debug_trait::type d2)
117 d1 = static_cast<lyx_debug_trait::type>(d1 | d2);
121 typedef basic_debugstream<lyx_debug_trait> LyXErr;
122 typedef LyXErr::debug Debug;
124 extern LyXErr lyxerr;
128 #define LYXERR(type) if (!lyx::lyxerr.debugging(type)) ; else lyx::lyxerr