Bug 1165515 - Part 14: Undef PR_LOG macros when using mozilla/Logging.h. r=froydnj

Make it harder for users to accidentally reintroduce usage of the PR_LOG macros
when using 'mozilla/Logging.h'. This can still be worked around by directly
including 'prlog.h' (and not 'mozilla/Logging.h') if absolutely necessary.
This commit is contained in:
Eric Rahm 2015-06-01 22:17:34 -07:00
parent 14740fdf18
commit 5505ea9746
4 changed files with 10 additions and 13 deletions

View File

@ -12,37 +12,37 @@ namespace mozilla {
Logger::~Logger()
{
PRLogModuleLevel prlevel = PR_LOG_DEBUG;
LogLevel prlevel = LogLevel::Debug;
int xpcomlevel = -1;
switch (mSeverity) {
case LOG_INFO:
prlevel = PR_LOG_DEBUG;
prlevel = LogLevel::Debug;
xpcomlevel = -1;
break;
case LOG_WARNING:
prlevel = PR_LOG_WARNING;
prlevel = LogLevel::Warning;
xpcomlevel = NS_DEBUG_WARNING;
break;
case LOG_ERROR:
prlevel = PR_LOG_ERROR;
prlevel = LogLevel::Error;
xpcomlevel = NS_DEBUG_WARNING;
break;
case LOG_ERROR_REPORT:
prlevel = PR_LOG_ERROR;
prlevel = LogLevel::Error;
xpcomlevel = NS_DEBUG_ASSERTION;
break;
case LOG_FATAL:
prlevel = PR_LOG_ERROR;
prlevel = LogLevel::Error;
xpcomlevel = NS_DEBUG_ABORT;
break;
}
PR_LOG(GetLog(), prlevel, ("%s:%i: %s", mFile, mLine, mMsg ? mMsg : "<no message>"));
MOZ_LOG(GetLog(), prlevel, ("%s:%i: %s", mFile, mLine, mMsg ? mMsg : "<no message>"));
if (xpcomlevel != -1)
NS_DebugBreak(xpcomlevel, mMsg, NULL, mFile, mLine);

View File

@ -199,8 +199,6 @@ CacheEntry::~CacheEntry()
MOZ_COUNT_DTOR(CacheEntry);
}
#ifdef PR_LOG
char const * CacheEntry::StateString(uint32_t aState)
{
switch (aState) {
@ -215,8 +213,6 @@ char const * CacheEntry::StateString(uint32_t aState)
return "?";
}
#endif
nsresult CacheEntry::HashingKeyWithStorage(nsACString &aResult) const
{
return HashingKey(mStorageID, mEnhanceID, mURI, aResult);

View File

@ -294,9 +294,7 @@ private:
// fails to open an output stream.
bool mHasData : 1;
#ifdef PR_LOG
static char const * StateString(uint32_t aState);
#endif
enum EState { // transiting to:
NOTLOADED = 0, // -> LOADING | EMPTY

View File

@ -63,5 +63,8 @@ inline bool log_test(const PRLogModuleInfo* module, LogLevel level) {
} \
PR_END_MACRO
#undef PR_LOG
#undef PR_LOG_TEST
#endif // mozilla_logging_h