4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
7 * \author Lars Gullik Bjønnes
8 * \author Jean-Marc Lasgouttes
10 * Full author contact details are available in file CREDITS.
16 #include "support/debugstream.h"
17 #include "support/docstring.h"
22 /** Ideally this should have been a namespace, but since we try to be
23 * compilable on older C++ compilators too, we use a struct instead.
24 * This is all the different debug levels that we have.
26 class lyx_debug_trait {
40 static bool match(type a, type b) { return (a & b); }
42 /** A function to convert symbolic string names on debug levels
43 to their numerical value.
45 static type value(std::string const & val);
47 /** Display the tags and descriptions of the current debug level
50 static void showLevel(std::ostream & o, type level);
52 /** show all the possible tags that can be used for debugging */
53 static void showTags(std::ostream & o);
60 void operator|=(lyx_debug_trait::type & d1, lyx_debug_trait::type d2)
62 d1 = static_cast<lyx_debug_trait::type>(d1 | d2);
66 typedef basic_debugstream<lyx_debug_trait> LyXErr;
67 typedef LyXErr::debug Debug;
73 #define LYXERR(type, msg) \
74 do { if (!lyx::lyxerr.debugging(type)) {} \
75 else lyx::lyxerr << msg << std::endl; } while (0)