From 551d4aa1be9f4d256df3fadca9a005a0f316adf8 Mon Sep 17 00:00:00 2001 From: bertho Date: Thu, 5 Feb 2009 01:26:26 +0000 Subject: Add a flexible debug interface. Please read the documentation. --- server/src/pracrod.cc | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'server/src/pracrod.cc') diff --git a/server/src/pracrod.cc b/server/src/pracrod.cc index 634ae67..a1c8ba1 100644 --- a/server/src/pracrod.cc +++ b/server/src/pracrod.cc @@ -62,6 +62,8 @@ #include "tcpsocket.h" +#include "debug.h" + static const char version_str[] = "Pracro server v" VERSION "\n" ; @@ -85,6 +87,7 @@ static const char usage_str[] = " -x, --xml-basedir d Use 'd' as basedir for finding template- and macro-files (default "XML").\n" " -v, --version Print version information and exit.\n" " -h, --help Print this message and exit.\n" +" -D, --debug ddd Enable debug messages on 'ddd'; see documentation for details\n" ; ConfigurationParser *configparser = NULL; @@ -141,6 +144,9 @@ int main(int argc, char *argv[]) char *group = NULL; bool foreground = false; char *xml_basedir = NULL; + char *debugstr = NULL; + + pracro_debug_init(); int option_index = 0; while(1) { @@ -153,10 +159,11 @@ int main(int argc, char *argv[]) {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'v'}, {"xml-basedir", required_argument, 0, 'x'}, + {"debug", required_argument, 0, 'D'}, {0, 0, 0, 0} }; - c = getopt_long (argc, argv, "hvfc:u:g:x:", long_options, &option_index); + c = getopt_long (argc, argv, "D:hvfc:u:g:x:", long_options, &option_index); if (c == -1) break; @@ -182,6 +189,10 @@ int main(int argc, char *argv[]) xml_basedir = strdup(optarg); break; + case 'D': + debugstr = strdup(optarg); + break; + case '?': case 'h': printf(version_str); @@ -198,6 +209,10 @@ int main(int argc, char *argv[]) } } + if(debugstr) { + pracro_debug_parse(debugstr); + } + // Load config if(configfile) configparser = new ConfigurationParser(configfile); else configparser = new ConfigurationParser(ETC"/pracrod.conf"); -- cgit v1.2.3