summaryrefslogtreecommitdiff
path: root/logging.c
diff options
context:
space:
mode:
authorLuke Bratch <luke@bratch.co.uk>2019-05-27 23:01:11 +0100
committerLuke Bratch <luke@bratch.co.uk>2019-05-27 23:01:11 +0100
commit31ce10b31198128de4983667820319a193adb976 (patch)
tree99ff7bc13815f25c13a8d994b7dc28d302e72225 /logging.c
parent4b2cd5c4c349ea3e5683a6b2beb42c518d3ccef3 (diff)
Make debug output optional and disabled by default.
Diffstat (limited to 'logging.c')
-rw-r--r--logging.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/logging.c b/logging.c
index a4698c6..dcadb26 100644
--- a/logging.c
+++ b/logging.c
@@ -55,7 +55,7 @@ int logline(char *str, char *ournick, char *basedir, int type) {
}
// Copy into the token array (strlen + 1 to get the NULL terminator)
strncpy(tokens[i], token, strlen(token) + 1);
- printf("logline(): extracted '%s'.\n", tokens[i]);
+ debugprint("logline(): extracted '%s'.\n", tokens[i]);
}
switch(type) {
@@ -75,7 +75,7 @@ int logline(char *str, char *ournick, char *basedir, int type) {
snprintf(filename, MAXCHAR, "%s/logs/%s.log", basedir, tokens[2]);
}
- printf("logline(): Logging PRIVMSG from '%s' to '%s' message '%s' in filename '%s'.\n", tokens[0], tokens[2], str, filename);
+ debugprint("logline(): Logging PRIVMSG from '%s' to '%s' message '%s' in filename '%s'.\n", tokens[0], tokens[2], str, filename);
break;
@@ -95,7 +95,7 @@ int logline(char *str, char *ournick, char *basedir, int type) {
snprintf(filename, MAXCHAR, "%s/logs/%s.log", basedir, tokens[2] + pos);
- printf("logline(): Logging JOIN/PART to/from '%s' in filename '%s'.\n", tokens[2] + pos, filename);
+ debugprint("logline(): Logging JOIN/PART to/from '%s' in filename '%s'.\n", tokens[2] + pos, filename);
// Build a friendly message (e.g. ":nick!user@host JOIN #channel" -> "nick (user@host) has joined #channel")
@@ -134,7 +134,7 @@ int logline(char *str, char *ournick, char *basedir, int type) {
snprintf(filename, MAXCHAR, "%s/logs/%s.log", basedir, tokens[2]);
- printf("logline(): Logging TOPIC for '%s' in filename '%s'.\n", tokens[2], filename);
+ debugprint("logline(): Logging TOPIC for '%s' in filename '%s'.\n", tokens[2], filename);
// Build a friendly message (e.g. ":nick!user@host TOPIC #channel :blah blah" -> "nick has changed the topic to: blah blah")
snprintf(line, MAXCHAR, "%s has changed the topic to: %s", tokens[0], str);
@@ -155,7 +155,7 @@ int logline(char *str, char *ournick, char *basedir, int type) {
printf("Error creating log directory '%s'.\n", logdir);
exit(1);
} else {
- printf("logline(): log directory '%s'.\n", logdir);
+ debugprint("logline(): log directory '%s'.\n", logdir);
}
}
@@ -200,7 +200,7 @@ int logline(char *str, char *ournick, char *basedir, int type) {
// Ensure the line finishes with CRLF
appendcrlf(line);
- printf("logline(): Complete log string to write: '%s', length '%ld'.\n", line, strlen(line));
+ debugprint("logline(): Complete log string to write: '%s', length '%ld'.\n", line, strlen(line));
// Write complete line to file
if ((bytes = fprintf(fp, line)) < 0) {