From fad4d5b4131d0054787a804f217448b32512ef43 Mon Sep 17 00:00:00 2001 From: "jk7744.park" Date: Sun, 1 Feb 2015 13:52:01 +0900 Subject: [PATCH] tizen 2.3 release --- AUTHORS | 3 - Makefile.am | 9 +- TC/unit/Makefile | 4 +- TC/unit/tslist | 2 + TC/unit/utc_ApplicationFW_dlog_print_func.c | 66 +++ TC/unit/utc_ApplicationFW_dlog_vprint_func.c | 76 ++++ configure.ac | 3 + dlog.pc.in | 4 +- doc/dlog_doc.h | 57 +++ include/SLP_Dlog_PG.h | 183 -------- include/dlog.h | 271 +++++++---- include/logprint.h | 1 + packaging/dlog.spec | 11 +- packaging/dlog_logger.conf-micro-debug.in | 3 + packaging/dlog_logger.conf-micro.in | 6 +- packaging/dlog_logger.conf.in | 7 +- packaging/dlog_logger.service | 2 +- src/libdlog/log.c | 73 ++- src/libdlog/loglimiter.c | 16 +- src/logger/logger.c | 121 ++++- src/logutil/logutil.c | 645 ++++++++++++--------------- src/shared/logprint.c | 81 +++- 22 files changed, 951 insertions(+), 693 deletions(-) delete mode 100755 AUTHORS create mode 100644 TC/unit/utc_ApplicationFW_dlog_print_func.c create mode 100644 TC/unit/utc_ApplicationFW_dlog_vprint_func.c create mode 100755 doc/dlog_doc.h delete mode 100755 include/SLP_Dlog_PG.h create mode 100644 packaging/dlog_logger.conf-micro-debug.in diff --git a/AUTHORS b/AUTHORS deleted file mode 100755 index 2190840..0000000 --- a/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -juho son -Suchang Woo -kyungmin Park diff --git a/Makefile.am b/Makefile.am index a822503..e057c51 100755 --- a/Makefile.am +++ b/Makefile.am @@ -1,4 +1,7 @@ -AM_CFLAGS = -I$(srcdir)/include $(DEBUG_CFLAGS) -Werror +AM_CFLAGS = -I$(srcdir)/include \ + $(DEBUG_CFLAGS) \ + -Werror \ + $(CAPI_BASE_COMMON_CFLAGS) dlog_includedir = $(includedir)/dlog dlog_include_HEADERS = \ @@ -14,7 +17,9 @@ libdlog_la_SOURCES = \ src/libdlog/loglimiter.c \ include/loglimiter.h -libdlog_la_LIBADD = -lpthread $(systemd_journal_LIBS) +libdlog_la_LIBADD = -lpthread \ + $(systemd_journal_LIBS) \ + $(CAPI_BASE_COMMON_LIBS) bin_PROGRAMS = dlogutil dlog_logger diff --git a/TC/unit/Makefile b/TC/unit/Makefile index 7be4c17..276344d 100644 --- a/TC/unit/Makefile +++ b/TC/unit/Makefile @@ -1,7 +1,9 @@ CC ?= gcc TARGETS = utc_ApplicationFW___dlog_print_func \ - utc_ApplicationFW___dlog_vprint_func + utc_ApplicationFW___dlog_vprint_func \ + utc_ApplicationFW_dlog_print_func \ + utc_ApplicationFW_dlog_vprint_func PKGS = dlog diff --git a/TC/unit/tslist b/TC/unit/tslist index 0d9e63d..9345449 100644 --- a/TC/unit/tslist +++ b/TC/unit/tslist @@ -1,2 +1,4 @@ +/unit/utc_ApplicationFW_dlog_print_func +/unit/utc_ApplicationFW_dlog_vprint_func /unit/utc_ApplicationFW___dlog_print_func /unit/utc_ApplicationFW___dlog_vprint_func diff --git a/TC/unit/utc_ApplicationFW_dlog_print_func.c b/TC/unit/utc_ApplicationFW_dlog_print_func.c new file mode 100644 index 0000000..517edc4 --- /dev/null +++ b/TC/unit/utc_ApplicationFW_dlog_print_func.c @@ -0,0 +1,66 @@ +#include +#include "dlog.h" +#define LOG_BUF_SIZE 1024 +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_ApplicationFW_dlog_print_func_01(void); +static void utc_ApplicationFW_dlog_print_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_ApplicationFW_dlog_print_func_01, POSITIVE_TC_IDX }, + { utc_ApplicationFW_dlog_print_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +//static int pid; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} + +/** + * @brief Positive test case of dlog_print() + */ +static void utc_ApplicationFW_dlog_print_func_01(void) +{ + int r = 0; + + r = dlog_print(DLOG_DEBUG, "DLOG_TEST", "dlog test message for tetware\n"); + + if (r<0) { + tet_printf("dlog_print() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init dlog_print() + */ +static void utc_ApplicationFW_dlog_print_func_02(void) +{ + int r = 0; + + r = dlog_print(DLOG_UNKNOWN, "DLOG_TEST", "dlog test message for tetware\n"); + + if (r>=0) { + tet_printf("dlog_print() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/TC/unit/utc_ApplicationFW_dlog_vprint_func.c b/TC/unit/utc_ApplicationFW_dlog_vprint_func.c new file mode 100644 index 0000000..eb736a2 --- /dev/null +++ b/TC/unit/utc_ApplicationFW_dlog_vprint_func.c @@ -0,0 +1,76 @@ +#include +#include +#include "dlog.h" +#define LOG_BUF_SIZE 1024 +static void startup(void); +static void cleanup(void); + +void (*tet_startup)(void) = startup; +void (*tet_cleanup)(void) = cleanup; + +static void utc_ApplicationFW_dlog_vprint_func_01(void); +static void utc_ApplicationFW_dlog_vprint_func_02(void); + +enum { + POSITIVE_TC_IDX = 0x01, + NEGATIVE_TC_IDX, +}; + +struct tet_testlist tet_testlist[] = { + { utc_ApplicationFW_dlog_vprint_func_01, POSITIVE_TC_IDX }, + { utc_ApplicationFW_dlog_vprint_func_02, NEGATIVE_TC_IDX }, + { NULL, 0 } +}; + +static int pid; +char *fmt = "dlog test message for tetware\n"; + +static void startup(void) +{ +} + +static void cleanup(void) +{ +} +/** + * @brief Positive test case of dlog_vprint() + */ +void utc_ApplicationFW_dlog_vprint_func_01(void) +{ + int r = 0; + char buf[LOG_BUF_SIZE]; + va_list ap; + + /* va_start(ap, fmt);*/ + + r = dlog_vprint(DLOG_DEBUG, "DLOG_TEST", buf, ap ); + /* va_end(ap);*/ + + if (r<0) { + tet_printf("dlog_vprint() failed in positive test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} + +/** + * @brief Negative test case of ug_init dlog_vprint() + */ +void utc_ApplicationFW_dlog_vprint_func_02(void) +{ + int r = 0; + char buf[LOG_BUF_SIZE]; + va_list ap; +// va_start(ap, fmt); + + r = dlog_vprint(DLOG_UNKNOWN, "DLOG_TEST", fmt, ap ); +// va_end(ap); + + if (r>=0) { + tet_printf("dlog_vprint() failed in negative test case"); + tet_result(TET_FAIL); + return; + } + tet_result(TET_PASS); +} diff --git a/configure.ac b/configure.ac index a5f2a1e..cbd9996 100755 --- a/configure.ac +++ b/configure.ac @@ -81,6 +81,9 @@ AC_FUNC_MALLOC AC_FUNC_STAT AC_CHECK_FUNCS([memset]) +PKG_PROG_PKG_CONFIG +PKG_CHECK_MODULES([CAPI_BASE_COMMON], [capi-base-common]) + # output files AC_CONFIG_FILES([Makefile dlog.pc]) AC_OUTPUT diff --git a/dlog.pc.in b/dlog.pc.in index db6484a..9d902a1 100755 --- a/dlog.pc.in +++ b/dlog.pc.in @@ -6,7 +6,7 @@ includedir=${prefix}/include Name: dlog Description: logging service Version: 1.0 -Requires: +Requires: capi-base-common Requires(post): @systemd_journal@ -Libs: -L${libdir} -ldlog -lpthread @systemd_journal_LIBS@ +Libs: -L${libdir} -ldlog -lpthread @systemd_journal_LIBS@ @CAPI_BASE_COMMON_LIBS@ Cflags: -I${includedir}/dlog diff --git a/doc/dlog_doc.h b/doc/dlog_doc.h new file mode 100755 index 0000000..1d825b1 --- /dev/null +++ b/doc/dlog_doc.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved + * + * Licensed under the Apache License, Version 2.0 (the License); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an AS IS BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __TIZEN_SYSTEM_DLOG_DOC_H__ +#define __TIZEN_SYSTEM_DLOG_DOC_H__ + +/** + * @defgroup CAPI_SYSTEM_DLOG dlog + * @brief The Dlog API provides functions for sending log output. + * @ingroup CAPI_SYSTEM_FRAMEWORK + * @section CAPI_SYSTEM_DLOG_HEADER Required Header + * \#include + * + * @section CAPI_SYSTEM_DLOG_OVERVIEW Overview + * +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. +

priority

+priority level indicates the urgency of log message + + + + + + + + + + + + + + + + + + + + + + +
PriorityDescription
DLOG_DEBUGDebug messasge. - Log message which developer want to check.
DLOG_INFOInformation message - Normal operational messages. above of this priority will always be logged.
DLOG_WARNWarning messages - Not an error, but indication that an error will occur if action is not taken.
DLOG_ERRORError message - Indicate error.
+* +**/ +#endif /* __TIZEN_SYSTEM_DLOG_DOC_H__ */ 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 - @{ - -

Introduction

-Dlog logging service support sending log message to circular log device - -

dlog Architecture

-@image html SLP_Dlog_PG_image001.png System Architecture of dlog - -

dlog properties

-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. -

priority

-priority level incdicates the urgency of log message - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PriorityDescription
VERBOSE Verbose message. - compiled into application and logged at runtime only when debug mode. on release mode, this log message is strip.
DEBUGDebug 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.
INFOInformation message - Normal operational messages. above of this priority will always be logged.
WARNWarning messages - not an error, but indication that an error will occur if action is not taken
ERRORError message - indicate error.
FATALFatal message - Should be corrected immediately ( not used yet )
- -

Tag

-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 - -

list of dlog macro

-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. - -

sample code

-Using simplified macro with current LOG_TAG - -@code -#define LOG_TAG "YOUR_APP" -#include - -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 - -#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 - -#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 -

dlogutil

-

Introduction

-You can use dlogutil command to view and follow the contents of the log buffers. The general usage is : -@code -dlogutil [