[RQ170614-00155] Fixed invalid format argument types
[platform/framework/web/download-provider.git] / agent / include / download-agent-debug.h
1 /*
2  * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #ifndef _DOWNLOAD_AGENT_DEBUG_H
18 #define _DOWNLOAD_AGENT_DEBUG_H
19
20 #include "download-agent-type.h"
21
22 #include <stdio.h>
23 #include <stdarg.h>
24 #include <pthread.h>
25
26 // ansi color
27 #define COLOR_RED               "\033[0;31m"
28 #define COLOR_GREEN     "\033[0;32m"
29 #define COLOR_BROWN     "\033[0;33m"
30 #define COLOR_LIGHTBLUE "\033[0;37m"
31 #define COLOR_END               "\033[0;m"
32
33 #ifdef _ENABLE_DLOG
34 #include <unistd.h>
35 #include <syscall.h>
36 #include <dlog.h>
37
38         #ifdef LOG_TAG
39         #undef LOG_TAG
40         #endif /*  LOG_TAG */
41
42         #define LOG_TAG "DP_DA"
43         #define DA_LOGV(format, ...) ((void)0)//LOGD("[%ld]:"format, syscall(__NR_gettid), ##__VA_ARGS__)
44         #define DA_LOGD(format, ...) LOGD(COLOR_LIGHTBLUE "[%ld]:"format COLOR_END, syscall(__NR_gettid), ##__VA_ARGS__)
45         #define DA_LOGI(format, ...) LOGI(COLOR_BROWN "[%ld]:"format COLOR_END, syscall(__NR_gettid), ##__VA_ARGS__)
46         #define DA_LOGE(format, ...) LOGE(COLOR_RED "[%ld]:"format COLOR_END, syscall(__NR_gettid), ##__VA_ARGS__)
47         #define DA_SECURE_LOGD(format, ...) SECURE_LOGD(COLOR_GREEN format COLOR_END, ##__VA_ARGS__)
48         #define DA_SECURE_LOGI(format, ...) SECURE_LOGI(COLOR_GREEN format COLOR_END, ##__VA_ARGS__)
49         #define DA_SECURE_LOGE(format, ...) SECURE_LOGE(COLOR_GREEN format COLOR_END, ##__VA_ARGS__)
50 #else
51
52 #include <unistd.h>
53 #include <syscall.h>
54
55         #define DA_LOGD(format, ...) do {\
56                                 fprintf(stderr, "[DA][%ld][%s():%d] "format"\n",syscall(__NR_gettid), __FUNCTION__,__LINE__, ##__VA_ARGS__);\
57         }while(0)
58         #define DA_LOGE(format, ...) do {\
59                                 fprintf(stderr, "[DA][%ld][ERR][%s():%d]\n",syscall(__NR_gettid), __FUNCTION__,__LINE__, ##__VA_ARGS__);\
60         }while(0)
61         #define DA_LOGV DA_LOGD
62         #define DA_LOGI DA_LOGD
63         #define DA_SECURE_LOGD(format, ...) ((void)0)
64         #define DA_SECURE_LOGI(format, ...) ((void)0)
65         #define DA_SECURE_LOGE(format, ...) ((void)0)
66 #endif /* _ENABLE_DLOG */
67
68 #endif /* DOWNLOAD_AGENT_DEBUG_H */