Remove unnecessary setting
[platform/core/system/sensord.git] / src / sensorctl / log.h
1 /*
2  * sensorctl
3  *
4  * Copyright (c) 2017 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 #pragma once /* __LOG_H__ */
21
22 #include <stdio.h>
23 #include <glib.h>
24
25 #define _NRM  "\x1B[0m"
26 #define _RED  "\x1B[31m"
27 #define _GRN  "\x1B[32m"
28 #define _YEL  "\x1B[33m"
29 #define _BLU  "\x1B[34m"
30 #define _MAG  "\x1B[35m"
31 #define _CYN  "\x1B[36m"
32 #define _WHT  "\x1B[37m"
33 #define _RST "\033[0m"
34
35 #define _N(fmt, args...) \
36 do { \
37         g_print(fmt, ##args); \
38 } while (0)
39
40 #define _E(fmt, args...) \
41 do { \
42         g_print(_RED fmt _RST, ##args); \
43 } while (0)
44
45 #define _I(fmt, args...) \
46 do { \
47         g_print(_GRN fmt _RST, ##args); \
48 } while (0)
49
50 #define _W(fmt, args...) \
51 do { \
52         g_print(_YEL fmt _RST, ##args); \
53 } while (0)
54
55 #define WARN_IF(expr, fmt, arg...) \
56 do { \
57         if(expr) { \
58                 _E(fmt, ##arg); \
59         } \
60 } while (0)
61
62 #define RET_IF(expr) \
63 do { \
64         if(expr) { \
65                 return; \
66         } \
67 } while (0)
68
69 #define RETV_IF(expr, val) \
70 do { \
71         if(expr) { \
72                 return (val); \
73         } \
74 } while (0)
75
76 #define RETM_IF(expr, fmt, arg...) \
77 do { \
78         if(expr) { \
79                 _E(fmt, ##arg); \
80                 return; \
81         } \
82 } while (0)
83
84 #define RETVM_IF(expr, val, fmt, arg...) \
85 do { \
86         if(expr) { \
87                 _E(fmt, ##arg); \
88                 return (val); \
89         } \
90 } while (0)