aboutsummaryrefslogblamecommitdiffstats
path: root/src/ckerrlog.h
blob: b254d4bf385c636f6eabede87017b6d68ef421e8 (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)

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 */