This allows actually honoring the requested log level properly if there are multiple codec instances within the same process.
Showing the changes to codec/common/src/welsCodecTrace.cpp (1 of 2 files). Show all
Unified · Split
| @@ -46,15 +46,14 @@ · 45 unmodified lines | ||
| 46 | 46 | |
| 47 | 47 | #include "logging.h" |
| 48 | 48 | |
| 49 | −int32_t welsCodecTrace::m_iTraceLevel = WELS_LOG_DEFAULT; | |
| 50 | −CM_WELS_TRACE welsCodecTrace::m_fpTrace = NULL; | |
| 51 | 49 | |
| 52 | 50 | welsCodecTrace::welsCodecTrace() { |
| 53 | 51 | |
| 52 | + m_iTraceLevel = WELS_LOG_DEFAULT; | |
| 54 | 53 | m_fpTrace = welsStderrTrace; |
| 55 | 54 | |
| 56 | 55 | m_sLogCtx.pLogCtx = this; |
| 57 | − m_sLogCtx.pfLog = CODEC_TRACE; | |
| 56 | + m_sLogCtx.pfLog = StaticCodecTrace; | |
| 58 | 57 | } |
| 59 | 58 | |
| 60 | 59 | welsCodecTrace::~welsCodecTrace() { |
| @@ -63,7 +62,12 @@ welsCodecTrace::~welsCodecTrace() { · 2 unmodified lines | ||
| 63 | 62 | |
| 64 | 63 | #define MAX_LOG_SIZE 1024 |
| 65 | 64 | |
| 66 | −void welsCodecTrace::CODEC_TRACE (void* ignore, const int32_t iLevel, const char* Str_Format, va_list vl) { | |
| 65 | +void welsCodecTrace::StaticCodecTrace (void* pCtx, const int32_t iLevel, const char* Str_Format, va_list vl) { | |
| 66 | + welsCodecTrace* self = (welsCodecTrace*) pCtx; | |
| 67 | + self->CodecTrace (iLevel, Str_Format, vl); | |
| 68 | +} | |
| 69 | + | |
| 70 | +void welsCodecTrace::CodecTrace (const int32_t iLevel, const char* Str_Format, va_list vl) { | |
| 67 | 71 | if (m_iTraceLevel < iLevel) { |
| 68 | 72 | return; |
| 69 | 73 | } |