libdvr: flooding logs when playing DTV [1/1]
PD#SWPL-85528
Problem:
Libdvr has flooding logs when playing DTV
Solution:
Introduce a new API dvr_wrapper_set_log_level to control log level;
Provide new macros for logging;
Adjust log levels of existing prints;
Verify:
Locally tested OK in AH212 RDK environment.
Signed-off-by: Wentao.MA <wentao.ma@amlogic.com>
Change-Id: Ie4ef235639da4d6e92e45ce8e94b85439dc04f69
diff --git a/include/dvb_utils.h b/include/dvb_utils.h
index dca2d45..20571ab 100644
--- a/include/dvb_utils.h
+++ b/include/dvb_utils.h
@@ -9,6 +9,7 @@
#include <android/log.h>
#include <stdio.h>
#include <inttypes.h>
+#include "dvr_types.h"
#ifdef __cplusplus
extern "C" {
@@ -20,25 +21,18 @@
DVB_SUCCESS = 0
} DVB_RESULT;
-/**Logcat TAG of dvb*/
-#define DVB_LOG_TAG "dvb_debug"
-/**Default debug level*/
-#define DVB_DEBUG_LEVEL 1
-
-/**Log output*/
-#define dvb_log_print(...) __android_log_print(ANDROID_LOG_INFO, DVB_LOG_TAG, __VA_ARGS__)
#ifndef __ANDROID_API__
typedef unsigned int uint_t;
#endif
-/**Output debug message.*/
-#define DVB_DEBUG(_level, _fmt...) \
- do \
- { \
- if (_level <= DVB_DEBUG_LEVEL) \
- dvb_log_print(_fmt); \
- } while (0)
+/**Log facilities*/
+#define DVB_LOG_TAG "libdvr-dvb"
+#define DVB_DEBUG(...) DVR_LOG_PRINT(LOG_LV_DEBUG, DVB_LOG_TAG, __VA_ARGS__)
+#define DVB_INFO(...) DVR_LOG_PRINT(LOG_LV_INFO, DVB_LOG_TAG, __VA_ARGS__)
+#define DVB_WARN(...) DVR_LOG_PRINT(LOG_LV_WARN, DVB_LOG_TAG, __VA_ARGS__)
+#define DVB_ERROR(...) DVR_LOG_PRINT(LOG_LV_ERROR, DVB_LOG_TAG, __VA_ARGS__)
+#define DVB_FATAL(...) DVR_LOG_PRINT(LOG_LV_FATAL, DVB_LOG_TAG, __VA_ARGS__)
/**Demux input source.*/
typedef enum