summaryrefslogtreecommitdiff
path: root/server/src/macroheaderparser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/macroheaderparser.cc')
-rw-r--r--server/src/macroheaderparser.cc24
1 files changed, 8 insertions, 16 deletions
diff --git a/server/src/macroheaderparser.cc b/server/src/macroheaderparser.cc
index 84efaee..a09686c 100644
--- a/server/src/macroheaderparser.cc
+++ b/server/src/macroheaderparser.cc
@@ -44,28 +44,20 @@
#include <errno.h>
#include <string.h>
-#include "debug.h"
+#include <hugin.hpp>
#include "configuration.h"
#include "exception.h"
void MacroHeaderParser::error(const char* fmt, ...)
{
- ERR_LOG(macro, "Error in MacroHeaderParser: ");
-
- {
- va_list argp;
- va_start(argp, fmt);
- ERR_LOG_VA(macro, fmt, argp);
- va_end(argp);
-
- fprintf(stderr, "\n");
- }
+ ERR(macro, "Error in MacroHeaderParser: ");
{
char *p;
va_list argp;
va_start(argp, fmt);
if(vasprintf(&p, fmt, argp) != -1) {
+ ERR(macro, "%s", p);
throw Exception("Error in MacroHeaderParser: " + std::string(p));
free(p);
}
@@ -112,12 +104,12 @@ int MacroHeaderParser::readData(char *data, size_t size)
// tag, and can dismiss the rest of the document.
if(fd == -1) {
- ERR_LOG(macro, "Invalid file descriptor.\n");
+ ERR(macro, "Invalid file descriptor.\n");
return 0;
}
ssize_t r = read(fd, data, size);
if(r == -1) {
- ERR_LOG(macro, "Could not read...%s\n", strerror(errno));
+ ERR(macro, "Could not read...%s\n", strerror(errno));
return 0;
}
return r;
@@ -127,11 +119,11 @@ void MacroHeaderParser::parseError(const char *buf, size_t len, std::string erro
{
if(m) return; // Ignore "unclosed token" errors when the macro tag has been parsed.
- ERR_LOG(macro, "MacroHeaderParser[%s] error at line %d: %s\n",
+ ERR(macro, "MacroHeaderParser[%s] error at line %d: %s\n",
file.c_str(), lineno, error.c_str());
- ERR_LOG(macro, "\tBuffer %u bytes: [", (int)len);
+ ERR(macro, "\tBuffer %u bytes: [", (int)len);
if(fwrite(buf, len, 1, stderr) != len) {}
- ERR_LOG(macro, "]\n");
+ ERR(macro, "]\n");
char *slineno;
if(asprintf(&slineno, " at line %d\n", lineno) != -1) {