Revise frequent logs
authorSangchul Lee <sc11.lee@samsung.com>
Tue, 16 May 2023 02:18:07 +0000 (11:18 +0900)
committer이상철/Tizen Platform Lab(SR)/삼성전자 <sc11.lee@samsung.com>
Tue, 16 May 2023 06:47:49 +0000 (15:47 +0900)
Function for submitting packet is called frequently,
hence the log level is revised from info to debug.

[Version] 0.2.3

Signed-off-by: Sangchul Lee <sc11.lee@samsung.com>
packaging/espp-service.spec
src/client/espp_service_client.c
src/common/espp_service_common.h
src/daemon/espp_service_handler.c
src/daemon/espp_service_priv.h

index cc7298ac51ffb5c5a8a4c97476a21699b56f034d..0e779386a3f8565c774b01275cbca8c57ae7af9f 100644 (file)
@@ -1,6 +1,6 @@
 Name:       espp-service
 Summary:    ESPP service package which contains client lib. and daemon binary
-Version:    0.2.2
+Version:    0.2.3
 Release:    0
 Group:      Multimedia/Libraries
 License:    Apache-2.0
index 73af99c4df98d79c0b0f1362f9ed4a2744fd3217..527d994235d785f222ba236f7a8a1fa865df90d0 100644 (file)
@@ -598,7 +598,7 @@ int espp_client_submit_packet(espp_h espp, espp_packet_s *packet, espp_submit_er
        if (espp_service_client_socket_request_submit_packet(_espp, packet, error) != 0)
                return ESPP_CLIENT_ERROR_INVALID_OPERATION;
 
-       LOG_INFO("espp[%p]", espp);
+       LOG_DEBUG("espp[%p], packet[%p, %s]", espp, packet, packet->type == ESPP_STREAM_TYPE_AUDIO ? "AUDIO" : "VIDEO");
 
        return ESPP_CLIENT_ERROR_NONE;
 }
index c66165f0edee9af3703bb5220857351f48936795..d19b9fa0b3c97460502c709ee44ea8fcea3babb2 100644 (file)
@@ -80,6 +80,14 @@ do { \
        LOGD(FONT_COLOR_PURPLE"<Leave>"FONT_COLOR_RESET); \
 } while (0)
 
+#define LOG_INFO_OR_DEBUG(expr, fmt, arg...) \
+do { \
+       if ((expr)) \
+               LOGI(FONT_COLOR_GREEN""fmt""FONT_COLOR_RESET, ##arg); \
+       else \
+               LOGD(FONT_COLOR_RESET""fmt""FONT_COLOR_RESET, ##arg); \
+} while (0)
+
 #else
 #define LOG_DEBUG(fmt, arg...) printf(FONT_COLOR_RESET""fmt"\n"FONT_COLOR_RESET, ##arg);
 #define LOG_INFO(fmt, arg...) printf(FONT_COLOR_GREEN""fmt"\n"FONT_COLOR_RESET, ##arg);
@@ -87,6 +95,7 @@ do { \
 #define LOG_ERROR(fmt, arg...) printf(FONT_COLOR_RED""fmt"\n"FONT_COLOR_RESET, ##arg);
 #define LOG_DEBUG_ENTER() printf(FONT_COLOR_PURPLE"<Enter>\n"FONT_COLOR_RESET);
 #define LOG_DEBUG_LEAVE() printf(FONT_COLOR_PURPLE"<Leave>\n"FONT_COLOR_RESET);
+#define LOG_INFO_OR_DEBUG(info, fmt, arg...) printf(FONT_COLOR_GREEN""fmt"\n"FONT_COLOR_RESET, ##arg);
 #endif
 
 #define RET_IF(expr, fmt, arg...) \
index e63d0bc9bc6f02dfac5268cd2ef790f5e516cd53..0e4cff865c10dec3982670a0958e8dfe594eea11 100644 (file)
@@ -626,7 +626,8 @@ static void __handle_submit_packet(handler_userdata_s *hdata, espp_service_data_
        if (ret != 0)
                return;
 
-       LOG_INFO("type[%d], buffer_size[%u], pts[%" PRIu64 "], duration[%" PRIu64 "], hdr10p_metadata_size[%u]",
+       LOG_INFO_OR_DEBUG(hdata->submit_count % 100 == 0,
+               "type[%d], buffer_size[%u], pts[%" PRIu64 "], duration[%" PRIu64 "], hdr10p_metadata_size[%u]",
                es_packet.type, es_packet.buffer_size, es_packet.pts, es_packet.duration, es_packet.hdr10p_metadata_size);
 
        if (es_packet.buffer_size > 0) {
@@ -642,7 +643,8 @@ static void __handle_submit_packet(handler_userdata_s *hdata, espp_service_data_
                return;
        }
 
-       LOG_INFO("fd[%d], ESPP[%p]: esplusplayer_submit_packet() success", hdata->fd, hdata->espp);
+       LOG_INFO_OR_DEBUG(hdata->submit_count++ % 100 == 0, "fd[%d], ESPP[%p]: esplusplayer_submit_packet() success [%d]",
+               hdata->fd, hdata->espp, hdata->submit_count);
 
        result->ret = 0;
 }
@@ -937,7 +939,10 @@ int espp_service_func_handler(handler_userdata_s *hdata, espp_service_data_from_
        ASSERT(data);
        ASSERT(result);
 
-       LOG_WARNING("fd[%d] data[%p, request:%s]", hdata->fd, data, requests[data->request].str);
+       if (data->request == ESPP_SERVICE_REQUEST_SUBMIT_PACKET)
+               LOG_DEBUG("fd[%d] data[%p, request:%s]", hdata->fd, data, requests[data->request].str);
+       else
+               LOG_WARNING("fd[%d] data[%p, request:%s]", hdata->fd, data, requests[data->request].str);
 
        handlers[data->request](hdata, data, result);
 
index 2f8c40070e28cc137d22d9a15003f2adb7d91804..1291699b6d163ea153417c192bab3f43f8478ece 100644 (file)
@@ -62,6 +62,7 @@ typedef struct {
        } client;
        void *espp;
        gchar *key;
+       int submit_count;
 } handler_userdata_s;
 
 /* socket */