merge with master
[platform/framework/web/download-provider.git] / provider / include / download-provider-log.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_PROVIDER2_LOG_H
18 #define DOWNLOAD_PROVIDER2_LOG_H
19
20 #include <string.h>
21 #include <errno.h>
22
23 #define DEBUG_MSG
24 //#define DEBUG_PRINTF
25
26 #ifdef DEBUG_MSG
27 #ifdef DEBUG_PRINTF
28 #include <stdio.h>
29 #define TRACE_ERROR(format, ARG...)  \
30 { \
31 fprintf(stderr,"[PROVIDER][%s:%d] "format"\n", __FUNCTION__, __LINE__, ##ARG); \
32 }
33 #define TRACE_STRERROR(format, ARG...)  \
34 { \
35 fprintf(stderr,"[PROVIDER][%s:%d] "format" [%s]\n", __FUNCTION__, __LINE__, ##ARG, strerror(errno)); \
36 }
37 #define TRACE_INFO(format, ARG...)  \
38 { \
39 fprintf(stderr,"[PROVIDER][%s:%d] "format"\n", __FUNCTION__, __LINE__, ##ARG); \
40 }
41 #else
42 #include <dlog.h>
43 #ifdef LOG_TAG
44 #undef LOG_TAG
45 #endif
46 #define LOG_TAG "DOWNLOAD_PROVIDER"
47 #define TRACE_ERROR(format, ARG...)  \
48 { \
49 LOGE(format, ##ARG); \
50 }
51 #define TRACE_STRERROR(format, ARG...)  \
52 { \
53 LOGE(format" [%s]", ##ARG, strerror(errno)); \
54 }
55 #define TRACE_INFO(format, ARG...)  \
56 { \
57 LOGI(format, ##ARG); \
58 }
59 #endif
60 #else
61 #define TRACE_DEBUG_MSG(format, ARG...) ;
62 #endif
63 #endif