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