Only keep one single trace function pointer in welsCodecTrace
This commit is contained in:
@@ -43,17 +43,13 @@ class welsCodecTrace {
|
|||||||
welsCodecTrace();
|
welsCodecTrace();
|
||||||
~welsCodecTrace();
|
~welsCodecTrace();
|
||||||
|
|
||||||
static void TraceString (int32_t iLevel, const char* kpStrFormat);
|
|
||||||
static void CODEC_TRACE (void* pIgnore, const int32_t kiLevel, const char* kpStrFormat, va_list vl);
|
static void CODEC_TRACE (void* pIgnore, const int32_t kiLevel, const char* kpStrFormat, va_list vl);
|
||||||
|
|
||||||
void SetTraceLevel (const int32_t kiLevel);
|
void SetTraceLevel (const int32_t kiLevel);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static int32_t m_iTraceLevel;
|
static int32_t m_iTraceLevel;
|
||||||
static CM_WELS_TRACE m_fpDebugTrace;
|
static CM_WELS_TRACE m_fpTrace;
|
||||||
static CM_WELS_TRACE m_fpInfoTrace;
|
|
||||||
static CM_WELS_TRACE m_fpWarnTrace;
|
|
||||||
static CM_WELS_TRACE m_fpErrorTrace;
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -47,49 +47,15 @@
|
|||||||
#include "logging.h"
|
#include "logging.h"
|
||||||
|
|
||||||
int32_t welsCodecTrace::m_iTraceLevel = WELS_LOG_DEFAULT;
|
int32_t welsCodecTrace::m_iTraceLevel = WELS_LOG_DEFAULT;
|
||||||
CM_WELS_TRACE welsCodecTrace::m_fpDebugTrace = NULL;
|
CM_WELS_TRACE welsCodecTrace::m_fpTrace = NULL;
|
||||||
CM_WELS_TRACE welsCodecTrace::m_fpInfoTrace = NULL;
|
|
||||||
CM_WELS_TRACE welsCodecTrace::m_fpWarnTrace = NULL;
|
|
||||||
CM_WELS_TRACE welsCodecTrace::m_fpErrorTrace = NULL;
|
|
||||||
|
|
||||||
welsCodecTrace::welsCodecTrace() {
|
welsCodecTrace::welsCodecTrace() {
|
||||||
|
|
||||||
m_fpDebugTrace = welsStderrTrace;
|
m_fpTrace = welsStderrTrace;
|
||||||
m_fpInfoTrace = welsStderrTrace;
|
|
||||||
m_fpWarnTrace = welsStderrTrace;
|
|
||||||
m_fpErrorTrace = welsStderrTrace;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
welsCodecTrace::~welsCodecTrace() {
|
welsCodecTrace::~welsCodecTrace() {
|
||||||
m_fpDebugTrace = NULL;
|
m_fpTrace = NULL;
|
||||||
m_fpInfoTrace = NULL;
|
|
||||||
m_fpWarnTrace = NULL;
|
|
||||||
m_fpErrorTrace = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void welsCodecTrace::TraceString (int32_t iLevel, const char* str) {
|
|
||||||
switch (iLevel) {
|
|
||||||
case WELS_LOG_ERROR:
|
|
||||||
if (m_fpErrorTrace)
|
|
||||||
m_fpErrorTrace (str);
|
|
||||||
break;
|
|
||||||
case WELS_LOG_WARNING:
|
|
||||||
if (m_fpWarnTrace)
|
|
||||||
m_fpWarnTrace (str);
|
|
||||||
break;
|
|
||||||
case WELS_LOG_INFO:
|
|
||||||
if (m_fpInfoTrace)
|
|
||||||
m_fpInfoTrace (str);
|
|
||||||
break;
|
|
||||||
case WELS_LOG_DEBUG:
|
|
||||||
if (m_fpDebugTrace)
|
|
||||||
m_fpDebugTrace (str);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (m_fpDebugTrace)
|
|
||||||
m_fpInfoTrace (str);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define MAX_LOG_SIZE 1024
|
#define MAX_LOG_SIZE 1024
|
||||||
@@ -102,7 +68,7 @@ void welsCodecTrace::CODEC_TRACE (void* ignore, const int32_t iLevel, const char
|
|||||||
char pBuf[MAX_LOG_SIZE] = {0};
|
char pBuf[MAX_LOG_SIZE] = {0};
|
||||||
WelsVsnprintf (pBuf, MAX_LOG_SIZE, Str_Format, vl); // confirmed_safe_unsafe_usage
|
WelsVsnprintf (pBuf, MAX_LOG_SIZE, Str_Format, vl); // confirmed_safe_unsafe_usage
|
||||||
|
|
||||||
welsCodecTrace::TraceString (iLevel, pBuf);
|
m_fpTrace (pBuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void welsCodecTrace::SetTraceLevel (const int32_t iLevel) {
|
void welsCodecTrace::SetTraceLevel (const int32_t iLevel) {
|
||||||
|
|||||||
Reference in New Issue
Block a user