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
#if defined(MOZ_LOGGING)
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
#endif
if ((LoggingPrefs::sGfxLogLevel >= LOG_DEBUG_PRLOG) ||

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

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

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

@ -10543,7 +10543,7 @@ nsFrame::Trace(const char* aMethod, bool aEnter)
if (NS_FRAME_LOG_TEST(sFrameLogModule, NS_FRAME_TRACE_CALLS)) {
char tagbuf[40];
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)) {
char tagbuf[40];
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,
aStatus.IsIncomplete() ? "not" : "",
(aStatus.NextInFlowNeedsReflow()) ? "+reflow" : "");
@ -10573,7 +10573,7 @@ nsFrame::TraceMsg(const char* aFormatString, ...)
char tagbuf[40];
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
* specific type of logging. Each logging operation has associated
* 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_PUSH_PULL 0x2
@ -36,7 +39,7 @@
#define NS_FRAME_LOG(_bit,_args) \
PR_BEGIN_MACRO \
if (NS_FRAME_LOG_TEST(nsFrame::sFrameLogModule,_bit)) { \
PR_LogPrint _args; \
printf_stderr _args; \
} \
PR_END_MACRO
#else

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

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

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

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