1388dceb11bcd2bf9ffd2e0b0a07647364fe7c7e
[profile/mobile/apps/native/homescreen-efl.git] / inc / app_log.h
1 #ifndef __APP_LOG_H__
2 #define __APP_LOG_H__
3
4 #include <dlog.h>
5
6 #include "test.h"
7
8 #ifdef  LOG_TAG
9 #undef  LOG_TAG
10 #endif
11 #define LOG_TAG "TEST_UNIT"
12
13 #ifndef __MODULE__
14 #define __MODULE__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
15 #endif
16
17 #define LOG_(prio, tag, fmt, arg...) ({ dlog_print(prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); })
18
19 #if (TEST_MODE == TEST_UNIT)
20 #define TEST_APP_LOG_TAG "TEST_APP"
21 #define TEST_UNIT_LOG_TAG "TEST_UNIT"
22 #define __D(format, arg...) LOG_(DLOG_DEBUG, LOG_TAG, format, ##arg)
23 #define __I(format, arg...) LOG_(DLOG_INFO, LOG_TAG, format, ##arg)
24 #define __E(format, arg...) LOG_(DLOG_ERROR, LOG_TAG, format, ##arg)
25 #define __T(format, arg...) ({ dlog_print(DLOG_DEBUG, TEST_APP_LOG_TAG, format, ##arg); unit_write_log(format, ##arg); })
26 #define __TU(format, arg...) LOG_(DLOG_DEBUG, TEST_UNIT_LOG_TAG, format, ##arg)
27 #elif (TEST_MODE == TEST_APP)
28 #define TEST_APP_LOG_TAG "TEST_APP"
29 #define __D(format, arg...) ({ dlog_print(DLOG_DEBUG, LOG_TAG, format, ##arg); unit_write_log(format, ##arg); })
30 #define __I(format, arg...) LOG_(DLOG_INFO, LOG_TAG, format, ##arg)
31 #define __E(format, arg...) LOG_(DLOG_ERROR, LOG_TAG, format, ##arg)
32 #define __T(format, arg...) LOG_(DLOG_DEBUG, TEST_APP_LOG_TAG, format, ##arg)
33 #else
34 #define __D(format, arg...) LOG_(DLOG_DEBUG, LOG_TAG, format, ##arg)
35 #define __I(format, arg...) LOG_(DLOG_INFO, LOG_TAG, format, ##arg)
36 #define __E(format, arg...) LOG_(DLOG_ERROR, LOG_TAG, format, ##arg)
37 #endif
38
39 #endif