#pragma once
#include <stdio.h>
#include <signal.h>

#define LOG(str, args...)(fprintf(stdout, str"\n", ## args))
#ifdef DEBUG_PARANOID /* Will cause WARN's to blow up. */
#define WARN(str, args...)(fprintf(stderr, "Warning: [%s] "str"\n", __func__, ## args), \
   abort())
#else
#define WARN(str, args...)(fprintf(stderr, "Warning: [%s] "str"\n", __func__, ## args))
#endif

#define ERR(str, args...) (fprintf(stderr, "ERROR %s:%d: [%s] "str"\n", \
  __FILE__, __LINE__, __func__, ## args), abort())

#ifdef DEBUG
#  undef DEBUG
#  define DEBUG(str, args...) LOG(str, ## args)
#  define DEBUGGING
#else
#  define DEBUG(str, args...) do {;} while(0)
#endif