aboutsummaryrefslogblamecommitdiffstats
path: root/src/ckerrlog.h
blob: be5257d1716573d358a737f2274f52c8be981da7 (plain) (tree)



















                                                                                

                                                 


                                         



                                  











                                                     

                       
/* 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)                                        \
  X(help)                                     

void ckerr_add_component(char *txt, ...);

extern void initialize_errlog();
extern void report_errlog();
extern void ckerr(char *err, ...);
extern void cklog(char *log, ...);
extern void ckhelp(char *log, ...);
extern void report_err();
extern void report_help();

/**********/
/* Macros */
/**********/

#define ERR(...)                                    \
  ckerr_add_component("Error in [%s]:", COMPONENT); \
  ckerr(__VA_ARGS__);                               \
  report_err();                                 

#endif /* CKERRLOG_H */