aboutsummaryrefslogtreecommitdiffstats
path: root/src/ckerrlog.h
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-10-04 01:20:13 +0300
committergramanas <anastasis.gramm2@gmail.com>2018-10-04 01:20:13 +0300
commitfa41863b03bbf67a7ad4edad9328b0cdc48e497b (patch)
treee7e4dd5986364c29a3d51ac661ce9b133effc868 /src/ckerrlog.h
parentbc2899dd69fce0f1868dbfad3394ef8b3dc48069 (diff)
downloadck-fa41863b03bbf67a7ad4edad9328b0cdc48e497b.tar.gz
ck-fa41863b03bbf67a7ad4edad9328b0cdc48e497b.tar.bz2
ck-fa41863b03bbf67a7ad4edad9328b0cdc48e497b.zip
store configs in subfolders and error/logging infrastructure
Diffstat (limited to 'src/ckerrlog.h')
-rw-r--r--src/ckerrlog.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/ckerrlog.h b/src/ckerrlog.h
new file mode 100644
index 0000000..b254d4b
--- /dev/null
+++ b/src/ckerrlog.h
@@ -0,0 +1,40 @@
+/* ckerrlog.h - Error report and logging for ck ------------------------*- C -*-
+ *
+ * This file is part of ck, the config keeper
+ *
+ * -----------------------------------------------------------------------------
+ *
+ * Copyright (C) 2018 Anastasis Grammenos
+ * GPLv3 (see LICENCE for the full notice)
+ *
+ * -------------------------------------------------------------------------- */
+#ifndef CKERRLOG_H
+#define CKERRLOG_H
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <stdio.h>
+
+#define CK_STREAMS \
+ X(err) \
+ X(log)
+
+void ckerr_add_component(char *txt, ...);
+
+#define ERR(...) \
+ ckerr_add_component("-[%s]", COMPONENT); \
+ ckerr(__VA_ARGS__);
+
+typedef struct st_ErrLog ErrLog;
+struct st_ErrLog {
+ char *err;
+ char *log;
+};
+
+extern void initialize_errlog();
+extern void report_errlog();
+extern void ckerr(char *err, ...);
+extern void cklog(char *log, ...);
+
+#endif /* CKERRLOG_H */