summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralberth <alberth@openttd.org>2010-09-11 11:48:37 +0000
committeralberth <alberth@openttd.org>2010-09-11 11:48:37 +0000
commitdfeac6ba2eb99e0b33d756210c052c306756753d (patch)
treea0c79ccfe4b69c0bb6a264fe4bd4550962291c01
parentc0ba81e617de24b1965814785faa75a00bc042f0 (diff)
downloadopenttd-dfeac6ba2eb99e0b33d756210c052c306756753d.tar.xz
(svn r20784) -Doc: Doxyment a few debug line printing functions.
-rw-r--r--src/debug.cpp21
-rw-r--r--src/debug.h5
2 files changed, 24 insertions, 2 deletions
diff --git a/src/debug.cpp b/src/debug.cpp
index 0ae0f455a..dea87850f 100644
--- a/src/debug.cpp
+++ b/src/debug.cpp
@@ -69,6 +69,11 @@ struct DebugLevel {
#if !defined(NO_DEBUG_MESSAGES)
+/**
+ * Internal function for outputting the debug line.
+ * @param dbg Debug category.
+ * @param buf Text line to output.
+ */
static void debug_print(const char *dbg, const char *buf)
{
#if defined(ENABLE_NETWORK)
@@ -99,6 +104,12 @@ static void debug_print(const char *dbg, const char *buf)
}
}
+/**
+ * Output a debug line.
+ * @note Do not call directly, use the #DEBUG macro instead.
+ * @param dbg Debug category.
+ * @param format Text string a la printf, with optional arguments.
+ */
void CDECL debug(const char *dbg, const char *format, ...)
{
char buf[1024];
@@ -112,6 +123,12 @@ void CDECL debug(const char *dbg, const char *format, ...)
}
#endif /* NO_DEBUG_MESSAGES */
+/**
+ * Set debugging levels by parsing the text in \a s.
+ * For setting individual levels a string like \c "net=3,grf=6" should be used.
+ * If the string starts with a number, the number is used as global debugging level.
+ * @param s Text describing the wanted debugging levels.
+ */
void SetDebugString(const char *s)
{
int v;
@@ -162,8 +179,8 @@ void SetDebugString(const char *s)
}
/**
- * Print out the current debug-level
- * Just return a string with the values of all the debug categorites
+ * Print out the current debug-level.
+ * Just return a string with the values of all the debug categories.
* @return string with debug-levels
*/
const char *GetDebugString()
diff --git a/src/debug.h b/src/debug.h
index de4c0c571..213872474 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -29,6 +29,11 @@
#ifdef NO_DEBUG_MESSAGES
#define DEBUG(name, level, ...) { }
#else /* NO_DEBUG_MESSAGES */
+ /**
+ * Output a line of debugging information.
+ * @param name Category
+ * @param level Debugging level, higher levels means more detailed information.
+ */
#define DEBUG(name, level, ...) if ((level) == 0 || _debug_ ## name ## _level >= (level)) debug(#name, __VA_ARGS__)
extern int _debug_ai_level;