summaryrefslogtreecommitdiff
path: root/server/src/queryhandler.cc
diff options
context:
space:
mode:
authorbertho <bertho>2009-02-05 01:26:26 +0000
committerbertho <bertho>2009-02-05 01:26:26 +0000
commit551d4aa1be9f4d256df3fadca9a005a0f316adf8 (patch)
treeb3cae7ee51d5dc64d0d07ae7deffdd67d4f3f371 /server/src/queryhandler.cc
parent3ad20fdd0c8d5c20f0c02e3d1ad2e1e6b0f2a078 (diff)
Add a flexible debug interface. Please read the documentation.
Diffstat (limited to 'server/src/queryhandler.cc')
-rw-r--r--server/src/queryhandler.cc21
1 files changed, 7 insertions, 14 deletions
diff --git a/server/src/queryhandler.cc b/server/src/queryhandler.cc
index a6b6e1b..7077ab8 100644
--- a/server/src/queryhandler.cc
+++ b/server/src/queryhandler.cc
@@ -24,6 +24,8 @@
* along with Pracro; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
*/
+#include "debug.h"
+
#include "queryhandler.h"
#include <config.h>
@@ -156,9 +158,7 @@ QueryResult QueryHandler::exec(Query &query)
socket->write(header, strlen(header));
#endif/*WITHOUT_PENTOMINOS*/
-#ifdef WITH_DEBUG
- printf(header);
-#endif/*WITH_DEBUG*/
+ PRACRO_DEBUG(pentominos, header);
sprintf(buf, " <pentominos:entry cpr=\"%s\"\n"
" src_addr=\"%s\"\n"
@@ -179,9 +179,7 @@ QueryResult QueryHandler::exec(Query &query)
socket->write(buf, strlen(buf));
#endif/*WITHOUT_PENTOMINOS*/
-#ifdef WITH_DEBUG
- printf(buf);
-#endif/*WITH_DEBUG*/
+ PRACRO_DEBUG(pentominos, buf);
sprintf(buf, " <pentominos:query format=\"pracroxml\"\n"
" device_id=\"%s\"\n"
@@ -195,9 +193,7 @@ QueryResult QueryHandler::exec(Query &query)
socket->write(buf, strlen(buf));
#endif/*WITHOUT_PENTOMINOS*/
-#ifdef WITH_DEBUG
- printf(buf);
-#endif/*WITH_DEBUG*/
+ PRACRO_DEBUG(pentominos, buf);
sprintf(buf, "</artefact>");
@@ -205,10 +201,7 @@ QueryResult QueryHandler::exec(Query &query)
socket->write(buf, strlen(buf));
#endif/*WITHOUT_PENTOMINOS*/
-#ifdef WITH_DEBUG
- printf(buf);
- fflush(stdout);
-#endif/*WITH_DEBUG*/
+ PRACRO_DEBUG(pentominos, buf);
QueryResult result;
@@ -226,7 +219,7 @@ QueryResult QueryHandler::exec(Query &query)
result = parser.result;
#endif/*WITHOUT_PENTOMINOS*/
- printf("Done handling query\n");
+ PRACRO_DEBUG(pentominos, "Done handling query\n");
return result;
}