2 * Copyright (c) 2012 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #ifndef _Download_Agent_Debug_H
18 #define _Download_Agent_Debug_H
20 #include "download-agent-type.h"
22 #define DA_DEBUG_ENV_KEY "DOWNLOAD_AGENT_DEBUG"
23 #define DA_DEBUG_CONFIG_FILE_PATH "/tmp/.download_agent.conf"
25 #define IS_LOG_ON(channel) (DALogBitMap & (0x1<<(channel)))
43 extern int DALogBitMap;
45 da_result_t init_log_mgr(void);
48 #define DA_LOG(channel, format, ...) ((void)0)
49 #define DA_LOG_CRITICAL(channel, format, ...) ((void)0)
50 #define DA_LOG_VERBOSE(channel, format, ...) ((void)0)
51 #define DA_LOG_ERR(channel, format, ...) ((void)0)
52 #define DA_LOG_FUNC_START(channel, ...) ((void)0)
59 #ifdef DA_DEBUG_USING_DLOG
64 #define LOG_TAG "DOWNLOAD_AGENT"
66 #define DA_LOG(channel, format, ...) LOGD_IF(IS_LOG_ON(channel), format, ##__VA_ARGS__);
67 #define DA_LOG_CRITICAL(channel, format, ...) LOGE_IF(IS_LOG_ON(channel), format, ##__VA_ARGS__);
68 #define DA_LOG_VERBOSE(channel, format, ...) LOGV_IF(IS_LOG_ON(channel), format, ##__VA_ARGS__);
69 #define DA_LOG_ERR(channel, format, ...) LOGE_IF(IS_LOG_ON(channel), "ERR! "format, ##__VA_ARGS__);
70 #define DA_LOG_FUNC_START(channel, ...) LOGV_IF(IS_LOG_ON(channel), "starting...");
71 #else /* DA_DEBUG_USING_DLOG */
75 #define DA_LOG(channel, format, ...) do {\
77 ? fprintf(stderr, "[DA][%u][%s(): %d] "format"\n",(unsigned int)syscall(__NR_gettid), __FUNCTION__,__LINE__, ##__VA_ARGS__) \
80 #define DA_LOG_ERR(channel, format, ...) do {\
82 ? fprintf(stderr, "[DA][%u][ERR][%s(): %d]\n",(unsigned int)syscall(__NR_gettid), __FUNCTION__,__LINE__, ##__VA_ARGS__) \
85 #define DA_LOG_FUNC_START(channel, ...) do {\
87 ? fprintf(stderr, "[DA][%u][%s(): %d] starting\n",(unsigned int)syscall(__NR_gettid), __FUNCTION__,__LINE__) \
90 #define DA_LOG_CRITICAL DA_LOG
91 #define DA_LOG_VERBOSE DA_LOG
92 #endif /* DA_DEBUG_USING_DLOG */
94 #endif /* _Download_Agent_Debug_H */