Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Commit time: 2004-09-23 00:37:06 UTC
Modified files:
Doxyfile include/s_debug.h ircd/s_debug.c
Log message:
Doxyfy s_debug.h and s_debug.c.
Add DEBUGMODE to Doxygen PREDEFINED list to index debugging code.
---------------------- diff included ----------------------
Index: ircu2.10/Doxyfile
diff -u ircu2.10/Doxyfile:1.2 ircu2.10/Doxyfile:1.3
--- ircu2.10/Doxyfile:1.2 Tue Sep 21 08:13:10 2004
+++ ircu2.10/Doxyfile Wed Sep 22 17:36:54 2004
@@ -875,7 +875,7 @@
# or name=definition (no spaces). If the definition and the = are
# omitted =1 is assumed.
-PREDEFINED =
+PREDEFINED = DEBUGMODE
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
# this tag can be used to specify a list of macro names that should be expanded.
Index: ircu2.10/include/s_debug.h
diff -u ircu2.10/include/s_debug.h:1.10 ircu2.10/include/s_debug.h:1.11
--- ircu2.10/include/s_debug.h:1.10 Sat Sep 11 20:53:44 2004
+++ ircu2.10/include/s_debug.h Wed Sep 22 17:36:55 2004
@@ -1,7 +1,7 @@
/*
* s_debug.h
*
- * $Id: s_debug.h,v 1.10 2004/09/12 03:53:44 entrope Exp $
+ * $Id: s_debug.h,v 1.11 2004/09/23 00:36:55 entrope Exp $
*/
#ifndef INCLUDED_s_debug_h
#define INCLUDED_s_debug_h
@@ -25,23 +25,25 @@
* Macro's
*/
+/** If DEBUGMODE is defined, output the debug message.
+ * @param x A two-or-more element list containing level, format and arguments.
+ */
#define Debug(x) debug x
-#define LOGFILE LPATH
+#define LOGFILE LPATH /**< Path to debug log file. */
/*
* defined debugging levels
*/
-#define DEBUG_FATAL 0
-#define DEBUG_ERROR 1 /* report_error() and other errors that are found */
-#define DEBUG_NOTICE 3
-#define DEBUG_DNS 4 /* used by all DNS related routines - a *lot* */
-#define DEBUG_INFO 5 /* general useful info */
-#define DEBUG_NUM 6 /* numerics */
-#define DEBUG_SEND 7 /* everything that is sent out */
-#define DEBUG_DEBUG 8 /* everything that is received */
-#define DEBUG_MALLOC 9 /* malloc/free calls */
-#define DEBUG_LIST 10 /* debug list use */
-#define DEBUG_ENGINE 11 /* debug event engine; can dump gigabyte logs */
+#define DEBUG_FATAL 0 /**< fatal error */
+#define DEBUG_ERROR 1 /**< report_error() and other errors that are found */
+#define DEBUG_NOTICE 3 /**< somewhat useful, but non-critical, messages */
+#define DEBUG_DNS 4 /**< used by all DNS related routines - a *lot* */
+#define DEBUG_INFO 5 /**< general useful info */
+#define DEBUG_SEND 7 /**< everything that is sent out */
+#define DEBUG_DEBUG 8 /**< everything that is received */
+#define DEBUG_MALLOC 9 /**< malloc/free calls */
+#define DEBUG_LIST 10 /**< debug list use */
+#define DEBUG_ENGINE 11 /**< debug event engine; can dump gigabyte logs */
/*
* proto types
Index: ircu2.10/ircd/s_debug.c
diff -u ircu2.10/ircd/s_debug.c:1.31 ircu2.10/ircd/s_debug.c:1.32
--- ircu2.10/ircd/s_debug.c:1.31 Mon Sep 13 15:33:31 2004
+++ ircu2.10/ircd/s_debug.c Wed Sep 22 17:36:56 2004
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
- * $Id: s_debug.c,v 1.31 2004/09/13 22:33:31 entrope Exp $
+ * $Id: s_debug.c,v 1.32 2004/09/23 00:36:56 entrope Exp $
*
*/
#include "config.h"
@@ -63,6 +63,9 @@
*/
static char serveropts[256]; /* should be large enough for anything */
+/** Return a string describing important configuration information.
+ * @return Pointer to a static buffer.
+ */
const char* debug_serveropts(void)
{
int bp;
@@ -111,15 +114,14 @@
return serveropts;
}
-/*
- * debug_init
- *
+/** Initialize debugging.
* If the -t option is not given on the command line when the server is
* started, all debugging output is sent to the file set by LPATH in config.h
* Here we just open that file and make sure it is opened to fd 2 so that
* any fprintf's to stderr also goto the logfile. If the debuglevel is not
* set from the command line by -x, use /dev/null as the dummy logfile as long
* as DEBUGMODE has been defined, else dont waste the fd.
+ * @param use_tty Passed to log_debug_init().
*/
void debug_init(int use_tty)
{
@@ -132,6 +134,12 @@
}
#ifdef DEBUGMODE
+/** Log a debug message using a va_list.
+ * If the current #debuglevel is less than \a level, do not display.
+ * @param level Debug level for message.
+ * @param form Format string, passed to log_vwrite().
+ * @param vl Varargs argument list for format string.
+ */
void vdebug(int level, const char *form, va_list vl)
{
static int loop = 0;
@@ -146,6 +154,11 @@
errno = err;
}
+/** Log a debug message using a variable number of arguments.
+ * This is a simple wrapper around debug(\a level, \a form, vl).
+ * @param level Debug level for message.
+ * @param form Format string of message.
+ */
void debug(int level, const char *form, ...)
{
va_list vl;
@@ -154,18 +167,20 @@
va_end(vl);
}
+/** Send a literal RPL_STATSDEBUG message to a user.
+ * @param cptr Client to receive the message.
+ * @param msg Text message to send to user.
+ */
static void debug_enumerator(struct Client* cptr, const char* msg)
{
assert(0 != cptr);
send_reply(cptr, SND_EXPLICIT | RPL_STATSDEBUG, ":%s", msg);
}
-/*
- * This is part of the STATS replies. There is no offical numeric for this
- * since this isnt an official command, in much the same way as HASH isnt.
- * It is also possible that some systems wont support this call or have
- * different field names for "struct rusage".
- * -avalon
+/** Send resource usage statistics to a client.
+ * @param cptr Client to send data to.
+ * @param sd StatDesc that generated the stats request (ignored).
+ * @param param Extra parameter from user (ignored).
*/
void send_usage(struct Client *cptr, const struct StatDesc *sd,
char *param)
@@ -177,6 +192,11 @@
}
#endif /* DEBUGMODE */
+/** Report memory usage statistics to a client.
+ * @param cptr Client to send data to.
+ * @param sd StatDesc that generated the stats request (ignored).
+ * @param param Extra parameter from user (ignored).
+ */
void count_memory(struct Client *cptr, const struct StatDesc *sd,
char *param)
{
----------------------- End of diff -----------------------