Bug 1353143 - Part 5: Replace direct usage of PR_LogPrint. r=froydnj

This replaces the usage of |PR_LogPrint| with either |printf_stderr| or
|MOZ_LOG| where appropriate. |printf_stderr| is used where a logger is not
actually available or if log levels are not being used as expected.
This commit is contained in:
Eric Rahm 2017-04-04 14:36:21 -07:00
Родитель 471c9b0472
Коммит 89708e6a2a
6 изменённых файлов: 25 добавлений и 22 удалений

Просмотреть файл

@ -180,7 +180,7 @@ struct BasicLogger
#else #else
#if defined(MOZ_LOGGING) #if defined(MOZ_LOGGING)
if (MOZ_LOG_TEST(GetGFX2DLog(), PRLogLevelForLevel(aLevel))) { if (MOZ_LOG_TEST(GetGFX2DLog(), PRLogLevelForLevel(aLevel))) {
PR_LogPrint("%s%s", aString.c_str(), aNoNewline ? "" : "\n"); MOZ_LOG(GetGFX2DLog(), PRLogLevelForLevel(aLevel), ("%s%s", aString.c_str(), aNoNewline ? "" : "\n"));
} else } else
#endif #endif
if ((LoggingPrefs::sGfxLogLevel >= LOG_DEBUG_PRLOG) || if ((LoggingPrefs::sGfxLogLevel >= LOG_DEBUG_PRLOG) ||

Просмотреть файл

@ -502,9 +502,9 @@ LayerTransactionParent::RecvUpdate(const TransactionInfo& aInfo)
severity = 1.f; severity = 1.f;
} }
mLayerManager->VisualFrameWarning(severity); mLayerManager->VisualFrameWarning(severity);
PR_LogPrint("LayerTransactionParent::RecvUpdate transaction from process %d took %f ms", printf_stderr("LayerTransactionParent::RecvUpdate transaction from process %d took %f ms",
OtherPid(), OtherPid(),
latency.ToMilliseconds()); latency.ToMilliseconds());
} }
} }

Просмотреть файл

@ -10543,7 +10543,7 @@ nsFrame::Trace(const char* aMethod, bool aEnter)
if (NS_FRAME_LOG_TEST(sFrameLogModule, NS_FRAME_TRACE_CALLS)) { if (NS_FRAME_LOG_TEST(sFrameLogModule, NS_FRAME_TRACE_CALLS)) {
char tagbuf[40]; char tagbuf[40];
GetTagName(this, mContent, sizeof(tagbuf), tagbuf); GetTagName(this, mContent, sizeof(tagbuf), tagbuf);
PR_LogPrint("%s: %s %s", tagbuf, aEnter ? "enter" : "exit", aMethod); printf_stderr("%s: %s %s", tagbuf, aEnter ? "enter" : "exit", aMethod);
} }
} }
@ -10553,7 +10553,7 @@ nsFrame::Trace(const char* aMethod, bool aEnter, nsReflowStatus aStatus)
if (NS_FRAME_LOG_TEST(sFrameLogModule, NS_FRAME_TRACE_CALLS)) { if (NS_FRAME_LOG_TEST(sFrameLogModule, NS_FRAME_TRACE_CALLS)) {
char tagbuf[40]; char tagbuf[40];
GetTagName(this, mContent, sizeof(tagbuf), tagbuf); GetTagName(this, mContent, sizeof(tagbuf), tagbuf);
PR_LogPrint("%s: %s %s, status=%scomplete%s", printf_stderr("%s: %s %s, status=%scomplete%s",
tagbuf, aEnter ? "enter" : "exit", aMethod, tagbuf, aEnter ? "enter" : "exit", aMethod,
aStatus.IsIncomplete() ? "not" : "", aStatus.IsIncomplete() ? "not" : "",
(aStatus.NextInFlowNeedsReflow()) ? "+reflow" : ""); (aStatus.NextInFlowNeedsReflow()) ? "+reflow" : "");
@ -10573,7 +10573,7 @@ nsFrame::TraceMsg(const char* aFormatString, ...)
char tagbuf[40]; char tagbuf[40];
GetTagName(this, mContent, sizeof(tagbuf), tagbuf); GetTagName(this, mContent, sizeof(tagbuf), tagbuf);
PR_LogPrint("%s: %s", tagbuf, argbuf); printf_stderr("%s: %s", tagbuf, argbuf);
} }
} }

Просмотреть файл

@ -24,6 +24,9 @@
* PRLogModuleInfo.level field to be a bitfield. Each bit controls a * PRLogModuleInfo.level field to be a bitfield. Each bit controls a
* specific type of logging. Each logging operation has associated * specific type of logging. Each logging operation has associated
* inline methods defined below. * inline methods defined below.
*
* Due to the redefinition of the level field we cannot use MOZ_LOG directly
* as that will cause assertions due to invalid log levels.
*/ */
#define NS_FRAME_TRACE_CALLS 0x1 #define NS_FRAME_TRACE_CALLS 0x1
#define NS_FRAME_TRACE_PUSH_PULL 0x2 #define NS_FRAME_TRACE_PUSH_PULL 0x2
@ -36,7 +39,7 @@
#define NS_FRAME_LOG(_bit,_args) \ #define NS_FRAME_LOG(_bit,_args) \
PR_BEGIN_MACRO \ PR_BEGIN_MACRO \
if (NS_FRAME_LOG_TEST(nsFrame::sFrameLogModule,_bit)) { \ if (NS_FRAME_LOG_TEST(nsFrame::sFrameLogModule,_bit)) { \
PR_LogPrint _args; \ printf_stderr _args; \
} \ } \
PR_END_MACRO PR_END_MACRO
#else #else

Просмотреть файл

@ -806,25 +806,25 @@ InMemoryDataSource::LogOperation(const char* aOperation,
nsXPIDLCString uri; nsXPIDLCString uri;
aSource->GetValue(getter_Copies(uri)); aSource->GetValue(getter_Copies(uri));
PR_LogPrint MOZ_LOG(gLog, LogLevel::Debug,
("InMemoryDataSource(%p): %s", this, aOperation); ("InMemoryDataSource(%p): %s", this, aOperation));
PR_LogPrint MOZ_LOG(gLog, LogLevel::Debug,
(" [(%p)%s]--", aSource, (const char*) uri); (" [(%p)%s]--", aSource, (const char*) uri));
aProperty->GetValue(getter_Copies(uri)); aProperty->GetValue(getter_Copies(uri));
char tv = (aTruthValue ? '-' : '!'); char tv = (aTruthValue ? '-' : '!');
PR_LogPrint MOZ_LOG(gLog, LogLevel::Debug,
(" --%c[(%p)%s]--", tv, aProperty, (const char*) uri); (" --%c[(%p)%s]--", tv, aProperty, (const char*) uri));
nsCOMPtr<nsIRDFResource> resource; nsCOMPtr<nsIRDFResource> resource;
nsCOMPtr<nsIRDFLiteral> literal; nsCOMPtr<nsIRDFLiteral> literal;
if ((resource = do_QueryInterface(aTarget)) != nullptr) { if ((resource = do_QueryInterface(aTarget)) != nullptr) {
resource->GetValue(getter_Copies(uri)); resource->GetValue(getter_Copies(uri));
PR_LogPrint MOZ_LOG(gLog, LogLevel::Debug,
(" -->[(%p)%s]", aTarget, (const char*) uri); (" -->[(%p)%s]", aTarget, (const char*) uri));
} }
else if ((literal = do_QueryInterface(aTarget)) != nullptr) { else if ((literal = do_QueryInterface(aTarget)) != nullptr) {
nsXPIDLString value; nsXPIDLString value;
@ -832,14 +832,14 @@ InMemoryDataSource::LogOperation(const char* aOperation,
nsAutoString valueStr(value); nsAutoString valueStr(value);
char* valueCStr = ToNewCString(valueStr); char* valueCStr = ToNewCString(valueStr);
PR_LogPrint MOZ_LOG(gLog, LogLevel::Debug,
(" -->(\"%s\")\n", valueCStr); (" -->(\"%s\")\n", valueCStr));
free(valueCStr); free(valueCStr);
} }
else { else {
PR_LogPrint MOZ_LOG(gLog, LogLevel::Debug,
(" -->(unknown-type)\n"); (" -->(unknown-type)\n"));
} }
} }

Просмотреть файл

@ -441,9 +441,9 @@ RDFContentSinkImpl::HandleEndElement(const char16_t *aName)
nsAutoString tagStr(aName); nsAutoString tagStr(aName);
char* tagCStr = ToNewCString(tagStr); char* tagCStr = ToNewCString(tagStr);
PR_LogPrint MOZ_LOG(gLog, LogLevel::Warning,
("rdfxml: extra close tag '%s' at line %d", ("rdfxml: extra close tag '%s' at line %d",
tagCStr, 0/*XXX fix me */); tagCStr, 0/*XXX fix me */));
free(tagCStr); free(tagCStr);
} }