2 * Copyright 2012 Samsung Electronics Co., Ltd
4 * Licensed under the Flora License, Version 1.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.tizenopensource.org/license
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.
23 #if defined(ENABLE_DLOG_OUT)
24 #define LOG_TAG "SYSTEM_SERVER"
26 #define DLOG_ERR DLOG_ERROR
27 #define __LOG(prio, fmt, arg...) \
28 do { SLOG(prio, LOG_TAG, fmt, ##arg); } while (0)
29 #define __LOGD(prio, fmt, arg...) \
30 do { SLOG(prio, LOG_TAG, "[%s:%d] "fmt"\n", __FUNCTION__, __LINE__, ##arg); } while (0)
31 #define __PRT(prio, fmt, arg...) \
32 do { fprintf(((D##prio) == DLOG_ERR ? stderr : stdout), fmt"\n", ##arg); } while (0)
33 #define __PRTD(prio, fmt, arg...) \
35 fprintf(((D##prio) == DLOG_ERR ? stderr : stdout), \
36 "[%s:%d] "fmt"\n", __FILE__, __LINE__, ##arg); \
40 #define __LOG(prio, fmt, arg...) \
41 do { syslog(prio, fmt, ##arg); } while (0)
42 #define __LOGD(prio, fmt, arg...) \
43 do { syslog(prio, "[%s:%d] "fmt"\n", __FUNCTION__, __LINE__, ##arg); } while (0)
44 #define __PRT(prio, fmt, arg...) \
45 do { fprintf(((prio) == LOG_ERR ? stderr : stdout), fmt"\n", ##arg); } while (0)
46 #define __PRTD(prio, fmt, arg...) \
48 fprintf(((prio) == LOG_ERR ? stderr : stdout), \
49 "[%s:%d] "fmt"\n", __FILE__, __LINE__, ##arg); \
54 extern int g_trace_depth;
55 #define __PRT_TRACE(prio, fmt, arg...) \
56 do { __LOGD(prio, fmt, ##arg); } while (0)
59 for(___i=0;___i<g_trace_depth;___i++)\
61 fprintf(stdout, " "); \
64 "[%s:%d] "fmt"\n", __FUNCTION__, __LINE__,##arg); \
65 __LOGD(prio, fmt, ##arg); \
67 #define __PRT_TRACE_ERR(prio, fmt, arg...) \
68 do { __LOGD(prio, fmt, ##arg); } while (0)
71 for(___i=0;___i<g_trace_depth;___i++)\
73 fprintf(stdout, " "); \
76 "%c[1;31m[%s:%d] "fmt"%c[0m\n",27, __FUNCTION__, __LINE__,##arg,27); \
77 __LOGD(prio, fmt, ##arg); \
79 #define __PRT_TRACE_EM(prio, fmt, arg...) \
80 do { __LOGD(prio, fmt, ##arg); } while (0)
83 for(___i=0;___i<g_trace_depth;___i++)\
85 fprintf(stdout, " "); \
88 "%c[1;34m[%s:%d] "fmt"%c[0m\n",27, __FUNCTION__, __LINE__,##arg,27); \
89 __LOGD(prio, fmt, ##arg); \
93 #define _NOUT(prio, fmt, arg...) do { } while (0)
100 # define _PRT_TRACE __PRT_TRACE
101 # define _PRT_TRACE_ERR __PRT_TRACE_ERR
102 # define _PRT_TRACE_EM __PRT_TRACE_EM
108 # define _PRT_TRACE _NOUT
109 # define _PRT_TRACE_ERR _NOUT
110 # define _PRT_TRACE_EM _NOUT
113 #define PRT_INFO(fmt, arg...) _PRT(LOG_INFO, fmt, ##arg)
114 #define PRT_ERR(fmt, arg...) _PRT(LOG_ERR, fmt, ##arg)
115 #define PRT_DBG(fmt, arg...) _PRTD(LOG_DEBUG, fmt, ##arg)
116 #define PRT_TRACE(fmt, arg...) _PRT_TRACE(LOG_DEBUG, fmt, ##arg)
117 #define PRT_TRACE_ERR(fmt, arg...) _PRT_TRACE_ERR(LOG_ERR, fmt, ##arg)
118 #define PRT_TRACE_EM(fmt, arg...) _PRT_TRACE_EM(LOG_DEBUG, fmt, ##arg)
120 #if defined(SYSLOG_OUT)
121 # define SYSLOG_INFO(fmt, arg...) _LOG(LOG_INFO, fmt, ##arg)
122 # define SYSLOG_ERR(fmt, arg...) _LOG(LOG_ERR, fmt, ##arg)
123 # define SYSLOG_DBG(fmt, arg...) _LOGD(LOG_DEBUG, fmt, ##arg)
124 # define INFO SYSLOG_INFO
125 # define ERR SYSLOG_ERR
126 # define DBG SYSLOG_DBG
127 #elif defined(ENABLE_DLOG_OUT)
132 # define INFO PRT_INFO