1 /**************************************************************************
3 eom (external output manager)
5 Copyright 2014 Samsung Electronics co., Ltd. All Rights Reserved.
8 SooChan Lim <sc1.lim@samsung.com>
9 Boram Park <boram1288.park@samsung.com>
10 Changyeon Lee <cyeon.lee@samsung.com>
12 Permission is hereby granted, free of charge, to any person obtaining a
13 copy of this software and associated documentation files (the
14 "Software"), to deal in the Software without restriction, including
15 without limitation the rights to use, copy, modify, merge, publish,
16 distribute, sub license, and/or sell copies of the Software, and to
17 permit persons to whom the Software is furnished to do so, subject to
18 the following conditions:
20 The above copyright notice and this permission notice (including the
21 next paragraph) shall be included in all copies or substantial portions
24 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
25 OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
26 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
27 IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR
28 ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
29 TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
30 SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
32 **************************************************************************/
43 #define API __attribute__ ((visibility("default")))
48 extern bool eom_debug_on;
50 #ifndef HAVE_CAPI_0_1_1
51 static inline void set_last_result(int i) {; }
57 #define INFO(fmt, arg...) \
58 if (eom_debug_on) SECURE_SLOGI(fmt, ##arg)
59 #define WARN(fmt, arg...) \
60 if (eom_debug_on) SECURE_SLOGW(fmt, ##arg)
61 #define ERR(fmt, arg...) SECURE_SLOGE(fmt, ##arg)
62 #define FATAL(fmt, arg...) SECURE_SLOGF(fmt, ##arg)
65 #define INFO(fmt, arg...) \
66 if (eom_debug_on) fprintf(stdout, "[%s:%d] "fmt"\n", __FUNCTION__, __LINE__, ##arg)
67 #define WARN(fmt, arg...) \
68 if (eom_debug_on) fprintf(stderr, "[%s:%d] "fmt"\n", __FUNCTION__, __LINE__, ##arg)
69 #define ERR(fmt, arg...) fprintf(stderr, "[%s:%d] "fmt"\n", __FUNCTION__, __LINE__, ##arg)
70 #define FATAL(fmt, arg...) fprintf(stderr, "[%s:%d] "fmt"\n", __FUNCTION__, __LINE__, ##arg)
71 #endif /* HAVE_DLOG */
73 #define WARN_IF_FAIL(cond) if (!(cond)) ERR("'%s' failed", #cond);
74 #define RET_IF_FAIL(cond) {if (!(cond)) { ERR("'%s' failed", #cond); return; } }
75 #define RETV_IF_FAIL(cond, val) {if (!(cond)) { ERR("'%s' failed", #cond); return val; } }
76 #define GOTO_IF_FAIL(cond, dst) {if (!(cond)) { ERR("'%s' failed", #cond); goto dst; } }
77 #define NEVER_GET_HERE() ERR("** NEVER GET HERE **\n")
79 #endif /* __EOM_LOG_H__ */