diff options
author | jk7744.park <jk7744.park@samsung.com> | 2015-02-01 13:52:01 +0900 |
---|---|---|
committer | jk7744.park <jk7744.park@samsung.com> | 2015-02-01 13:52:01 +0900 |
commit | fad4d5b4131d0054787a804f217448b32512ef43 (patch) | |
tree | ab9b0187657f861f01c2b0ce6139bbc707c7dde6 /include | |
parent | 951c077f8010db452abe48254fb0134ca0073613 (diff) | |
download | dlog-tizen_2.3.tar.gz dlog-tizen_2.3.tar.bz2 dlog-tizen_2.3.zip |
tizen 2.3 releasetizen_2.3_releasesubmit/tizen_2.3/20150202.063743tizen_2.3
Diffstat (limited to 'include')
-rwxr-xr-x | include/SLP_Dlog_PG.h | 183 | ||||
-rwxr-xr-x | include/dlog.h | 271 | ||||
-rwxr-xr-x | include/logprint.h | 1 |
3 files changed, 196 insertions, 259 deletions
diff --git a/include/SLP_Dlog_PG.h b/include/SLP_Dlog_PG.h deleted file mode 100755 index a108b5f..0000000 --- a/include/SLP_Dlog_PG.h +++ /dev/null @@ -1,183 +0,0 @@ -/** - @ingroup SLP_PG - @defgroup SLP_PG_Dlog dlog - @{ - -<h1 class="pg">Introduction</h1> -Dlog logging service support sending log message to circular log device - -<h1 class="pg">dlog Architecture</h1> -@image html SLP_Dlog_PG_image001.png System Architecture of dlog - -<h1 class="pg">dlog properties</h1> -Sending log message to circular buffer. dlog APIs include Priority and Tag. By using priority and Tag, we can easily filtered messages what we want to see. - <h2 class="pg">priority</h2> -priority level incdicates the urgency of log message - -<table> -<tr> - <th>Priority</th> - <th>Description</th> -</tr> -<tr> - <td>VERBOSE </td> - <td>Verbose message. - compiled into application and logged at runtime only when debug mode. on release mode, this log message is strip.</td> -</tr> -<tr> - <td>DEBUG</td> - <td>Debug messasge. - always compiled into application, but not logged at runtime by default on release mode. on debug mode, this message will be logged at runtime.</td> -</tr> -<tr> - <td>INFO</td> - <td>Information message - Normal operational messages. above of this priority will always be logged.</td> -</tr> -<tr> - <td>WARN</td> - <td>Warning messages - not an error, but indication that an error will occur if action is not taken</td> -</tr> -<tr> - <td>ERROR</td> - <td>Error message - indicate error. </td> -</tr> -<tr> - <td>FATAL</td> - <td>Fatal message - Should be corrected immediately ( not used yet )</td> -</tr> -</table> - - <h2 class="pg">Tag</h2> -Used to identify the source of a log message. -There is no naming limitation, but do not forget that tag is identification of module. Tag must be distinguishable from other tag. -Simplified macro like LOGV, LOGD, LOGI, LOGW, LOGE uses declared LOG_TAG constant, so declare a LOG_TAG constant before you use dlog macro is a good convention. -@code -#define LOG_TAG "MyApp" -@endcode - -<h1 class="pg">list of dlog macro</h1> -Macro name start with LOG prefix is for application. start with SLOG prefix is for framework, start with RLOG prefix is for radio. each macro write log message to separated log device such as main, system, radio. - -<h1 class="pg">sample code</h1> -Using simplified macro with current LOG_TAG - -@code -#define LOG_TAG "YOUR_APP" -#include <dlog.h> - -int function () { - LOGD( "debug message from YOUR_APP \n"); - LOGI( "information message from YOUR_APP \n"); - LOGW( "warning message from YOUR_APP \n"); - LOGE( "error message from YOUR_APP \n"); -} -@endcode - -Using log macro allows you to specify a priority and a tag - -@code -#include <dlog.h> - -#define TAG_DRM_SVC "drm_svc" -#define TAG_DRM_WM "drm_wm" -#define TAG_DRM_OEM "drm_oem" - -int function () { - LOG(LOG_DEBUG,TAG_DRM_SVC, "information message from drm_svc \n"); - LOG(LOG_WARN,TAG_DRM_WM, "warning message from drm_wm \n"); - LOG(LOG_ERROR,TAG_DRM_OEM, "error message from drm_oem \n"); -} -@endcode - -Using log macro allows you to pass in a varargs - -@code -#include <dlog.h> - -#define TAG_DRM_SVC "drm_svc" -#define TAG_DRM_WM "drm_wm" -#define TAG_DRM_OEM "drm_oem" - -int function (const char *fmt, ...) { - va_list ap; - va_start(ap, fmt); - LOG_VA(LOG_DEBUG,TAG_DRM_WM, fmt, args); - va_end(ap); -} -@endcode -<h1 class="pg">dlogutil</h1> - <h2 class="pg">Introduction</h2> -You can use dlogutil command to view and follow the contents of the log buffers. The general usage is : -@code -dlogutil [<option>] ¡¦ [<filter-spec>] ¡¦ -@endcode - - <h2 class="pg">Filtering log output</h2> -Every log message has a <I>tag</I> and a <I>priority</I> associated with it. -Filter expression follows this format <B><I>tag:priority</I></B> where <I>tag</I> indicates the tag of interest and <I>priority</I> indicates the minimum level of priority to report for that tag. You can add any number of tag:priority specifications in a single filter expression. -The tag of a log message is a short indicating the system component from which the message originates -The <I>priority</I> is one of the following character values, orderd from lowest to highest priority:<br> -V - verbose<br> -D - debug<br> -I - info<br> -W - warning<br> -E - Error<br> -F - Fatal<br> - -for example, if you want to see MyApp tag and above of debug priority, -@code -# dlogutil MyApp:D -@endcode -if you want to see all log message above of info priority also, -@code -# dlogutil MyApp:D *:E -@endcode - - <h2 class="pg">List of logutil command options</h2> - -<table> -<tr> - <th>Option</th> - <th>Description</th> -</tr> -<tr> - <td>-b <buffer> </td> - <td>Alternate log buffer. The main buffer is used by default buffer. </td> -</tr> -<tr> - <td>-c</td> - <td>Clears the entire log and exits</td> -</tr> -<tr> - <td>-d</td> - <td>Dumps the log and exits.</td> -</tr> -<tr> - <td>-f <filename></td> - <td>Writes log to <filename>. The default is stdout</td> -</tr> -<tr> - <td>-g</td> - <td>Print the size of the specified log buffer and exits.</td> -</tr> -<tr> - <td>-n <count></td> - <td>Sets the maximum number of rotated logs to <count>. The default value is 4. Requires the -r option</td> -</tr> -<tr> - <td>-r <Kbytes></td> - <td>Rotates the log file every <Kbytes> of output. The default value is 16. Requires the -f option.</td> -</tr> -<tr> - <td>-s</td> - <td>Sets the default filter spec to silent.</td> -</tr> -<tr> - <td>-v <format></td> - <td>Sets the output format for log messages. The default is brief format. </td> -</tr> - -</table> - - - -@} -**/ diff --git a/include/dlog.h b/include/dlog.h index acc4656..709451a 100755 --- a/include/dlog.h +++ b/include/dlog.h @@ -21,14 +21,10 @@ * @version 0.4 * @brief This file is the header file of interface of dlog. */ -/** - * @addtogroup CAPI_BASE_DLOG_MODULE - * @{ - * - */ #ifndef _DLOG_H_ #define _DLOG_H_ +#include <tizen_error.h> #include <stdarg.h> #include <string.h> @@ -55,22 +51,54 @@ extern "C" { #endif #endif -/* - * log priority values, in ascending priority order. +/** + * @addtogroup CAPI_SYSTEM_DLOG + * @{ + * + */ +/** + * @brief Enumeration for Dlog Error. + * @since_tizen 2.3 + */ +typedef enum { + DLOG_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful */ + DLOG_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */ + DLOG_ERROR_NOT_PERMITTED = TIZEN_ERROR_NOT_PERMITTED, /**< Operation not permitted */ +} dlog_error_e; +/** + * @} + */ + +/** + * @addtogroup CAPI_SYSTEM_DLOG + * @{ + * + */ +/** + * @brief log priority values, in ascending priority order. + * @since_tizen 2.3 */ typedef enum { - DLOG_UNKNOWN = 0, - DLOG_DEFAULT, - DLOG_VERBOSE, - DLOG_DEBUG, - DLOG_INFO, - DLOG_WARN, - DLOG_ERROR, - DLOG_FATAL, - DLOG_SILENT, - DLOG_PRIO_MAX /* Keep this always at the end. */ + DLOG_UNKNOWN = 0, /**< Keep this always at the start */ + DLOG_DEFAULT, /**< Default */ + DLOG_VERBOSE, /**< Verbose */ + DLOG_DEBUG, /**< Debug */ + DLOG_INFO, /**< Info */ + DLOG_WARN, /**< Warning */ + DLOG_ERROR, /**< Error */ + DLOG_FATAL, /**< Fatal */ + DLOG_SILENT, /**< Silent */ + DLOG_PRIO_MAX /**< Keep this always at the end. */ } log_priority; +/** + * @} + */ +/** + * @internal + * @brief log id + * @since_tizen 2.3 + */ typedef enum { LOG_ID_MAIN = 0, LOG_ID_RADIO, @@ -79,8 +107,10 @@ typedef enum { LOG_ID_MAX } log_id_t; +static inline int __dlog_no_print(const char *fmt __attribute__((unused)), ...) { return 0; } + #define CONDITION(cond) (__builtin_expect((cond) != 0, 0)) -#define NOP(fmt, arg...) ({ do { } while (0); }) +#define NOP(...) ({ do { __dlog_no_print(__VA_ARGS__); } while (0); }) // Macro inner work--------------------------------------------------------------- #undef LOG_ @@ -109,13 +139,15 @@ typedef enum { #endif // --------------------------------------------------------------------- /** - * For Secure Log. - * Normally we strip Secure log from release builds. + * @internal + * @brief For Secure Log. + * @remarks Normally we strip Secure log from release builds. * Please use this macros. */ /** - * For Application and etc. - * Simplified macro to send a main log message using the current LOG_TAG. + * @internal + * @brief For Application and etc. + * @details Simplified macro to send a main log message using the current LOG_TAG. * Example: * SECURE_LOGD("app debug %d", num); * SECURE_LOGE("app error %d", num); @@ -126,8 +158,9 @@ typedef enum { #define SECURE_LOGE(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_ERROR, LOG_TAG, format, ##arg) #define SECURE_LOGF(format, arg...) SECURE_LOG_(LOG_ID_MAIN, DLOG_FATAL, LOG_TAG, format, ##arg) /** - * For Framework and system etc. - * Simplified macro to send a system log message using the current LOG_TAG. + * @internal + * @brief For Framework and system etc. + * @details Simplified macro to send a system log message using the current LOG_TAG. * Example: * SECURE_SLOGD("system debug %d", num); * SECURE_SLOGE("system error %d", num); @@ -138,8 +171,9 @@ typedef enum { #define SECURE_SLOGE(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_ERROR, LOG_TAG, format, ##arg) #define SECURE_SLOGF(format, arg...) SECURE_LOG_(LOG_ID_SYSTEM, DLOG_FATAL, LOG_TAG, format, ##arg) /** - * For Modem and radio etc. - * Simplified macro to send a radio log message using the current LOG_TAG. + * @internal + * @brief For Modem and radio etc. + * @details Simplified macro to send a radio log message using the current LOG_TAG. * Example: * SECURE_RLOGD("radio debug %d", num); * SECURE_RLOGE("radio error %d", num); @@ -150,7 +184,8 @@ typedef enum { #define SECURE_RLOGE(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_ERROR, LOG_TAG, format, ##arg) #define SECURE_RLOGF(format, arg...) SECURE_LOG_(LOG_ID_RADIO, DLOG_FATAL, LOG_TAG, format, ##arg) /** - * For Tizen OSP Application macro. + * @internal + * @brief For Tizen OSP Application macro. */ #define SECURE_ALOGD(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_DEBUG, LOG_TAG, format, ##arg) #define SECURE_ALOGI(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_INFO, LOG_TAG, format, ##arg) @@ -158,7 +193,8 @@ typedef enum { #define SECURE_ALOGE(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_ERROR, LOG_TAG, format, ##arg) #define SECURE_ALOGF(format, arg...) SECURE_LOG_(LOG_ID_APPS, DLOG_FATAL, LOG_TAG, format, ##arg) /** - * If you want use redefined macro. + * @internal + * @details If you want use redefined macro. * You can use this macro. * This macro need priority and tag arguments. */ @@ -168,8 +204,9 @@ typedef enum { #define SECURE_ALOG(priority, tag, format, arg...) SECURE_LOG_(LOG_ID_APPS, D##priority, tag, format, ##arg) /** - * For Application and etc. - * Simplified macro to send a main log message using the current LOG_TAG. + * @internal + * @brief For Application and etc. + * @details Simplified macro to send a main log message using the current LOG_TAG. * Example: * LOGD("app debug %d", num); * LOGE("app error %d", num); @@ -184,8 +221,9 @@ typedef enum { #define LOGE(format, arg...) LOG_(LOG_ID_MAIN, DLOG_ERROR, LOG_TAG, format, ##arg) #define LOGF(format, arg...) LOG_(LOG_ID_MAIN, DLOG_FATAL, LOG_TAG, format, ##arg) /** - * For Framework and system etc. - * Simplified macro to send a system log message using the current LOG_TAG. + * @internal + * @brief For Framework and system etc. + * @details Simplified macro to send a system log message using the current LOG_TAG. * Example: * SLOGD("system debug %d", num); * SLOGE("system error %d", num); @@ -200,8 +238,9 @@ typedef enum { #define SLOGE(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_ERROR, LOG_TAG, format, ##arg) #define SLOGF(format, arg...) LOG_(LOG_ID_SYSTEM, DLOG_FATAL, LOG_TAG, format, ##arg) /** - * For Modem and radio etc. - * Simplified macro to send a radio log message using the current LOG_TAG. + * @internal + * @brief For Modem and radio etc. + * @details Simplified macro to send a radio log message using the current LOG_TAG. * Example: * RLOGD("radio debug %d", num); * RLOGE("radio error %d", num); @@ -216,7 +255,8 @@ typedef enum { #define RLOGE(format, arg...) LOG_(LOG_ID_RADIO, DLOG_ERROR, LOG_TAG, format, ##arg) #define RLOGF(format, arg...) LOG_(LOG_ID_RADIO, DLOG_FATAL, LOG_TAG, format, ##arg) /** - * For Tizen OSP Application macro. + * @internal + * @brief For Tizen OSP Application macro. */ #ifdef TIZEN_DEBUG_ENABLE #define ALOGD(format, arg...) LOG_(LOG_ID_APPS, DLOG_DEBUG, LOG_TAG, format, ##arg) @@ -229,7 +269,9 @@ typedef enum { #define ALOGF(format, arg...) LOG_(LOG_ID_APPS, DLOG_FATAL, LOG_TAG, format, ##arg) /** - * Basic log message macro that allows you to specify a priority and a tag + * @internal + * @brief Basic log message macro + * @details This macro allows you to specify a priority and a tag * if you want to use this macro directly, you must add this messages for unity of messages. * (LOG(prio, tag, "%s: %s(%d) > " format, __MODULE__, __func__, __LINE__, ##arg)) * @@ -246,7 +288,9 @@ typedef enum { #define SLOG(priority, tag, format, arg...) LOG_(LOG_ID_SYSTEM, D##priority, tag, format, ##arg) #define RLOG(priority, tag, format, arg...) LOG_(LOG_ID_RADIO, D##priority, tag, format, ##arg) #define ALOG(priority, tag, format, arg...) LOG_(LOG_ID_APPS, D##priority, tag, format, ##arg) - +/** + * @internal + */ #define LOG_VA(priority, tag, fmt, args) \ vprint_log(D##priority, tag, fmt, args) #define ALOG_VA(priority, tag, fmt, args) \ @@ -277,8 +321,9 @@ typedef enum { #define COMPATIBILITY_ON #ifdef COMPATIBILITY_ON /** - * Conditional Macro. - * Don't use this macro. It's just compatibility. + * @internal + * @breif Conditional Macro. + * @remarks Don't use this macro. It's just compatibility. * It will be deprecated. */ #define LOGD_IF(cond, format, arg...) \ @@ -381,59 +426,133 @@ typedef enum { #define RLOGV_IF(cond, format, arg...) NOP(format, ##arg) #define SECLOG(...) ({ do { } while (0); }) #endif -// Don't use above macro no more!! It will be removed -Verbose, Warning and Fatal priority macro. // --------------------------------------------------------------------- + +/** + * @addtogroup CAPI_SYSTEM_DLOG + * @{ + */ +/** + * @brief Send log with priority and tag. + * @details for application + * @since_tizen 2.3 + * @param[in] prio log_priority + * @param[in] tag tag + * @param[in] fmt format string + * @return On success, the function returns the number of bytes written. + * On error, a negative errno-style error code + * @retval #DLOG_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #DLOG_ERROR_NOT_PERMITTED Operation not permitted + * @pre none + * @post none + * @see dlog_vprint + * @code +#include<dlog.h> +int main(void) +{ + int integer = 21; + char string[] = "test dlog"; + + dlog_print(DLOG_INFO, "USR_TAG", "test dlog"); + dlog_print(DLOG_INFO, "USR_TAG", "%s, %d", string, integer); + return 0; +} + * @endcode + */ +int dlog_print(log_priority prio, const char *tag, const char *fmt, ...); + +/** + * @brief Send log with priority, tag and va_list. + * @details for application + * @since_tizen 2.3 + * @param[in] prio log_priority + * @param[in] tag tag + * @param[in] fmt format string + * @param[in] ap va_list + * @return On success, the function returns the number of bytes written. + * On error, a negative errno-style error code + * @retval #DLOG_ERROR_INVALID_PARAMETER Invalid parameter + * @retval #DLOG_ERROR_NOT_PERMITTED Operation not permitted + * @pre none + * @post none + * @see dlog_print + * @code +#include<dlog.h> +void my_debug_print(char *format, ...) +{ + va_list ap; + + va_start(ap, format); + dlog_vprint(DLOG_INFO, "USR_TAG", format, ap); + va_end(ap); +} + +int main(void) +{ + my_debug_print("%s", "test dlog"); + my_debug_print("%s, %d", "test dlog", 21); + return 0; +} + * @endcode + */ +int dlog_vprint(log_priority prio, const char *tag, const char *fmt, va_list ap); +/** + * @} + */ + + /* * The stuff in the rest of this file should not be used directly. */ /** - * @brief send log. must specify log_id ,priority, tag and format string. - * @pre none - * @post none - * @see __dlog_print - * @remarks you must not use this API directly. use macros instead. - * @param[in] log_id log device id - * @param[in] prio priority - * @param[in] tag tag - * @param[in] fmt format string - * @return Operation result - * @retval 0>= Success - * @retval -1 Error + * @internal + * @brief Send log. + * @details Use LOG(), SLOG(), RLOG() family + * not to use __dlog_print() directly + * @remarks Must not use this API directly. use macros instead. + * @param[in] log_id log device id + * @param[in] prio priority + * @param[in] tag tag + * @param[in] fmt format string + * @return Operation result + * @retval 0>= Success + * @retval -1 Error + * @pre none + * @post none + * @see __dlog_print * @code -// you have to use LOG(), SLOG(), RLOG() family not to use __dlog_print() directly -// so below example is just for passing Documentation Verification !!! -#define LOG_TAG USR_TAG -#include<dlog.h> - __dlog_print(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly"); + #define LOG_TAG USR_TAG + #include<dlog.h> + __dlog_print(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly"); * @endcode */ int __dlog_print(log_id_t log_id, int prio, const char *tag, const char *fmt, ...); /** - * @brief send log with va_list. must specify log_id ,priority, tag and format string. - * @pre none - * @post none - * @see __dlog_print - * @remarks you must not use this API directly. use macros instead. - * @param[in] log_id log device id - * @param[in] prio priority - * @param[in] tag tag - * @param[in] fmt format string - * @param[in] ap va_list - * @return Operation result - * @retval 0>= Success - * @retval -1 Error + * @internal + * @brief Send log with va_list. + * @details Use LOG_VA(), SLOG_VA(), RLOG_VA() family + not to use __dlog_vprint() directly + * @remarks Must not use this API directly. use macros instead. + * @param[in] log_id log device id + * @param[in] prio priority + * @param[in] tag tag + * @param[in] fmt format string + * @param[in] ap va_list + * @return Operation result + * @retval 0>= Success + * @retval -1 Error + * @pre none + * @post none + * @see __dlog_vprint * @code - // you have to use LOG_VA(), SLOG_VA(), RLOG_VA() family not to use __dlog_print() directly - // so below example is just for passing Documentation Verification !!! -#define LOG_TAG USR_TAG -#include<dlog.h> - __dlog_vprint(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly", ap); + #define LOG_TAG USR_TAG + #include<dlog.h> + __dlog_vprint(LOG_ID_MAIN, DLOG_INFO, USR_TAG, "you must not use this API directly", ap); * @endcode */ int __dlog_vprint(log_id_t log_id, int prio, const char *tag, const char *fmt, va_list ap); #ifdef __cplusplus } #endif /* __cplusplus */ -/** @} */ #endif /* _DLOG_H_*/ diff --git a/include/logprint.h b/include/logprint.h index 3cd79bc..45792f4 100755 --- a/include/logprint.h +++ b/include/logprint.h @@ -38,6 +38,7 @@ typedef enum { FORMAT_RAW, FORMAT_TIME, FORMAT_THREADTIME, + FORMAT_DUMP, FORMAT_LONG, } log_print_format; |