From e829b175730fb93081612392c9da8332c8d66586 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Wed, 5 Mar 2014 11:28:19 +0100 Subject: Use hugin module instead of old debug code. --- server/src/sessionheaderparser.cc | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) (limited to 'server/src/sessionheaderparser.cc') diff --git a/server/src/sessionheaderparser.cc b/server/src/sessionheaderparser.cc index afdaa65..b62e122 100644 --- a/server/src/sessionheaderparser.cc +++ b/server/src/sessionheaderparser.cc @@ -54,28 +54,20 @@ #include #include -#include "debug.h" +#include #include "configuration.h" #include "exception.h" void SessionHeaderParser::error(const char* fmt, ...) { - ERR_LOG(session, "Error in SessionHeaderParser: "); - - { - va_list argp; - va_start(argp, fmt); - ERR_LOG_VA(session, fmt, argp); - va_end(argp); - - fprintf(stderr, "\n"); - } + ERR(session, "Error in SessionHeaderParser: "); { char *p; va_list argp; va_start(argp, fmt); if(vasprintf(&p, fmt, argp) != -1) { + ERR(session, "%s", p); throw Exception("Error in SessionHeaderParser: " + std::string(p)); free(p); } @@ -129,12 +121,12 @@ int SessionHeaderParser::readData(char *data, size_t size) // for and can dismiss the rest of the document. if(fd == -1) { - ERR_LOG(session, "Invalid file descriptor.\n"); + ERR(session, "Invalid file descriptor.\n"); return 0; } ssize_t r = read(fd, data, size); if(r == -1) { - ERR_LOG(session, "Could not read...%s\n", strerror(errno)); + ERR(session, "Could not read...%s\n", strerror(errno)); return 0; } return r; @@ -145,11 +137,11 @@ void SessionHeaderParser::parseError(const char *buf, size_t len, std::string er if(done) return; // If done is true we already found what we were looking // for and can dismiss the rest of the document. - ERR_LOG(session, "SessionHeaderParser[%s] error at line %d: %s\n", + ERR(session, "SessionHeaderParser[%s] error at line %d: %s\n", file.c_str(), lineno, error.c_str()); - ERR_LOG(session, "\tBuffer %u bytes: [", (int)len); + ERR(session, "\tBuffer %u bytes: [", (int)len); if(fwrite(buf, len, 1, stderr) != len) {} - ERR_LOG(session, "]\n"); + ERR(session, "]\n"); char *slineno; if(asprintf(&slineno, " at line %d\n", lineno) != -1) { -- cgit v1.2.3