Port |Bug 1165515 - Add stub replacement for NSPR logging|. rs=bustage-fix
authorPatrick Cloke <clokep@gmail.com>
Wed, 10 Jun 2015 13:42:09 -0400
changeset 775 9e65893ce648d58eab6d0472225a4d5e9f1c917b
parent 774 e6736861f04ce004bd1f3221eb4635d3139c115e
child 776 2b62405a4ed14ad05eb3d645cdad9b380e635d39
push id51
push userclokep@gmail.com
push dateWed, 10 Jun 2015 17:42:41 +0000
reviewersbustage-fix
bugs1165515
Port |Bug 1165515 - Add stub replacement for NSPR logging|. rs=bustage-fix
purplexpcom/src/purpleAccount.cpp
purplexpcom/src/purpleAccountBuddy.cpp
purplexpcom/src/purpleAccountScoper.cpp
purplexpcom/src/purpleConvChat.cpp
purplexpcom/src/purpleConvIM.cpp
purplexpcom/src/purpleConversation.cpp
purplexpcom/src/purpleCoreService.cpp
purplexpcom/src/purpleDNS.cpp
purplexpcom/src/purpleDebug.cpp
purplexpcom/src/purpleGetText.cpp
purplexpcom/src/purpleInit.cpp
purplexpcom/src/purpleInitAccounts.cpp
purplexpcom/src/purpleInitCommands.cpp
purplexpcom/src/purpleInitContacts.cpp
purplexpcom/src/purpleInitConv.cpp
purplexpcom/src/purpleMessage.cpp
purplexpcom/src/purplePref.cpp
purplexpcom/src/purpleProtocol.cpp
purplexpcom/src/purpleSockets.cpp
purplexpcom/src/purpleSockets.h
purplexpcom/src/purpleTimer.cpp
--- a/purplexpcom/src/purpleAccount.cpp
+++ b/purplexpcom/src/purpleAccount.cpp
@@ -28,23 +28,21 @@
 #include <prplIProtocol.h>
 #include <prprf.h>
 #include "mozilla/Likely.h"
 
 #define PREF_PREFIX             "messenger.account."
 #define PREF_OPTIONS            "options."
 #define PREF_PROXY              "proxy"
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleAccount:5
 //
 static PRLogModuleInfo *gPurpleAccountLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleAccountLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleAccountLog, mozilla::LogLevel::Debug, args)
 
 extern int blist_signals_handle;
 
 class purpleChatRoomField final : public prplIChatRoomField,
                                   public nsIClassInfo
 {
 public:
   NS_DECL_ISUPPORTS
@@ -210,20 +208,18 @@ NS_IMPL_ISUPPORTS_CI(purpleAccount, prpl
 
 purpleAccount::purpleAccount()
   : mScoper(nullptr),
     mAccount(NULL),
     mConnectionErrorReason(NO_ERROR),
     mStatus(PURPLE_STATUS_AVAILABLE)
 {
   /* member initializers and constructor code */
-#ifdef PR_LOGGING
   if (!gPurpleAccountLog)
     gPurpleAccountLog = PR_NewLogModule("purpleAccount");
-#endif
   LOG(("Creating purpleAccount @%x\n", this));
 }
 
 purpleAccount::~purpleAccount()
 {
   /* destructor code */
   LOG(("Destructing purpleAccount @%x\n", this));
   if (mAccount)
--- a/purplexpcom/src/purpleAccountBuddy.cpp
+++ b/purplexpcom/src/purpleAccountBuddy.cpp
@@ -18,35 +18,31 @@
 #pragma GCC visibility push(default)
 #include <libpurple/core.h>
 #include <libpurple/status.h>
 #pragma GCC visibility pop
 
 NS_IMPL_CLASSINFO(purpleAccountBuddy, NULL, 0, PURPLE_ACCOUNTBUDDY_CID)
 NS_IMPL_ISUPPORTS_CI(purpleAccountBuddy, prplIAccountBuddy)
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleAccountBuddy:5
 //
 static PRLogModuleInfo *gPurpleAccountBuddyLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleAccountBuddyLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleAccountBuddyLog, mozilla::LogLevel::Debug, args)
 
 purpleAccountBuddy::purpleAccountBuddy(PurpleBuddy *aPurpleBuddy,
                                        imIBuddy *aBuddy)
   : mPurpleBuddy(aPurpleBuddy),
     mBuddy(aBuddy)
 {
   /* member initializers and constructor code */
   MOZ_COUNT_CTOR(purpleAccountBuddy);
-#ifdef PR_LOGGING
   if (!gPurpleAccountBuddyLog)
     gPurpleAccountBuddyLog = PR_NewLogModule("purpleAccountBuddy");
-#endif
 
   purple_blist_node_set_ui_data(PURPLE_BLIST_NODE(aPurpleBuddy), this);
   PurpleAccount *account = purple_buddy_get_account(aPurpleBuddy);
   purpleAccount *pAccount = purpleAccount::fromPurpleAccount(account);
   if (MOZ_LIKELY(pAccount))
     pAccount->GetImAccount(getter_AddRefs(mAccount));
   NS_ASSERTION(mAccount, "Failed to get the account from a PurpleBuddy");
 }
@@ -216,22 +212,20 @@ void purpleAccountBuddy::CleanUserInfo(v
 }
 
 /*   nsISimpleEnumerator getTooltipInfo(); */
 NS_IMETHODIMP purpleAccountBuddy::GetTooltipInfo(nsISimpleEnumerator** aTooltipInfo)
 {
   NS_ENSURE_TRUE(mBuddy, NS_ERROR_NOT_INITIALIZED);
   NS_ENSURE_TRUE(mAccount, NS_ERROR_NOT_INITIALIZED);
 
-#ifdef PR_LOGGING
   nsCString name;
   mAccount->GetName(name);
   LOG(("purpleAccountBuddy::GetTooltipInfo buddy = %s, account = %s",
        mPurpleBuddy->name, name.get()));
-#endif
 
   PurpleAccount *pAccount = purple_buddy_get_account(mPurpleBuddy);
   NS_ENSURE_TRUE(pAccount, NS_ERROR_NOT_INITIALIZED);
   if (!purple_account_is_connected(pAccount)) {
     *aTooltipInfo = nullptr;
     return NS_OK;
   }
 
--- a/purplexpcom/src/purpleAccountScoper.cpp
+++ b/purplexpcom/src/purpleAccountScoper.cpp
@@ -1,22 +1,20 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "purpleAccountScoper.h"
 #include "purpleAccount.h"
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleAccountScoper:5
 //
 static PRLogModuleInfo *gPurpleAccountScoperLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleAccountScoperLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleAccountScoperLog, mozilla::LogLevel::Debug, args)
 
 PRUint32 purpleAccountScoper::sCurrentId = 0;
 
 purpleAccountScoper::purpleAccountScoper(purpleAccount *aAccount)
 {
   if (aAccount) {
     enterScope(aAccount->ScopeId());
     return;
@@ -32,17 +30,15 @@ purpleAccountScoper::purpleAccountScoper
 purpleAccountScoper::~purpleAccountScoper()
 {
   LOG(("~purpleAccountScoper %u <- %u\n", mPreviousId, sCurrentId));
   sCurrentId = mPreviousId;
 }
 
 void purpleAccountScoper::enterScope(PRUint32 aId)
 {
-#ifdef PR_LOGGING
   if (!gPurpleAccountScoperLog)
     gPurpleAccountScoperLog = PR_NewLogModule("purpleAccountScoper");
-#endif
 
   mPreviousId = sCurrentId;
   LOG(("purpleAccountScoper  %u -> %u\n", sCurrentId, aId));
   sCurrentId = aId;
 }
--- a/purplexpcom/src/purpleConvChat.cpp
+++ b/purplexpcom/src/purpleConvChat.cpp
@@ -7,23 +7,21 @@
 #include "purpleGListEnumerator.h"
 
 #include <nsXPCOM.h>
 #include <nsStringAPI.h>
 #include <nsCOMPtr.h>
 #include <nsIClassInfoImpl.h>
 #include <nsMemory.h>
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleConversation:5
 //
 extern PRLogModuleInfo *gPurpleConvLog;
-#endif
-#define LOG(args) PR_LOG(gPurpleConvLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleConvLog, mozilla::LogLevel::Debug, args)
 
 //NS_IMPL_ISUPPORTS_CI(purpleConvChat, prplIConversation, prplIConvChat)
 NS_IMPL_CLASSINFO(purpleConvChat, NULL, 0, PURPLE_CONV_CHAT_CID)
 NS_INTERFACE_MAP_BEGIN(purpleConvChat)
   NS_INTERFACE_MAP_ENTRY(prplIConvChat)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(prplIConversation, purpleConversation)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, prplIConvChat)
   NS_IMPL_QUERY_CLASSINFO(purpleConvChat)
--- a/purplexpcom/src/purpleConvIM.cpp
+++ b/purplexpcom/src/purpleConvIM.cpp
@@ -6,23 +6,21 @@
 #include "purpleAccountBuddy.h"
 
 #include <nsIObserverService.h>
 #include <nsServiceManagerUtils.h>
 #include <nsXPCOM.h>
 #include <nsIClassInfoImpl.h>
 #include <nsMemory.h>
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleConversation:5
 //
 extern PRLogModuleInfo *gPurpleConvLog;
-#endif
-#define LOG(args) PR_LOG(gPurpleConvLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleConvLog, mozilla::LogLevel::Debug, args)
 
 //NS_IMPL_ISUPPORTS_CI(purpleConvIM, prplIConversation, prplIConvIM)
 NS_IMPL_CLASSINFO(purpleConvIM, NULL, 0, PURPLE_CONV_IM_CID)
 NS_INTERFACE_MAP_BEGIN(purpleConvIM)
   NS_INTERFACE_MAP_ENTRY(prplIConvIM)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(prplIConversation, purpleConversation)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, prplIConvIM)
   NS_IMPL_QUERY_CLASSINFO(purpleConvIM)
--- a/purplexpcom/src/purpleConversation.cpp
+++ b/purplexpcom/src/purpleConversation.cpp
@@ -15,34 +15,30 @@
 #include <nsServiceManagerUtils.h>
 #include <nsStringAPI.h>
 #include <nsXPCOM.h>
 #include <nsIDocument.h>
 #include <nsIDOMDocument.h>
 #include <nsIObserverService.h>
 #include <prtime.h> // for PR_Now
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleConversation:5
 //
 PRLogModuleInfo *gPurpleConvLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleConvLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleConvLog, mozilla::LogLevel::Debug, args)
 
 purpleConversation::purpleConversation()
   : mId(0),
     mStartDate(PR_Now()),
     mUninitialized(PR_FALSE)
 {
   /* member initializers and constructor code */
-#ifdef PR_LOGGING
   if (!gPurpleConvLog)
     gPurpleConvLog = PR_NewLogModule("purpleConversation");
-#endif
   LOG(("new purpleConversation @%x with id %i", this, mId));
 }
 
 purpleConversation::~purpleConversation()
 {
   /* destructor code */
   LOG(("destructing conversation @%x with id %i", this, mId));
 }
--- a/purplexpcom/src/purpleCoreService.cpp
+++ b/purplexpcom/src/purpleCoreService.cpp
@@ -28,24 +28,22 @@
 #include <nsIXULRuntime.h>
 #include <nsCRTGlue.h>
 #include <nsXPCOM.h>
 #include <nsArrayEnumerator.h>
 #include <nsNetUtil.h>
 #include <nsAppDirectoryServiceDefs.h>
 #include <nsDirectoryServiceUtils.h>
 
-#ifdef PR_LOGGING
 #include <prprf.h>
 //
 // NSPR_LOG_MODULES=purpleCoreService:5
 //
 static PRLogModuleInfo *gPurpleCoreServiceLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleCoreServiceLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleCoreServiceLog, mozilla::LogLevel::Debug, args)
 
 NS_IMPL_CLASSINFO(purpleCoreService, NULL, nsIClassInfo::SINGLETON,
                   PURPLE_CORE_SERVICE_CID)
 NS_IMPL_ISUPPORTS_CI(purpleCoreService, purpleICoreService, nsIObserver,
                      nsIMemoryReporter)
 
 extern nsresult init_libpurple();
 extern void init_libpurple_accounts();
@@ -57,20 +55,18 @@ extern void disconnect_blist_signals();
 extern int64_t getAllocatedGLibMemory();
 extern int64_t getAllocatedXMLMemory();
 
 
 purpleCoreService::purpleCoreService()
   :mInitialized(PR_FALSE),
    mQuitting(PR_FALSE)
 {
-#ifdef PR_LOGGING
   if (!gPurpleCoreServiceLog)
     gPurpleCoreServiceLog = PR_NewLogModule("purpleCoreService");
-#endif
   mPrefService = do_GetService(NS_PREFSERVICE_CONTRACTID);
   mPrefBranch2 = do_QueryInterface(mPrefService);
 }
 
 purpleCoreService::~purpleCoreService()
 {
   if (mInitialized)
     Quit();
--- a/purplexpcom/src/purpleDNS.cpp
+++ b/purplexpcom/src/purpleDNS.cpp
@@ -14,35 +14,31 @@
 #include <prio.h>
 #ifdef XP_WIN
 #include <winsock2.h>
 #include <ws2tcpip.h>
 #else
 #include <sys/un.h>
 #endif
 
-#ifdef PR_LOGGING
 #include <prnetdb.h>
 
 //
 // NSPR_LOG_MODULES=purpleDNS:5
 //
 static PRLogModuleInfo *gPurpleDNSLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleDNSLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleDNSLog, mozilla::LogLevel::Debug, args)
 
 /* Init static members */
 nsCOMArray<purpleDNSRequest> *purpleDNS::sRequests = nullptr;
 
 void purpleDNS::init()
 {
-#ifdef PR_LOGGING
   if (!gPurpleDNSLog)
     gPurpleDNSLog = PR_NewLogModule("purpleDNS");
-#endif
   sRequests = new nsCOMArray<purpleDNSRequest>();
 }
 
 void purpleDNS::unInit()
 {
   LOG(("purpleDNS:unInit: Canceling %i pending DNS requests",
        sRequests->Count()));
   for (PRInt32 i = 0; i < sRequests->Count(); ++i)
--- a/purplexpcom/src/purpleDebug.cpp
+++ b/purplexpcom/src/purpleDebug.cpp
@@ -14,23 +14,21 @@
 #include <nsILocalFile.h>
 #include <nsIObserverService.h>
 #include <nsIPrefBranch2.h>
 #include <nsIPrefService.h>
 #include <nsIScriptError.h>
 
 #define LOGLEVEL_PREF "purple.debug.loglevel"
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleDebug:5
 //
 static PRLogModuleInfo *gPurpleDebugLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleDebugLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleDebugLog, mozilla::LogLevel::Debug, args)
 
 purpleDebug *purpleDebug::sInstance = nullptr;
 
 NS_IMPL_ISUPPORTS(purpleDebug, nsIObserver)
 
 void purpleDebug::ReportMessage(PurpleDebugLevel level, const char *category,
                                 const char *arg)
 {
@@ -250,20 +248,18 @@ purpleDebug::purpleDebug()
   NS_ENSURE_TRUE(prefBranch, );
 
   prefBranch->AddObserver(LOGLEVEL_PREF, this, PR_FALSE);
   prefBranch->GetIntPref(LOGLEVEL_PREF, &mLogLevel);
 }
 
 nsresult purpleDebug::init()
 {
-#ifdef PR_LOGGING
   if (!gPurpleDebugLog)
     gPurpleDebugLog = PR_NewLogModule("purpleDebug");
-#endif
 
 #ifdef DEBUG
   if (g_getenv("PURPLE_VERBOSE_DEBUG"))
     purple_debug_set_verbose(TRUE);
 #endif
 
   if (!sInstance) {
     LOG(("creating a new instance of purpleDebug"));
--- a/purplexpcom/src/purpleGetText.cpp
+++ b/purplexpcom/src/purpleGetText.cpp
@@ -7,23 +7,21 @@
 #include <nsICryptoHash.h>
 #include <nsIObserverService.h>
 #include <nsIStringBundle.h>
 #include <nsServiceManagerUtils.h>
 #include <nsComponentManagerUtils.h>
 #include <nsNetCID.h>
 #include <nsNetUtil.h>
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleGetText:5
 //
 static PRLogModuleInfo *gPurpleGetTextLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleGetTextLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleGetTextLog, mozilla::LogLevel::Debug, args)
 
 purpleGetText *purpleGetText::sInstance = nullptr;
 
 NS_IMPL_ISUPPORTS(purpleGetText, nsIObserver)
 
 #define IMPL_PLURAL_RULE(aNumber, aRule)                        \
   static PRUint32 plural_rule_##aNumber(unsigned long int n)    \
   {                                                             \
@@ -466,20 +464,18 @@ purpleGetText::Observe(nsISupports *aSub
 purpleGetText::purpleGetText()
   : mStringCache(10),
     mPluralRule(nullptr)
 {
 }
 
 nsresult purpleGetText::init()
 {
-#ifdef PR_LOGGING
   if (!gPurpleGetTextLog)
     gPurpleGetTextLog = PR_NewLogModule("purpleGetText");
-#endif
 
   if (!sInstance) {
     LOG(("creating a new instance of purpleGetText\n"));
     sInstance = new purpleGetText();
     NS_ENSURE_TRUE(sInstance, NS_ERROR_OUT_OF_MEMORY);
     NS_ADDREF(sInstance);
 
     nsCOMPtr<nsIObserverService> os =
--- a/purplexpcom/src/purpleInit.cpp
+++ b/purplexpcom/src/purpleInit.cpp
@@ -36,23 +36,21 @@
 #include <nsDirectoryServiceDefs.h>
 
 extern void init_glib_memory_reporter();
 extern void init_libxml2_memory_reporter();
 
 #define PURPLE_PROTOCOL_PLUGIN_CATEGORY   "purple-protocol-plugin"
 
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleInit:5
 //
 PRLogModuleInfo *gPurpleInitLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleInitLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleInitLog, mozilla::LogLevel::Debug, args)
 
 #if defined(PURPLE_PLUGINS) && defined(XP_UNIX) && !defined(XP_MACOSX)
 #include <nsILocalFile.h>
 
 static nsresult open_libpurple(void)
 {
   nsCOMPtr<nsIFile> folder;
   nsresult rv = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR,
@@ -592,20 +590,18 @@ init_libpurple()
   nsCOMPtr<nsIFile> folder;
   nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR,
                                        getter_AddRefs(folder));
   NS_ENSURE_SUCCESS(rv, rv);
   nsString path;
   rv = folder->GetPath(path);
   NS_ENSURE_SUCCESS(rv, rv);
 
-#ifdef PR_LOGGING
   if (!gPurpleInitLog)
     gPurpleInitLog = PR_NewLogModule("purpleInit");
-#endif
 
   nsCString cPath;
   CopyUTF16toUTF8(path, cPath);
   LOG(("Setting custom user directory to:  %s", cPath.get()));
   purple_util_set_user_dir(cPath.get());
 
   purple_core_set_ui_ops(&core_uiops);
   purple_debug_set_ui_ops(&debugconsoleuiops);
--- a/purplexpcom/src/purpleInitAccounts.cpp
+++ b/purplexpcom/src/purpleInitAccounts.cpp
@@ -14,23 +14,21 @@
 #include <nsIDOMWindow.h>
 #include <nsIObserverService.h>
 #include <nsIPromptService.h>
 #include <nsIStringBundle.h>
 #include <nsThreadUtils.h>
 #include <nsIWindowMediator.h>
 #include "mozilla/Likely.h"
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleInit:5
 //
 extern PRLogModuleInfo *gPurpleInitLog;
-#endif
-#define LOG(args) PR_LOG(gPurpleInitLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleInitLog, mozilla::LogLevel::Debug, args)
 
 extern void buddy_availability_changed(PurpleBuddy *aBuddy);
 
 /*** Connection uiops ***/
 #define IMPL_GET_ACCOUNT_FROM_UI_DATA(aVar)                        \
   purpleAccount *account = purpleAccount::fromPurpleAccount(aVar); \
   NS_ENSURE_TRUE(account,)
 
--- a/purplexpcom/src/purpleInitCommands.cpp
+++ b/purplexpcom/src/purpleInitCommands.cpp
@@ -9,23 +9,21 @@
 #pragma GCC visibility push(default)
 #include <libpurple/cmds.h>
 #pragma GCC visibility pop
 
 #include <nsIClassInfo.h>
 #include <nsServiceManagerUtils.h>
 #include <nsStringAPI.h>
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleInit:5
 //
 extern PRLogModuleInfo *gPurpleInitLog;
-#endif
-#define LOG(args) PR_LOG(gPurpleInitLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleInitLog, mozilla::LogLevel::Debug, args)
 
 NS_DEFINE_NAMED_CID(PURPLE_CONV_CHAT_CID);
 NS_DEFINE_NAMED_CID(PURPLE_CONV_IM_CID);
 
 class purpleCommand final : public imICommand
 {
 public:
   NS_DECL_ISUPPORTS
--- a/purplexpcom/src/purpleInitContacts.cpp
+++ b/purplexpcom/src/purpleInitContacts.cpp
@@ -8,23 +8,21 @@
 
 #include "purpleAccountBuddy.h"
 #include <imIContactsService.h>
 #include <nsServiceManagerUtils.h>
 #include <nsAutoPtr.h> // for nsRefPtr
 #include <nsCOMPtr.h>
 #include <nsStringAPI.h>
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleInit:5
 //
 extern PRLogModuleInfo *gPurpleInitLog;
-#endif
-#define LOG(args) PR_LOG(gPurpleInitLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleInitLog, mozilla::LogLevel::Debug, args)
 
 /*
  * Used as handle to connect and then mass-disconnect the buddy list signals.
  * The value is 1 when the signals are connected, 0 when they are not.
  */
 int blist_signals_handle = 0;
 
 static void buddy_signals(PurpleBuddy *aBuddy, const char *aSignal)
--- a/purplexpcom/src/purpleInitConv.cpp
+++ b/purplexpcom/src/purpleInitConv.cpp
@@ -15,23 +15,21 @@
 #include <nsIObserverService.h>
 #include <nsIPrefBranch2.h>
 #include <nsIPrefService.h>
 #include <nsISupportsPrimitives.h>
 #include <nsArrayEnumerator.h>
 #include <nsComponentManagerUtils.h>
 #include <nsServiceManagerUtils.h>
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleInit:5
 //
 extern PRLogModuleInfo *gPurpleInitLog;
-#endif
-#define LOG(args) PR_LOG(gPurpleInitLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleInitLog, mozilla::LogLevel::Debug, args)
 
 /*** Conversation uiops ***/
 static void create_conv(PurpleConversation *aConv)
 {
   LOG(("Create conversation with name: %s", purple_conversation_get_name(aConv)));
 
   nsCOMPtr<imIConversationsService> convs =
     do_GetService("@mozilla.org/chat/conversations-service;1");
--- a/purplexpcom/src/purpleMessage.cpp
+++ b/purplexpcom/src/purpleMessage.cpp
@@ -7,36 +7,32 @@
 #include "purpleConversation.h"
 #include "purpleConvIM.h"
 #include "imIContactsService.h"
 #include <nsCOMPtr.h>
 #include <nsServiceManagerUtils.h>
 #include <nsIClassInfoImpl.h>
 #include <nsMemory.h>
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleMessage:5
 //
 static PRLogModuleInfo *gPurpleMessageLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleMessageLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleMessageLog, mozilla::LogLevel::Debug, args)
 
 NS_IMPL_CLASSINFO(purpleMessage, NULL, 0, PURPLE_MESSAGE_CID)
 NS_IMPL_ISUPPORTS_CI(purpleMessage, prplIMessage)
 
 PRUint32 purpleMessage::sLastId = 0;
 
 purpleMessage::purpleMessage()
 {
   /* member initializers and constructor code */
-#ifdef PR_LOGGING
   if (!gPurpleMessageLog)
     gPurpleMessageLog = PR_NewLogModule("purpleMessage");
-#endif
   LOG(("Constructing purpleMessage @%x", this));
   mId = ++sLastId;
 }
 
 purpleMessage::~purpleMessage()
 {
   /* destructor code */
   LOG(("Destructing purpleMessage @%x", this));
--- a/purplexpcom/src/purplePref.cpp
+++ b/purplexpcom/src/purplePref.cpp
@@ -8,23 +8,21 @@
 #include <nsIProgrammingLanguage.h>
 #include <nsMemory.h>
 #include <nsStringAPI.h>
 
 #pragma GCC visibility push(default)
 #include <libpurple/util.h>
 #pragma GCC visibility pop
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purplePref:5
 //
 static PRLogModuleInfo *gPurplePrefLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurplePrefLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurplePrefLog, mozilla::LogLevel::Debug, args)
 
 class purpleKeyValuePair final : public prplIKeyValuePair,
                                  public nsIClassInfo
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSICLASSINFO
   NS_DECL_PRPLIKEYVALUEPAIR
@@ -73,20 +71,18 @@ NS_IMETHODIMP purpleKeyValuePair::GetVal
 
 NS_IMPL_CLASSINFO(purplePref, NULL, 0, PURPLE_PREF_CID)
 NS_IMPL_THREADSAFE_CI(purplePref)
 NS_IMPL_ISUPPORTS_CI(purplePref, prplIPref)
 
 purplePref::purplePref()
 {
   /* member initializers and constructor code */
-#ifdef PR_LOGGING
   if (!gPurplePrefLog)
     gPurplePrefLog = PR_NewLogModule("purplePref");
-#endif
   LOG(("Constructing purplePref @%x", this));
 }
 
 void purplePref::Init(PurpleAccountOption *aOpt)
 {
   mOpt = aOpt;
   LOG(("\tpurplePref (type %i) %s initialized",
        mOpt->type, mOpt->pref_name));
--- a/purplexpcom/src/purpleProtocol.cpp
+++ b/purplexpcom/src/purpleProtocol.cpp
@@ -10,23 +10,20 @@
 #include <nsIClassInfoImpl.h>
 #include <nsMemory.h>
 #include <nsCOMPtr.h>
 #include <nsComponentManagerUtils.h>
 #include <nsNetUtil.h>
 #include <nsIChromeRegistry.h>
 #include <nsIProgrammingLanguage.h>
 
-#ifdef PR_LOGGING
-//
 // NSPR_LOG_MODULES=purpleProtocol:5
 //
 static PRLogModuleInfo *gPurpleProtocolLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleProtocolLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleProtocolLog, mozilla::LogLevel::Debug, args)
 
 class purpleUsernameSplit final : public prplIUsernameSplit,
                                   public nsIClassInfo
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSICLASSINFO
   NS_DECL_PRPLIUSERNAMESPLIT
@@ -79,20 +76,18 @@ PURPLE_IMPL_GETSPLITVALUE(bool *, Revers
 /* Implementation file */
 NS_IMPL_CLASSINFO(purpleProtocol, NULL, 0, PURPLE_PROTOCOL_CID)
 NS_IMPL_ISUPPORTS_CI(purpleProtocol, prplIProtocol)
 
 purpleProtocol::purpleProtocol()
   :mInfo(nullptr)
 {
   /* member initializers and constructor code */
-#ifdef PR_LOGGING
   if (!gPurpleProtocolLog)
     gPurpleProtocolLog = PR_NewLogModule("purpleProtocol");
-#endif
   LOG(("Creating protocol @%x", this));
 }
 
 /* void init (in AUTF8String aId); */
 NS_IMETHODIMP purpleProtocol::Init(const nsACString& aId)
 {
   NS_ENSURE_TRUE(!mInfo, NS_ERROR_ALREADY_INITIALIZED);
 
--- a/purplexpcom/src/purpleSockets.cpp
+++ b/purplexpcom/src/purpleSockets.cpp
@@ -8,23 +8,21 @@
 #include <nsComponentManagerUtils.h>
 #include <nsServiceManagerUtils.h>
 #include <nsIEventTarget.h>
 #include <nsIObserver.h>
 #include <nsIObserverService.h>
 #include <nsThreadUtils.h>
 #include <nsNetUtil.h>
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleSockets:5
 //
 static PRLogModuleInfo *gPurpleSocketsLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleSocketsLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleSocketsLog, mozilla::LogLevel::Debug, args)
 
 NS_IMPL_ISUPPORTS(purpleSocket, nsIRunnable)
 
 //export NSPR_LOG_MODULES="nsSocketTransport:5"
 
 PRUint32 purpleSocket::sLastSocket = 0;
 
 
@@ -65,21 +63,17 @@ nsresult purpleSocket::Init(PurpleInputF
   if (aCondition & PURPLE_INPUT_READ) {
     pollFlags |= (PR_POLL_READ | PR_POLL_EXCEPT);
   }
 
   if (aCondition & PURPLE_INPUT_WRITE) {
     pollFlags |= (PR_POLL_WRITE | PR_POLL_EXCEPT);
   }
 
-#ifdef PR_LOGGING
   mInternal = new purpleSocketInternal(mId);
-#else
-  mInternal = new purpleSocketInternal();
-#endif
   return mInternal->Init(PR_CreateSocketPollFd(mFd), this, pollFlags);
 }
 
 void purpleSocket::CallLibpurpleCallback()
 {
   LOG(("[%i] CallLibpurpleCallback (accountId = %u)\n", mId, mAccountId));
 
   purpleAccountScoper scoper(mAccountId);
@@ -104,23 +98,18 @@ NS_IMETHODIMP purpleSocket::Run()
   }
 
   return mInternal->PostEvent();
 }
 
 
 NS_IMPL_ISUPPORTS(purpleSocketInternal, nsIRunnable)
 
-#ifdef PR_LOGGING
 purpleSocketInternal::purpleSocketInternal(PRUint32 aId)
   : mId(aId),
-#else
-purpleSocketInternal::purpleSocketInternal()
-  :
-#endif
   mAttached(PR_FALSE),
   mDetached(PR_FALSE),
   mCanceled(PR_FALSE)
 {
   MOZ_COUNT_CTOR(purpleSocketInternal);
   LOG(("[%i]  constructing new purpleSocketInternal @%x\n", mId, this));
 }
 
@@ -153,21 +142,19 @@ nsresult purpleSocketInternal::Cancel()
 
 nsresult purpleSocketInternal::PostEvent()
 {
   nsresult rv;
   nsCOMPtr<nsIEventTarget> eventTarget =
     do_QueryInterface(purpleSocketWatcher::getSts(), &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
-#ifdef PR_LOGGING
   // 'this' may be released and freed on the socket thread before we
   // return from the Dispatch call, so cache the value of mId.
   PRUint32 id = mId;
-#endif
   rv = eventTarget->Dispatch(this, NS_DISPATCH_NORMAL);
   LOG(("[%i]  Dispatch %s\n", id, NS_FAILED(rv) ? "Failed!!!" : "OK"));
   return rv;
 }
 
 void purpleSocketInternal::OnSocketReady(PRFileDesc* fd, PRInt16 outFlags)
 {
   LOG(("[%i]  OnSocketReady\n", mId));
@@ -263,20 +250,18 @@ void purpleSocketInternal::IsLocal(bool 
 
 /* Init static members */
 nsTArray<purpleSocket *> *purpleSocketWatcher::sSockets = nullptr;
 nsCOMPtr<nsISocketTransportService> purpleSocketWatcher::sSts;
 nsCOMPtr<nsIObserver> purpleSocketWatcher::sObserver;
 
 void purpleSocketWatcher::init()
 {
-#ifdef PR_LOGGING
   if (!gPurpleSocketsLog)
     gPurpleSocketsLog = PR_NewLogModule("purpleSockets");
-#endif
   sSockets = new nsTArray<purpleSocket *>();
   sObserver = new purpleSocketNetworkStateObserver();
   nsCOMPtr<nsIObserverService> observerService =
     do_GetService("@mozilla.org/observer-service;1");
   if (observerService) {
     observerService->AddObserver(sObserver,
                                  NS_IOSERVICE_GOING_OFFLINE_TOPIC,
                                  PR_FALSE);
@@ -347,28 +332,26 @@ PRUint32 purpleSocketWatcher::AddWatch(g
   NS_ENSURE_TRUE(socket, 0);
 
   PRInt32 id;
   rv = socket->Init(aFunction, aData, aFd, aCondition, &id);
   NS_ENSURE_SUCCESS(rv, 0);
 
   sSockets->AppendElement(socket);
 
-#ifdef PR_LOGGING
   const char *mode = "none";
   if ((aCondition & PURPLE_INPUT_READ) && (aCondition & PURPLE_INPUT_WRITE))
     mode = "read/write";
   else if (aCondition & PURPLE_INPUT_READ)
     mode = "read";
   else if (aCondition & PURPLE_INPUT_WRITE)
     mode = "write";
 
   LOG(("[%i]SOCKETADD fd = %i, accountId = %u, mode = %s\n",
        id, aFd, purpleAccountScoper::GetCurrentAccountId(), mode));
-#endif
 
   return id;
 }
 
 gboolean purpleSocketWatcher::CancelWatch(PRUint32 aId)
 {
   LOG(("[%u]SOCKETCANCEL\n", aId));
   NS_ENSURE_TRUE(sSockets, FALSE);
--- a/purplexpcom/src/purpleSockets.h
+++ b/purplexpcom/src/purpleSockets.h
@@ -29,24 +29,18 @@ class purpleSocketInternal final : publi
   void OnSocketReady(PRFileDesc*, PRInt16);
   void OnSocketDetached(PRFileDesc*);
   void IsLocal(bool*);
   uint64_t ByteCountSent() { return 0; }
   uint64_t ByteCountReceived() { return 0; }
   nsresult PostEvent();
   nsresult Cancel();
   bool GetCanceled() { return mCanceled; }
-#ifdef PR_LOGGING
   purpleSocketInternal(PRUint32 aId);
-#else
-  purpleSocketInternal();
-#endif
-#ifdef PR_LOGGING
   PRUint32 mId;
-#endif
 
  private:
   ~purpleSocketInternal();
   nsresult OnAttach();
   PRFileDesc *mFd;
   PRInt16 mPollFlagsInternal;
   nsCOMPtr<nsIRunnable> mRunnable;
   bool mAttached;
--- a/purplexpcom/src/purpleTimer.cpp
+++ b/purplexpcom/src/purpleTimer.cpp
@@ -1,40 +1,36 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "purpleTimer.h"
 #include "purpleAccountScoper.h"
-#include <prlog.h>
+#include <mozilla/Logging.h>
 #include <nsComponentManagerUtils.h>
 #include <nsServiceManagerUtils.h>
 #include <nsIThreadManager.h>
 #include <nsIEventTarget.h>
 #include <nsThreadUtils.h>
 #include <nsXPCOMCIDInternal.h>
 
-#ifdef PR_LOGGING
 //
 // NSPR_LOG_MODULES=purpleTimer:5
 //
 static PRLogModuleInfo *gPurpleTimerLog = nullptr;
-#endif
-#define LOG(args) PR_LOG(gPurpleTimerLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gPurpleTimerLog, mozilla::LogLevel::Debug, args)
 
 /* Init static members */
 PRUint32 purpleTimer::sLastTimer = 0;
 nsTArray<nsRefPtr<purpleTimeout> > *purpleTimer::sTimeouts = nullptr;
 
 void purpleTimer::init()
 {
-#ifdef PR_LOGGING
   if (!gPurpleTimerLog)
     gPurpleTimerLog = PR_NewLogModule("purpleTimer");
-#endif
   sTimeouts = new nsTArray<nsRefPtr<purpleTimeout> >();
 }
 
 void purpleTimer::unInit()
 {
   LOG(("purpleTimer::unInit: removing %i leftover timeouts",
        sTimeouts->Length()));