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 14:31:01 -07:00
Родитель f82c0e7caf
Коммит e8a5eb8d6e
4 изменённых файлов: 10 добавлений и 13 удалений

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

@ -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);

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

@ -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);

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

@ -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

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

@ -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