summaryrefslogtreecommitdiff
path: root/server/src/macroparser.cc
diff options
context:
space:
mode:
Diffstat (limited to 'server/src/macroparser.cc')
-rw-r--r--server/src/macroparser.cc18
1 files changed, 9 insertions, 9 deletions
diff --git a/server/src/macroparser.cc b/server/src/macroparser.cc
index ae7f648..c5b524d 100644
--- a/server/src/macroparser.cc
+++ b/server/src/macroparser.cc
@@ -24,6 +24,7 @@
* 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 "macroparser.h"
#include "configuration.h"
@@ -53,11 +54,11 @@ void MacroParser::error(const char* fmt, ...)
{
// TODO: Throw exception here.
- fprintf(stderr, "Error in MacroParser: ");
+ PRACRO_ERR_LOG(macro, "Error in MacroParser: ");
va_list argp;
va_start(argp, fmt);
- vfprintf(stderr, fmt, argp);
+ PRACRO_ERR_LOG_VA(macro, fmt, argp);
va_end(argp);
fprintf(stderr, "\n");
@@ -74,7 +75,7 @@ MacroParser::MacroParser(std::string macro)
file = Conf::xml_basedir + "/macros/" + macro + ".xml";
- printf("Using macro file: %s\n", file.c_str());
+ PRACRO_DEBUG(macro, "Using macro file: %s\n", file.c_str());
fd = open(file.c_str(), O_RDONLY);
if(fd == -1) error("Could not open file %s", file.c_str());
@@ -280,12 +281,12 @@ void MacroParser::endTag(std::string name)
int MacroParser::readData(char *data, size_t size)
{
if(fd == -1) {
- fprintf(stderr, "Invalid file descriptor.\n"); fflush(stderr);
+ PRACRO_ERR_LOG(macro, "Invalid file descriptor.\n");
return 0;
}
ssize_t r = read(fd, data, size);
if(r == -1) {
- printf("Could not read...%s\n", strerror(errno)); fflush(stdout);
+ PRACRO_ERR_LOG(macro, "Could not read...%s\n", strerror(errno));
return 0;
}
return r;
@@ -293,11 +294,10 @@ int MacroParser::readData(char *data, size_t size)
void MacroParser::parseError(char *buf, size_t len, std::string error, int lineno)
{
- fprintf(stderr, "MacroParser[%s] error at line %d: %s\n", file.c_str(), lineno, error.c_str());
- fprintf(stderr, "\tBuffer %u bytes: [", len);
+ PRACRO_ERR_LOG(macro, "MacroParser[%s] error at line %d: %s\n", file.c_str(), lineno, error.c_str());
+ PRACRO_ERR_LOG(macro, "\tBuffer %u bytes: [", len);
if(fwrite(buf, len, 1, stderr) != len) {}
- fprintf(stderr, "]\n");
- fflush(stderr);
+ PRACRO_ERR_LOG(macro, "]\n");
}
Macro *MacroParser::getMacro()