From 75452c87a44305b5726938c920eb3269f0893182 Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Sat, 1 Apr 2017 10:23:18 -0700 Subject: [PATCH] Bug 1353143 - Part 6: Remove prlog.h from mozilla/Logging.h. r=froydnj This removes NSPR logging references from mozilla logging. MozReview-Commit-ID: 8Zq2tbhdCv --- xpcom/base/Logging.cpp | 12 ------------ xpcom/base/Logging.h | 37 ++++++------------------------------- 2 files changed, 6 insertions(+), 43 deletions(-) diff --git a/xpcom/base/Logging.cpp b/xpcom/base/Logging.cpp index 6d03f40278a3..fb7adec9c849 100644 --- a/xpcom/base/Logging.cpp +++ b/xpcom/base/Logging.cpp @@ -44,18 +44,6 @@ namespace mozilla { namespace detail { -void log_print(const PRLogModuleInfo* aModule, - LogLevel aLevel, - const char* aFmt, ...) -{ - va_list ap; - va_start(ap, aFmt); - char* buff = mozilla::Vsmprintf(aFmt, ap); - PR_LogPrint("%s", buff); - mozilla::SmprintfFree(buff); - va_end(ap); -} - void log_print(const LogModule* aModule, LogLevel aLevel, const char* aFmt, ...) diff --git a/xpcom/base/Logging.h b/xpcom/base/Logging.h index 335517610865..55437b41b49e 100644 --- a/xpcom/base/Logging.h +++ b/xpcom/base/Logging.h @@ -10,18 +10,10 @@ #include #include -#include "prlog.h" - #include "mozilla/Assertions.h" #include "mozilla/Atomics.h" #include "mozilla/Attributes.h" #include "mozilla/Likely.h" -#include "mozilla/MacroForEach.h" - -// This file is a placeholder for a replacement to the NSPR logging framework -// that is defined in prlog.h. Currently it is just a pass through, but as -// work progresses more functionality will be swapped out in favor of -// mozilla logging implementations. // We normally have logging enabled everywhere, but measurements showed that // having logging enabled on Android is quite expensive (hundreds of kilobytes @@ -192,20 +184,6 @@ private: namespace detail { -inline bool log_test(const PRLogModuleInfo* module, LogLevel level) { - MOZ_ASSERT(level != LogLevel::Disabled); - return module && module->level >= static_cast(level); -} - -/** - * A rather inefficient wrapper for PR_LogPrint that always allocates. - * PR_LogModuleInfo is deprecated so it's not worth the effort to do - * any better. - */ -void log_print(const PRLogModuleInfo* aModule, - LogLevel aLevel, - const char* aFmt, ...) MOZ_FORMAT_PRINTF(3, 4); - inline bool log_test(const LogModule* module, LogLevel level) { MOZ_ASSERT(level != LogLevel::Disabled); return module && module->ShouldLog(level); @@ -239,15 +217,12 @@ void log_print(const LogModule* aModule, #define MOZ_LOG_TEST(_module,_level) false #endif -#define MOZ_LOG(_module,_level,_args) \ - PR_BEGIN_MACRO \ - if (MOZ_LOG_TEST(_module,_level)) { \ - mozilla::detail::log_print(_module, _level, MOZ_LOG_EXPAND_ARGS _args); \ - } \ - PR_END_MACRO - -#undef PR_LOG -#undef PR_LOG_TEST +#define MOZ_LOG(_module,_level,_args) \ + do { \ + if (MOZ_LOG_TEST(_module,_level)) { \ + mozilla::detail::log_print(_module, _level, MOZ_LOG_EXPAND_ARGS _args); \ + } \ + } while (0) // This #define is a Logging.h-only knob! Don't encourage people to get fancy // with their log definitions by exporting it outside of Logging.h.