1a61715ffd91d8ebd24189ab6270cf2717c50951
[framework/system/dlog.git] / include / dlog.h
1 /*
2  * DLOG
3  * Copyright (c) 2005-2008, The Android Open Source Project
4  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5  *
6  * Licensed under the Apache License, Version 2.0 (the License);
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  *     http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  */
18
19 /**
20  * @file        dlog.h
21  * @version     0.4
22  * @brief       This file is the header file of interface of dlog.
23  */
24 #ifndef _DLOG_H_
25 #define _DLOG_H_
26
27 #include <tizen_error.h>
28 #include <stdarg.h>
29 #include <string.h>
30
31 #ifdef __cplusplus
32 extern "C" {
33 #endif /* __cplusplus */
34
35 /*
36  * This is the local tag used for the following simplified
37  * logging macros.  You can change this preprocessor definition
38  * before using the other macros to change the tag.
39  */
40 #ifndef LOG_TAG
41 #define LOG_TAG NULL
42 #endif
43
44 #ifndef __MODULE__
45 #define __MODULE__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
46 #endif
47
48 #ifdef TIZEN_ENGINEER_MODE
49 #ifndef TIZEN_DEBUG_ENABLE
50 #define TIZEN_DEBUG_ENABLE
51 #endif
52 #endif
53
54 /**
55  * @addtogroup CAPI_SYSTEM_DLOG
56  * @{
57  *
58  */
59 /**
60  * @brief Enumeration for Dlog Error.
61  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
62  */
63 typedef enum {
64         DLOG_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */
65         DLOG_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
66         DLOG_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED, /**< Operation not permitted */
67 } dlog_error_e;
68 /**
69  * @}
70  */
71
72 /**
73  * @addtogroup CAPI_SYSTEM_DLOG
74  * @{
75  *
76  */
77 /**
78  * @brief log priority values, in ascending priority order.
79  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
80  */
81 typedef enum {
82         DLOG_UNKNOWN = 0, /**< Keep this always at the start */
83         DLOG_DEFAULT, /**< Default */
84         DLOG_VERBOSE, /**< Verbose */
85         DLOG_DEBUG, /**< Debug */
86         DLOG_INFO, /**< Info */
87         DLOG_WARN, /**< Warning */
88         DLOG_ERROR, /**< Error */
89         DLOG_FATAL, /**< Fatal */
90         DLOG_SILENT, /**< Silent */
91         DLOG_PRIO_MAX   /**< Keep this always at the end. */
92 } log_priority;
93 /**
94  * @}
95  */
96
97 /**
98  * @internal
99  * @brief log id
100  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
101  */
102 typedef enum {
103     LOG_ID_MAIN = 0,
104         LOG_ID_RADIO,
105         LOG_ID_SYSTEM,
106         LOG_ID_APPS,
107         LOG_ID_MAX
108 } log_id_t;
109
110 static inline int __dlog_no_print(const char *fmt __attribute__((unused)), ...) { return 0; }
111
112 #define CONDITION(cond)     (__builtin_expect((cond) != 0, 0))
113 #define NOP(...) ({ do { __dlog_no_print(__VA_ARGS__); } while (0); })
114
115 // Macro inner work---------------------------------------------------------------
116 #undef LOG_
117 #ifdef TIZEN_DEBUG_ENABLE
118 #define LOG_(id, prio, tag, fmt, arg...) \
119         ({ do { \
120                 __dlog_print(id, prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); \
121         } while (0); })
122 #else
123 #define LOG_(id, prio, tag, fmt, arg...) \
124         ({ do { \
125                 if ((int)prio != DLOG_DEBUG) { \
126                         __dlog_print(id, prio, tag, "%s: %s(%d) > " fmt, __MODULE__, __func__, __LINE__, ##arg); \
127                 } \
128         } while (0); })
129 #endif
130
131 #undef SECURE_LOG_
132 #ifdef TIZEN_DEBUG_ENABLE
133 #define SECURE_LOG_(id, prio, tag, fmt, arg...) \
134         ({ do { \
135                 __dlog_print(id, prio, tag, "%s: %s(%d) > [SECURE_LOG] " fmt, __MODULE__, __func__, __LINE__, ##arg); \
136         } while (0); })
137 #else
138 #define SECURE_LOG_(id, prio, tag, fmt, arg...) NOP(fmt, ##arg)
139 #endif
140 // ---------------------------------------------------------------------
141 /**
142  * @internal
143  * @brief For Secure Log.
144  * @remarks Normally we strip Secure log from release builds.
145  * Please use this macros.
146  */
147 /**
148  * @internal
149  * @brief For Application and etc.
150  * @details Simplified macro to send a main log message using the current LOG_TAG.
151  * Example:
152  *  SECURE_LOGD("app debug %d", num);
153  *  SECURE_LOGE("app error %d", num);
154  */
155 #define SECURE_LOGD(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_DEBUG, LOG_TAG, format, ##arg)
156 #define SECURE_LOGI(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_INFO, LOG_TAG, format, ##arg)
157 #define SECURE_LOGW(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_WARN, LOG_TAG, format, ##arg)
158 #define SECURE_LOGE(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_ERROR, LOG_TAG, format, ##arg)
159 #define SECURE_LOGF(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_FATAL, LOG_TAG, format, ##arg)
160 /**
161  * @internal
162  * @brief For Framework and system etc.
163  * @details Simplified macro to send a system log message using the current LOG_TAG.
164  * Example:
165  *  SECURE_SLOGD("system debug %d", num);
166  *  SECURE_SLOGE("system error %d", num);
167  */
168 #define SECURE_SLOGD(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_DEBUG, LOG_TAG, format, ##arg)
169 #define SECURE_SLOGI(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_INFO, LOG_TAG, format, ##arg)
170 #define SECURE_SLOGW(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_WARN, LOG_TAG, format, ##arg)
171 #define SECURE_SLOGE(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_ERROR, LOG_TAG, format, ##arg)
172 #define SECURE_SLOGF(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_FATAL, LOG_TAG, format, ##arg)
173 /**
174  * @internal
175  * @brief For Modem and radio etc.
176  * @details Simplified macro to send a radio log message using the current LOG_TAG.
177  * Example:
178  *  SECURE_RLOGD("radio debug %d", num);
179  *  SECURE_RLOGE("radio error %d", num);
180  */
181 #define SECURE_RLOGD(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_DEBUG, LOG_TAG, format, ##arg)
182 #define SECURE_RLOGI(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_INFO, LOG_TAG, format, ##arg)
183 #define SECURE_RLOGW(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_WARN, LOG_TAG, format, ##arg)
184 #define SECURE_RLOGE(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_ERROR, LOG_TAG, format, ##arg)
185 #define SECURE_RLOGF(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_FATAL, LOG_TAG, format, ##arg)
186 /**
187  * @internal
188  * @brief For Tizen OSP Application macro.
189  */
190 #define SECURE_ALOGD(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_DEBUG, LOG_TAG, format, ##arg)
191 #define SECURE_ALOGI(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_INFO, LOG_TAG, format, ##arg)
192 #define SECURE_ALOGW(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_WARN, LOG_TAG, format, ##arg)
193 #define SECURE_ALOGE(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_ERROR, LOG_TAG, format, ##arg)
194 #define SECURE_ALOGF(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_FATAL, LOG_TAG, format, ##arg)
195 /**
196  * @internal
197  * @details If you want use redefined macro.
198  * You can use this macro.
199  * This macro need priority and tag arguments.
200  */
201 #define SECURE_LOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_MAIN, D##priority, tag, format, ##arg)
202 #define SECURE_SLOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, D##priority, tag, format, ##arg)
203 #define SECURE_RLOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_RADIO, D##priority, tag, format, ##arg)
204 #define SECURE_ALOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_APPS, D##priority, tag, format, ##arg)
205
206 /**
207  * @internal
208  * @brief For Application and etc.
209  * @details Simplified macro to send a main log message using the current LOG_TAG.
210  * Example:
211  *  LOGD("app debug %d", num);
212  *  LOGE("app error %d", num);
213  */
214 #ifdef TIZEN_DEBUG_ENABLE
215 #define LOGD(format, arg...) LOG_(LOG_ID_MAIN, DLOG_DEBUG, LOG_TAG, format, ##arg)
216 #else
217 #define LOGD(format, arg...) NOP(format, ##arg)
218 #endif
219 #define LOGI(format, arg...) LOG_(LOG_ID_MAIN, DLOG_INFO, LOG_TAG, format, ##arg)
220 #define LOGW(format, arg...) LOG_(LOG_ID_MAIN, DLOG_WARN, LOG_TAG, format, ##arg)
221 #define LOGE(format, arg...) LOG_(LOG_ID_MAIN, DLOG_ERROR, LOG_TAG, format, ##arg)
222 #define LOGF(format, arg...) LOG_(LOG_ID_MAIN, DLOG_FATAL, LOG_TAG, format, ##arg)
223 /**
224  * @internal
225  * @brief For Framework and system etc.
226  * @details Simplified macro to send a system log message using the current LOG_TAG.
227  * Example:
228  *  SLOGD("system debug %d", num);
229  *  SLOGE("system error %d", num);
230  */
231 #ifdef TIZEN_DEBUG_ENABLE
232 #define SLOGD(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_DEBUG, LOG_TAG, format, ##arg)
233 #else
234 #define SLOGD(format, arg...) NOP(format, ##arg)
235 #endif
236 #define SLOGI(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_INFO, LOG_TAG, format, ##arg)
237 #define SLOGW(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_WARN, LOG_TAG, format, ##arg)
238 #define SLOGE(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_ERROR, LOG_TAG, format, ##arg)
239 #define SLOGF(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_FATAL, LOG_TAG, format, ##arg)
240 /**
241  * @internal
242  * @brief For Modem and radio etc.
243  * @details Simplified macro to send a radio log message using the current LOG_TAG.
244  * Example:
245  *  RLOGD("radio debug %d", num);
246  *  RLOGE("radio error %d", num);
247  */
248 #ifdef TIZEN_DEBUG_ENABLE
249 #define RLOGD(format, arg...) LOG_(LOG_ID_RADIO, DLOG_DEBUG, LOG_TAG, format, ##arg)
250 #else
251 #define RLOGD(format, arg...) NOP(format, ##arg)
252 #endif
253 #define RLOGI(format, arg...) LOG_(LOG_ID_RADIO, DLOG_INFO, LOG_TAG, format, ##arg)
254 #define RLOGW(format, arg...) LOG_(LOG_ID_RADIO, DLOG_WARN, LOG_TAG, format, ##arg)
255 #define RLOGE(format, arg...) LOG_(LOG_ID_RADIO, DLOG_ERROR, LOG_TAG, format, ##arg)
256 #define RLOGF(format, arg...) LOG_(LOG_ID_RADIO, DLOG_FATAL, LOG_TAG, format, ##arg)
257 /**
258  * @internal
259  * @brief For Tizen OSP Application macro.
260  */
261 #ifdef TIZEN_DEBUG_ENABLE
262 #define ALOGD(format, arg...) LOG_(LOG_ID_APPS, DLOG_DEBUG, LOG_TAG, format, ##arg)
263 #else
264 #define ALOGD(format, arg...) NOP(format, ##arg)
265 #endif
266 #define ALOGI(format, arg...) LOG_(LOG_ID_APPS, DLOG_INFO, LOG_TAG, format, ##arg)
267 #define ALOGW(format, arg...) LOG_(LOG_ID_APPS, DLOG_WARN, LOG_TAG, format, ##arg)
268 #define ALOGE(format, arg...) LOG_(LOG_ID_APPS, DLOG_ERROR, LOG_TAG, format, ##arg)
269 #define ALOGF(format, arg...) LOG_(LOG_ID_APPS, DLOG_FATAL, LOG_TAG, format, ##arg)
270
271 /**
272  * @internal
273  * @brief Basic log message macro
274  * @details This macro allows you to specify a priority and a tag
275  * if you want to use this macro directly, you must add this messages for unity of messages.
276  * (LOG(prio, tag, "%s: %s(%d) > " format, __MODULE__, __func__, __LINE__, ##arg))
277  *
278  * Example:
279  *  #define MYMACRO(prio, tag, format, arg...) \
280  *          LOG(prio, tag, format, ##arg)
281  *
282  *  MYMACRO(LOG_DEBUG, MYTAG, "test mymacro %d", num);
283  *
284  */
285 #ifndef LOG
286 #define LOG(priority, tag, format, arg...) LOG_(LOG_ID_MAIN, D##priority, tag, format, ##arg)
287 #endif
288 #define SLOG(priority, tag, format, arg...) LOG_(LOG_ID_SYSTEM, D##priority, tag, format, ##arg)
289 #define RLOG(priority, tag, format, arg...) LOG_(LOG_ID_RADIO, D##priority, tag, format, ##arg)
290 #define ALOG(priority, tag, format, arg...) LOG_(LOG_ID_APPS, D##priority, tag, format, ##arg)
291 /**
292  * @internal
293  */
294 #define LOG_VA(priority, tag, fmt, args) \
295         vprint_log(D##priority, tag, fmt, args)
296 #define ALOG_VA(priority, tag, fmt, args) \
297         vprint_apps_log(D##priority, tag, fmt, args)
298 #define RLOG_VA(priority, tag, fmt, args) \
299         vprint_radio_log(D##priority, tag, fmt, args)
300 #define SLOG_VA(priority, tag, fmt, args) \
301         vprint_system_log(D##priority, tag, fmt, args)
302 #define print_apps_log(prio, tag, fmt...) \
303         __dlog_print(LOG_ID_APPS, prio, tag, fmt)
304 #define vprint_apps_log(prio, tag, fmt...) \
305         __dlog_vprint(LOG_ID_APPS, prio, tag, fmt)
306 #define print_log(prio, tag, fmt...) \
307         __dlog_print(LOG_ID_MAIN, prio, tag, fmt)
308 #define vprint_log(prio, tag, fmt...) \
309         __dlog_vprint(LOG_ID_MAIN, prio, tag, fmt)
310 #define print_radio_log(prio, tag, fmt...)\
311         __dlog_print(LOG_ID_RADIO, prio, tag, fmt)
312 #define vprint_radio_log(prio, tag, fmt...) \
313         __dlog_vprint(LOG_ID_RADIO, prio, tag, fmt)
314 #define print_system_log(prio, tag, fmt...)\
315         __dlog_print(LOG_ID_SYSTEM, prio, tag, fmt)
316 #define vprint_system_log(prio, tag, fmt...) \
317         __dlog_vprint(LOG_ID_SYSTEM, prio, tag, fmt)
318
319 // ---------------------------------------------------------------------
320 // Don't use below macro no more!! It will be removed -- Verbose and Fatal priority macro will be removed --
321 #define COMPATIBILITY_ON
322 #ifdef COMPATIBILITY_ON
323 /**
324  * @internal
325  * @breif Conditional Macro.
326  * @remarks Don't use this macro. It's just compatibility.
327  * It will be deprecated.
328  */
329 #define LOGD_IF(cond, format, arg...) \
330         ({ do { \
331                 if (CONDITION(cond)) { \
332                         LOGD(format, ##arg); \
333                 } \
334         } while (0); })
335 #define LOGI_IF(cond, format, arg...) \
336         ({ do { \
337                 if (CONDITION(cond)) { \
338                         LOGI(format, ##arg); \
339                 } \
340         } while (0); })
341 #define LOGW_IF(cond, format, arg...) \
342         ({ do { \
343                 if (CONDITION(cond)) { \
344                         LOGW(format, ##arg); \
345                 } \
346         } while (0); })
347 #define LOGE_IF(cond, format, arg...) \
348         ({ do { \
349                 if (CONDITION(cond)) { \
350                         LOGE(format, ##arg); \
351                 } \
352         } while (0); })
353 #define LOGF_IF(cond, format, arg...) \
354         ({ do { \
355                 if (CONDITION(cond)) { \
356                         LOGF(format, ##arg); \
357                 } \
358         } while (0); })
359 #define SLOGD_IF(cond, format, arg...) \
360         ({ do { \
361                 if (CONDITION(cond)) { \
362                         SLOGD(format, ##arg); \
363                 } \
364         } while (0); })
365 #define SLOGI_IF(cond, format, arg...) \
366         ({ do { \
367                 if (CONDITION(cond)) { \
368                         SLOGI(format, ##arg); \
369                 } \
370         } while (0); })
371 #define SLOGW_IF(cond, format, arg...) \
372         ({ do { \
373                 if (CONDITION(cond)) { \
374                         SLOGW(format, ##arg); \
375                 } \
376         } while (0); })
377 #define SLOGE_IF(cond, format, arg...) \
378         ({ do { \
379                 if (CONDITION(cond)) { \
380                         SLOGE(format, ##arg); \
381                 } \
382         } while (0); })
383 #define SLOGF_IF(cond, format, arg...) \
384         ({ do { \
385                 if (CONDITION(cond)) { \
386                         SLOGF(format, ##arg); \
387                 } \
388         } while (0); })
389 #define RLOGD_IF(cond, format, arg...) \
390         ({ do { \
391                 if (CONDITION(cond)) { \
392                         RLOGD(format, ##arg); \
393                 } \
394         } while (0); })
395 #define RLOGI_IF(cond, format, arg...) \
396         ({ do { \
397                 if (CONDITION(cond)) { \
398                         RLOGI(format, ##arg); \
399                 } \
400         } while (0); })
401 #define RLOGW_IF(cond, format, arg...) \
402         ({ do { \
403                 if (CONDITION(cond)) { \
404                         RLOGW(format, ##arg); \
405                 } \
406         } while (0); })
407 #define RLOGE_IF(cond, format, arg...) \
408         ({ do { \
409                 if (CONDITION(cond)) { \
410                         RLOGE(format, ##arg); \
411                 } \
412         } while (0); })
413 #define RLOGF_IF(cond, format, arg...) \
414         ({ do { \
415                 if (CONDITION(cond)) { \
416                         RLOGF(format, ##arg); \
417                 } \
418         } while (0); })
419 #define LOG_ON() ({ do { } while (0); })
420 #define LOGV(format, arg...) NOP(format, ##arg)
421 #define SLOGV(format, arg...) NOP(format, ##arg)
422 #define RLOGV(format, arg...) NOP(format, ##arg)
423 #define ALOGV(format, arg...) NOP(format, ##arg)
424 #define LOGV_IF(cond, format, arg...) NOP(format, ##arg)
425 #define SLOGV_IF(cond, format, arg...) NOP(format, ##arg)
426 #define RLOGV_IF(cond, format, arg...) NOP(format, ##arg)
427 #define SECLOG(...) ({ do { } while (0); })
428 #endif
429 // ---------------------------------------------------------------------
430
431 /**
432  * @addtogroup CAPI_SYSTEM_DLOG
433  * @{
434  */
435 /**
436  * @brief     Send log with priority and tag.
437  * @details   for application
438  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
439  * @param[in] prio log_priority
440  * @param[in] tag tag
441  * @param[in] fmt format string
442  * @return On success, the function returns the number of bytes written.
443  *         On error, a negative errno-style error code
444  * @retval #DLOG_ERROR_INVALID_PARAMETER Invalid parameter
445  * @retval #DLOG_ERROR_NOT_PERMITTED Operation not permitted
446  * @pre       none
447  * @post      none
448  * @see       dlog_vprint
449  * @code
450 #include<dlog.h>
451 int main(void)
452 {
453     int integer = 21;
454     char string[] = "test dlog";
455
456         dlog_print(DLOG_INFO, "USR_TAG", "test dlog");
457         dlog_print(DLOG_INFO, "USR_TAG", "%s, %d", string, integer);
458     return 0;
459 }
460  * @endcode
461  */
462 int dlog_print(log_priority prio, const char *tag, const char *fmt, ...);
463
464 /**
465  * @brief     Send log with priority, tag and va_list.
466  * @details   for application
467  * @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
468  * @param[in] prio log_priority
469  * @param[in] tag tag
470  * @param[in] fmt format string
471  * @param[in] ap va_list
472  * @return On success, the function returns the number of bytes written.
473  *         On error, a negative errno-style error code
474  * @retval #DLOG_ERROR_INVALID_PARAMETER Invalid parameter
475  * @retval #DLOG_ERROR_NOT_PERMITTED Operation not permitted
476  * @pre       none
477  * @post      none
478  * @see       dlog_print
479  * @code
480 #include<dlog.h>
481 void my_debug_print(char *format, ...)
482 {
483     va_list ap;
484
485     va_start(ap, format);
486     dlog_vprint(DLOG_INFO, "USR_TAG", format, ap);
487     va_end(ap);
488 }
489
490 int main(void)
491 {
492     my_debug_print("%s", "test dlog");
493     my_debug_print("%s, %d", "test dlog", 21);
494     return 0;
495 }
496  * @endcode
497  */
498 int dlog_vprint(log_priority prio, const char *tag, const char *fmt, va_list ap);
499 /**
500  * @}
501  */
502
503
504 /*
505  * The stuff in the rest of this file should not be used directly.
506  */
507 /**
508  * @internal
509  * @brief     Send log.
510  * @details   Use LOG(), SLOG(), RLOG() family
511  *            not to use __dlog_print() directly
512  * @remarks   Must not use this API directly. use macros instead.
513  * @param[in] log_id log device id
514  * @param[in] prio priority
515  * @param[in] tag tag
516  * @param[in] fmt format string
517  * @return    Operation result
518  * @retval    0>= Success
519  * @retval    -1  Error
520  * @pre       none
521  * @post      none
522  * @see       __dlog_print
523  * @code
524     #define LOG_TAG USR_TAG
525     #include<dlog.h>
526      __dlog_print(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly");
527  * @endcode
528  */
529 int __dlog_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ...);
530
531 /**
532  * @internal
533  * @brief     Send log with va_list.
534  * @details   Use LOG_VA(), SLOG_VA(), RLOG_VA() family
535               not to use __dlog_vprint() directly
536  * @remarks   Must not use this API directly. use macros instead.
537  * @param[in] log_id log device id
538  * @param[in] prio priority
539  * @param[in] tag tag
540  * @param[in] fmt format string
541  * @param[in] ap va_list
542  * @return    Operation result
543  * @retval    0>= Success
544  * @retval    -1  Error
545  * @pre       none
546  * @post      none
547  * @see       __dlog_vprint
548  * @code
549     #define LOG_TAG USR_TAG
550     #include<dlog.h>
551      __dlog_vprint(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly", ap);
552  * @endcode
553   */
554 int __dlog_vprint(log_id_t log_id, int prio, const char *tag, const char *fmt, va_list ap);
555 #ifdef __cplusplus
556 }
557 #endif /* __cplusplus */
558 #endif /* _DLOG_H_*/