From fa41863b03bbf67a7ad4edad9328b0cdc48e497b Mon Sep 17 00:00:00 2001 From: gramanas Date: Thu, 4 Oct 2018 01:20:13 +0300 Subject: store configs in subfolders and error/logging infrastructure --- src/ckerrlog.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 src/ckerrlog.h (limited to 'src/ckerrlog.h') 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 +#include +#include +#include + +#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 */ -- cgit v1.2.3