ref: f9b7746ea1e881a04d799ca559510af69fe465b9
parent: eb889c95e0f1389af99ba4534f8cc19a4de0198b
parent: cc65a1d76cbc9eb0aca26ebfc5d0bc45ac0426fe
author: ruil2 <[email protected]>
date: Tue Jun 10 12:52:54 EDT 2014
Merge pull request #942 from mstorsjo/log-cleanup Clean up some of the logging/trace files
--- a/codec/common/inc/utils.h
+++ b/codec/common/inc/utils.h
@@ -84,32 +84,6 @@
/*!
*************************************************************************************
- * \brief set log iLevel from external call
- *
- * \param iLevel iLevel of log
- *
- * \return NONE
- *
- * \note can be able to control log iLevel dynamically
- *************************************************************************************
- */
-void WelsSetLogLevel (const int32_t kiLevel);
-
-/*!
- *************************************************************************************
- * \brief get log iLevel from external call
- *
- * \param N/A
- *
- * \return current iLevel of log used in codec internal
- *
- * \note can be able to get log iLevel of internal codec applicable
- *************************************************************************************
- */
-int32_t WelsGetLogLevel (void);
-
-/*!
- *************************************************************************************
* \brief set log callback from external call
*
* \param _log log function routine
--- a/codec/common/inc/welsCodecTrace.h
+++ b/codec/common/inc/welsCodecTrace.h
@@ -47,11 +47,6 @@
static void CODEC_TRACE (void* pIgnore, const int32_t kiLevel, const char* kpStrFormat, va_list vl);
void SetTraceLevel (const int32_t kiLevel);
- int32_t WelsTraceModuleIsExist();
-
- private:
-
- int32_t m_WelsTraceExistFlag;
public:
static int32_t m_iTraceLevel;
--- a/codec/common/src/utils.cpp
+++ b/codec/common/src/utils.cpp
@@ -48,55 +48,10 @@
const int32_t kiHeight);
-iWelsLogLevel g_iLevelLog = WELS_LOG_DEFAULT; // default log iLevel
-int32_t g_iSizeLogBuf = 1024; // pBuffer size for each log output
-PWelsLogCallbackFunc wlog;
+static PWelsLogCallbackFunc wlog;
/*!
*************************************************************************************
- * \brief set log iLevel from external call
- *
- * \param iLevel iLevel of log
- *
- * \return NONE
- *
- * \note can be able to control log iLevel dynamically
- *************************************************************************************
- */
-void WelsSetLogLevel (const int32_t kiLevel) {
- iWelsLogLevel iVal = 0;
- if (kiLevel & WELS_LOG_ERROR) {
- iVal |= WELS_LOG_ERROR;
- }
- if (kiLevel & WELS_LOG_WARNING) {
- iVal |= WELS_LOG_WARNING;
- }
- if (kiLevel & WELS_LOG_INFO) {
- iVal |= WELS_LOG_INFO;
- }
- if (kiLevel & WELS_LOG_DEBUG) {
- iVal |= WELS_LOG_DEBUG;
- }
- g_iLevelLog = iVal;
-}
-
-/*!
- *************************************************************************************
- * \brief get log iLevel from external call
- *
- * \param N/A
- *
- * \return current iLevel of log used in codec internal
- *
- * \note can be able to get log iLevel of internal codec applicable
- *************************************************************************************
- */
-int32_t WelsGetLogLevel (void) {
- return g_iLevelLog;
-}
-
-/*!
- *************************************************************************************
* \brief set log callback from external call
*
* \param _log log function routine
@@ -110,14 +65,10 @@
wlog = _log;
}
-void WelsLogCall (void* pCtx, int32_t iLevel, const char* kpFmt, va_list vl) {
- wlog (pCtx, iLevel, kpFmt, vl);
-}
-
void WelsLog (void* pCtx, int32_t iLevel, const char* kpFmt, ...) {
va_list vl;
va_start (vl, kpFmt);
- WelsLogCall (pCtx, iLevel, kpFmt, vl);
+ wlog (pCtx, iLevel, kpFmt, vl);
va_end (vl);
}
--- a/codec/common/src/welsCodecTrace.cpp
+++ b/codec/common/src/welsCodecTrace.cpp
@@ -58,7 +58,6 @@
m_fpInfoTrace = welsStderrTrace<WELS_LOG_INFO>;
m_fpWarnTrace = welsStderrTrace<WELS_LOG_WARNING>;
m_fpErrorTrace = welsStderrTrace<WELS_LOG_ERROR>;
- m_WelsTraceExistFlag = true;
}
welsCodecTrace::~welsCodecTrace() {
@@ -66,14 +65,8 @@
m_fpInfoTrace = NULL;
m_fpWarnTrace = NULL;
m_fpErrorTrace = NULL;
-// g_bWelsLibLoaded = false;
- m_WelsTraceExistFlag = false;
}
-int32_t welsCodecTrace::WelsTraceModuleIsExist() {
- return m_WelsTraceExistFlag;
-}
-
void welsCodecTrace::TraceString (int32_t iLevel, const char* str) {
switch (iLevel) {
case WELS_LOG_ERROR:
@@ -102,19 +95,13 @@
#define MAX_LOG_SIZE 1024
void welsCodecTrace::CODEC_TRACE (void* ignore, const int32_t iLevel, const char* Str_Format, va_list vl) {
-// if(g_traceLevel < iLevel)
if (m_iTraceLevel < iLevel) {
return;
}
char pBuf[MAX_LOG_SIZE] = {0};
- const int32_t len = strlen ("[ENCODER]: "); // confirmed_safe_unsafe_usage
+ WelsVsnprintf (pBuf, MAX_LOG_SIZE, Str_Format, vl); // confirmed_safe_unsafe_usage
-
- WelsStrncpy (pBuf, MAX_LOG_SIZE, "[ENCODER]: "); // confirmed_safe_unsafe_usage
- WelsVsnprintf (pBuf + len, MAX_LOG_SIZE - len, Str_Format, vl); // confirmed_safe_unsafe_usage
-
-// g_WelsCodecTrace.TraceString(iLevel, pBuf);
welsCodecTrace::TraceString (iLevel, pBuf);
}
--- a/codec/decoder/plus/src/welsDecoderExt.cpp
+++ b/codec/decoder/plus/src/welsDecoderExt.cpp
@@ -102,15 +102,9 @@
m_pWelsTrace = new welsCodecTrace();
if (m_pWelsTrace != NULL) {
- const int32_t iWelsTraceExistingFlag = m_pWelsTrace->WelsTraceModuleIsExist();
- if (iWelsTraceExistingFlag) {
- m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
- WelsSetLogCallback (welsCodecTrace::CODEC_TRACE);
- }
+ m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
+ WelsSetLogCallback (welsCodecTrace::CODEC_TRACE);
}
-
- // initialization
- WelsSetLogLevel (WELS_LOG_ERROR); // no output, WELS_LOG_QUIET
WelsLog (NULL, WELS_LOG_INFO, "CWelsDecoder::CWelsDecoder() entry");
--- a/codec/encoder/plus/src/welsEncoderExt.cpp
+++ b/codec/encoder/plus/src/welsEncoderExt.cpp
@@ -172,15 +172,9 @@
m_pWelsTrace = new welsCodecTrace();
if (m_pWelsTrace != NULL) {
- const int32_t iWelsTraceExistingFlag = m_pWelsTrace->WelsTraceModuleIsExist();
- if (iWelsTraceExistingFlag) {
- m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
- WelsSetLogCallback (welsCodecTrace::CODEC_TRACE);
- }
+ m_pWelsTrace->SetTraceLevel (WELS_LOG_ERROR);
+ WelsSetLogCallback (welsCodecTrace::CODEC_TRACE);
}
-
- // initialization
- WelsSetLogLevel (WELS_LOG_ERROR); // no output, WELS_LOG_QUIET
}
/* Interfaces override from ISVCEncoder */