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
46 46
47#include "logging.h"47#include "logging.h"
48 48
49int32_t welsCodecTrace::m_iTraceLevel = WELS_LOG_DEFAULT;
50CM_WELS_TRACE welsCodecTrace::m_fpTrace = NULL;
51 49
52welsCodecTrace::welsCodecTrace() {50welsCodecTrace::welsCodecTrace() {
53 51
52 m_iTraceLevel = WELS_LOG_DEFAULT;
54 m_fpTrace = welsStderrTrace;53 m_fpTrace = welsStderrTrace;
55 54
56 m_sLogCtx.pLogCtx = this;55 m_sLogCtx.pLogCtx = this;
57 m_sLogCtx.pfLog = CODEC_TRACE;56 m_sLogCtx.pfLog = StaticCodecTrace;
58}57}
59 58
60welsCodecTrace::~welsCodecTrace() {59welsCodecTrace::~welsCodecTrace() {
@@ -63,7 +62,12 @@ welsCodecTrace::~welsCodecTrace() { · 2 unmodified lines
63 62
64#define MAX_LOG_SIZE 102463#define MAX_LOG_SIZE 1024
65 64
66void welsCodecTrace::CODEC_TRACE (void* ignore, const int32_t iLevel, const char* Str_Format, va_list vl) {65void 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
70void welsCodecTrace::CodecTrace (const int32_t iLevel, const char* Str_Format, va_list vl) {
67 if (m_iTraceLevel < iLevel) {71 if (m_iTraceLevel < iLevel) {
68 return;72 return;
69 }73 }

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