History

Don't use global variables in welsCodecTrace

This allows actually honoring the requested log level properly if there are multiple codec instances within the same process.

Martin Storsjö committed 12 years ago

Commit ce8065f1 parent cb5ee6c2 files · +14 −8Browse files

Showing the changes to codec/common/src/welsCodecTrace.cpp (1 of 2 files). Show all

Unified · Split

codec/common/src/welsCodecTrace.cpp+8−4
@@ -46,15 +46,14 @@ · 45 unmodified lines
4646
4747 #include "logging.h"
4848
49−int32_t welsCodecTrace::m_iTraceLevel = WELS_LOG_DEFAULT;
50−CM_WELS_TRACE welsCodecTrace::m_fpTrace = NULL;
5149
5250 welsCodecTrace::welsCodecTrace() {
5351
52+ m_iTraceLevel = WELS_LOG_DEFAULT;
5453 m_fpTrace = welsStderrTrace;
5554
5655 m_sLogCtx.pLogCtx = this;
57− m_sLogCtx.pfLog = CODEC_TRACE;
56+ m_sLogCtx.pfLog = StaticCodecTrace;
5857 }
5958
6059 welsCodecTrace::~welsCodecTrace() {
@@ -63,7 +62,12 @@ welsCodecTrace::~welsCodecTrace() { · 2 unmodified lines
6362
6463 #define MAX_LOG_SIZE 1024
6564
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) {
6771 if (m_iTraceLevel < iLevel) {
6872 return;
6973 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t