Delete COPYING as LICENSE is to be used
[apps/poi-yelp.git] / traces.h
1 #ifndef __TRACE_H__
2 #define __TRACE_H__
3
4 #include <stdio.h>
5
6 #define BLACK   "\033[30m"
7 #define RED     "\033[31m"
8 #define GREEN   "\033[32m"
9 #define YELLOW  "\033[33m"
10 #define BLUE    "\033[34m"
11 #define PURPLE  "\033[35m"
12 #define DGREEN  "\033[6m"
13 #define WHITE   "\033[7m"
14 #define CYAN    "\x1b[36m"
15 #define NONE    "\033[0m"
16
17 #ifdef NDEBUG
18
19 #define TRACE_DEBUG_JSON(fmt, args...)
20 #define TRACE_DEBUG(fmt, args...)
21 #define TRACE_INFO(fmt, args...)
22 #define TRACE_WARN(fmt, args...)
23 #define TRACE_ERROR(fmt, args...)
24
25 #else
26
27 #define TRACE_DEBUG(fmt, args...) do { fprintf(stderr, "[%s:%d] " CYAN "DEBUG" NONE ": " fmt "\n", __func__, __LINE__, ##args); } while(0)
28 #define TRACE_INFO(fmt, args...)  do { fprintf(stderr, "[%s:%d] " GREEN "INFO" NONE ":  " fmt "\n", __func__, __LINE__, ##args); } while(0)
29 #define TRACE_WARN(fmt, args...)  do { fprintf(stderr, "[%s:%d] " YELLOW "WARN"  NONE":  " fmt "\n", __func__, __LINE__, ##args); } while(0)
30 #define TRACE_ERROR(fmt, args...) do { fprintf(stderr, "[%s:%d] " RED "ERROR" NONE ": " fmt "\n", __func__, __LINE__, ##args); } while(0)
31
32 #define TRACE_DEBUG_JSON(fmt, args...)
33
34 #endif
35
36 #endif // __TRACE_H__