summaryrefslogtreecommitdiffstats
path: root/src/fastd.h
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2012-02-28 18:13:11 +0100
committerMatthias Schiffer <mschiffer@universe-factory.net>2012-02-28 18:13:11 +0100
commit34320ea5a34e53ede384dd408f3484cb872337cc (patch)
tree7e75f342595d8aa97453689cdd2bac11bd36e9a6 /src/fastd.h
parent99e264ac470f4605b5492a8277cac25731fdd34d (diff)
downloadfastd-34320ea5a34e53ede384dd408f3484cb872337cc.tar
fastd-34320ea5a34e53ede384dd408f3484cb872337cc.zip
Add config parsing
Diffstat (limited to 'src/fastd.h')
-rw-r--r--src/fastd.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/fastd.h b/src/fastd.h
index 2d372a2..59fdf90 100644
--- a/src/fastd.h
+++ b/src/fastd.h
@@ -127,17 +127,19 @@ struct _fastd_context {
};
-#define pr_log(context, level, args...) if ((context)->conf == NULL || (level) <= (context)->conf->loglevel) do { fprintf(stderr, args); fputs("\n", stderr); } while(0)
+#define pr_log(context, level, prefix, args...) if ((context)->conf == NULL || (level) <= (context)->conf->loglevel) \
+ do { fputs(prefix, stderr); fprintf(stderr, args); fputs("\n", stderr); } while(0)
-#define pr_fatal(context, args...) pr_log(context, LOG_FATAL, args)
-#define pr_error(context, args...) pr_log(context, LOG_ERROR, args)
-#define pr_warn(context, args...) pr_log(context, LOG_WARN, args)
-#define pr_info(context, args...) pr_log(context, LOG_INFO, args)
-#define pr_debug(context, args...) pr_log(context, LOG_DEBUG, args)
+#define pr_fatal(context, args...) pr_log(context, LOG_FATAL, "Fatal: ", args)
+#define pr_error(context, args...) pr_log(context, LOG_ERROR, "Error: ", args)
+#define pr_warn(context, args...) pr_log(context, LOG_WARN, "Warning: ", args)
+#define pr_info(context, args...) pr_log(context, LOG_INFO, "", args)
+#define pr_debug(context, args...) pr_log(context, LOG_DEBUG, "DEBUG: ", args)
-#define exit_fatal(context, args...) do { pr_fatal(context, args); exit(1); } while(0)
+#define exit_fatal(context, args...) do { pr_fatal(context, args); abort(); } while(0)
#define exit_bug(context, message) exit_fatal(context, "BUG: %s", message)
-#define exit_errno(context, message) exit_fatal(context, "%s: %s", message, strerror(errno))
+#define exit_error(context, args...) do { pr_error(context, args); exit(1); } while(0)
+#define exit_errno(context, message) exit_error(context, "%s: %s", message, strerror(errno))
static inline fastd_buffer fastd_buffer_alloc(size_t len, size_t head_space) {