Bug 1241301 - Use PR_LogPrint in purplexpcom following Bug 1174972. r=clokep
authoraleth <aleth@instantbird.org>
Wed, 20 Jan 2016 23:34:39 +0100
changeset 782 17fc639a64bdf4a481068e2e91b54f3de8de5d3e
parent 781 d18b0bddc4f8190e1bc07576e018557bd38b5150
child 783 270af9e2de0ea92f71772897dcf1586bc57cfa8e
push id58
push useraleth@instantbird.org
push dateWed, 20 Jan 2016 22:47:56 +0000
reviewersclokep
bugs1241301, 1174972
Bug 1241301 - Use PR_LogPrint in purplexpcom following Bug 1174972. r=clokep
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/purpleLogging.h
purplexpcom/src/purpleMessage.cpp
purplexpcom/src/purplePref.cpp
purplexpcom/src/purpleProtocol.cpp
purplexpcom/src/purpleSockets.cpp
purplexpcom/src/purpleTimer.cpp
--- a/purplexpcom/src/purpleAccount.cpp
+++ b/purplexpcom/src/purpleAccount.cpp
@@ -1,13 +1,14 @@
 /* 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 "purpleAccount.h"
+#include "purpleLogging.h"
 #include "purpleAccountBuddy.h"
 #include "purpleCoreService.h"
 #include "purpleConversation.h"
 #include "purpleGListEnumerator.h"
 #include "purpleSockets.h"
 #include "purpleTimer.h"
 
 #pragma GCC visibility push(default)
--- a/purplexpcom/src/purpleAccountBuddy.cpp
+++ b/purplexpcom/src/purpleAccountBuddy.cpp
@@ -1,13 +1,14 @@
 /* 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 "purpleAccountBuddy.h"
+#include "purpleLogging.h"
 #include "purpleCoreService.h"
 #include "purpleGetText.h"
 #include "purpleGListEnumerator.h"
 #include "purpleTooltipInfo.h"
 
 #include <nsServiceManagerUtils.h>
 #include <nsIClassInfoImpl.h>
 #include <nsMemory.h>
--- a/purplexpcom/src/purpleAccountScoper.cpp
+++ b/purplexpcom/src/purpleAccountScoper.cpp
@@ -1,14 +1,15 @@
 /* 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"
+#include "purpleLogging.h"
 
 //
 // NSPR_LOG_MODULES=purpleAccountScoper:5
 //
 static PRLogModuleInfo *gPurpleAccountScoperLog = nullptr;
 #define LOG(args) MOZ_LOG(gPurpleAccountScoperLog, mozilla::LogLevel::Debug, args)
 
 PRUint32 purpleAccountScoper::sCurrentId = 0;
--- a/purplexpcom/src/purpleConvChat.cpp
+++ b/purplexpcom/src/purpleConvChat.cpp
@@ -1,15 +1,16 @@
 /* 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 "purpleConvChat.h"
 #include "purpleConvChatBuddy.h"
 #include "purpleGListEnumerator.h"
+#include "purpleLogging.h"
 
 #include <nsXPCOM.h>
 #include <nsStringAPI.h>
 #include <nsCOMPtr.h>
 #include <nsIClassInfoImpl.h>
 #include <nsMemory.h>
 
 //
--- a/purplexpcom/src/purpleConvIM.cpp
+++ b/purplexpcom/src/purpleConvIM.cpp
@@ -1,14 +1,15 @@
 /* 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 "purpleConvIM.h"
 #include "purpleAccountBuddy.h"
+#include "purpleLogging.h"
 
 #include <nsIObserverService.h>
 #include <nsServiceManagerUtils.h>
 #include <nsXPCOM.h>
 #include <nsIClassInfoImpl.h>
 #include <nsMemory.h>
 
 //
--- a/purplexpcom/src/purpleConversation.cpp
+++ b/purplexpcom/src/purpleConversation.cpp
@@ -1,15 +1,16 @@
 /* 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 "purpleConversation.h"
 #include "purpleGListEnumerator.h"
 #include "purpleAccount.h"
+#include "purpleLogging.h"
 
 #pragma GCC visibility push(default)
 #include <libpurple/cmds.h>
 #include <libpurple/connection.h>
 #pragma GCC visibility pop
 
 #include <nsCOMPtr.h>
 #include <nsServiceManagerUtils.h>
--- a/purplexpcom/src/purpleCoreService.cpp
+++ b/purplexpcom/src/purpleCoreService.cpp
@@ -1,12 +1,13 @@
 /* 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 "purpleLogging.h"
 #include "purpleCoreService.h"
 #include "purpleAccountBuddy.h"
 #include "purpleDNS.h"
 #include "purpleGetText.h"
 #include "purpleNetwork.h"
 #include "purpleSockets.h"
 #include "purpleTimer.h"
 #include "imICommandsService.h"
--- a/purplexpcom/src/purpleDNS.cpp
+++ b/purplexpcom/src/purpleDNS.cpp
@@ -1,13 +1,14 @@
 /* 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 "purpleDNS.h"
+#include "purpleLogging.h"
 #include "purpleAccountScoper.h"
 #include "mozilla/net/DNS.h"
 #include <nsComponentManagerUtils.h>
 #include <nsServiceManagerUtils.h>
 #include <nsNetUtil.h>
 #include <nsIThread.h>
 #include <nsThreadUtils.h>
 #include <nsICancelable.h>
--- a/purplexpcom/src/purpleDebug.cpp
+++ b/purplexpcom/src/purpleDebug.cpp
@@ -1,13 +1,14 @@
 /* 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 "purpleDebug.h"
+#include "purpleLogging.h"
 #include "purpleAccountScoper.h"
 #include <imIAccountsService.h>
 #include <nsComponentManagerUtils.h>
 #include <nsDirectoryServiceUtils.h>
 #include <nsDirectoryServiceDefs.h>
 #include <nsINIParser.h>
 #include <nsServiceManagerUtils.h>
 #include <nsIConsoleService.h>
--- a/purplexpcom/src/purpleGetText.cpp
+++ b/purplexpcom/src/purpleGetText.cpp
@@ -1,13 +1,14 @@
 /* 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 "purpleGetText.h"
+#include "purpleLogging.h"
 #include <nsIChromeRegistry.h>
 #include <nsICryptoHash.h>
 #include <nsIObserverService.h>
 #include <nsIStringBundle.h>
 #include <nsServiceManagerUtils.h>
 #include <nsComponentManagerUtils.h>
 #include <nsNetCID.h>
 #include <nsNetUtil.h>
--- a/purplexpcom/src/purpleInit.cpp
+++ b/purplexpcom/src/purpleInit.cpp
@@ -3,16 +3,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #pragma GCC visibility push(default)
 #include <glib.h>
 #include <libpurple/core.h>
 #include <libpurple/gettext.h>
 #pragma GCC visibility pop
 
+#include "purpleLogging.h"
 #include "purpleAccount.h"
 #include "purpleAccountBuddy.h"
 #include "purpleCoreService.h"
 #include "purpleGetText.h"
 #include "purpleTimer.h"
 #include "purpleTooltipInfo.h"
 #include "purpleSockets.h"
 #include "purpleDebug.h"
--- a/purplexpcom/src/purpleInitAccounts.cpp
+++ b/purplexpcom/src/purpleInitAccounts.cpp
@@ -2,16 +2,17 @@
  * 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/. */
 
 #pragma GCC visibility push(default)
 #include <glib.h>
 #include <libpurple/core.h>
 #pragma GCC visibility pop
 
+#include "purpleLogging.h"
 #include "purpleAccount.h"
 #include "prplIRequest.h"
 #include <nsServiceManagerUtils.h>
 #include <nsCOMPtr.h>
 #include <nsIDOMWindow.h>
 #include <nsIObserverService.h>
 #include <nsIPromptService.h>
 #include <nsIStringBundle.h>
--- a/purplexpcom/src/purpleInitCommands.cpp
+++ b/purplexpcom/src/purpleInitCommands.cpp
@@ -1,15 +1,16 @@
 /* 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 "imICommandsService.h"
 #include "purpleConvIM.h"
 #include "purpleConvChat.h"
+#include "purpleLogging.h"
 
 #pragma GCC visibility push(default)
 #include <libpurple/cmds.h>
 #pragma GCC visibility pop
 
 #include <nsIClassInfo.h>
 #include <nsServiceManagerUtils.h>
 #include <nsStringAPI.h>
--- a/purplexpcom/src/purpleInitContacts.cpp
+++ b/purplexpcom/src/purpleInitContacts.cpp
@@ -1,16 +1,17 @@
 /* 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/. */
 
 #pragma GCC visibility push(default)
 #include <libpurple/blist.h>
 #pragma GCC visibility pop
 
+#include "purpleLogging.h"
 #include "purpleAccountBuddy.h"
 #include <imIContactsService.h>
 #include <nsServiceManagerUtils.h>
 #include <nsAutoPtr.h> // for nsRefPtr
 #include <nsCOMPtr.h>
 #include <nsStringAPI.h>
 
 //
--- a/purplexpcom/src/purpleInitConv.cpp
+++ b/purplexpcom/src/purpleInitConv.cpp
@@ -1,16 +1,17 @@
 /* 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/. */
 
 #pragma GCC visibility push(default)
 #include <libpurple/conversation.h>
 #pragma GCC visibility pop
 
+#include "purpleLogging.h"
 #include "purpleConversation.h"
 #include "purpleConvChat.h"
 #include "purpleConvIM.h"
 #include "purpleConvChatBuddy.h"
 #include "purpleMessage.h"
 #include "imIConversationsService.h"
 #include <nsIObserverService.h>
 #include <nsIPrefBranch2.h>
new file mode 100644
--- /dev/null
+++ b/purplexpcom/src/purpleLogging.h
@@ -0,0 +1,25 @@
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
+/* 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/. */
+
+// based on netwerk/test/NetwerkTestLogging.h
+
+#ifndef purpleLogging_h
+#define purpleLogging_h
+
+#include <mozilla/Logging.h>
+
+// purplexpcom will just use PR_LogPrint as it doesn't
+// have access to mozilla::detail::log_print. To support that MOZ_LOG is
+// redefined.
+#undef MOZ_LOG
+#define MOZ_LOG(_module,_level,_args) \
+  PR_BEGIN_MACRO \
+    if (MOZ_LOG_TEST(_module,_level)) { \
+      PR_LogPrint _args; \
+    } \
+  PR_END_MACRO
+
+#endif
--- a/purplexpcom/src/purpleMessage.cpp
+++ b/purplexpcom/src/purpleMessage.cpp
@@ -1,13 +1,14 @@
 /* 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 "purpleMessage.h"
+#include "purpleLogging.h"
 #include "purpleCoreService.h"
 #include "purpleConversation.h"
 #include "purpleConvIM.h"
 #include "imIContactsService.h"
 #include <nsCOMPtr.h>
 #include <nsServiceManagerUtils.h>
 #include <nsIClassInfoImpl.h>
 #include <nsMemory.h>
--- a/purplexpcom/src/purplePref.cpp
+++ b/purplexpcom/src/purplePref.cpp
@@ -1,12 +1,13 @@
 /* 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 "purpleLogging.h"
 #include "purplePref.h"
 #include "purpleGListEnumerator.h"
 #include <nsIClassInfoImpl.h>
 #include <nsIProgrammingLanguage.h>
 #include <nsMemory.h>
 #include <nsStringAPI.h>
 
 #pragma GCC visibility push(default)
--- a/purplexpcom/src/purpleProtocol.cpp
+++ b/purplexpcom/src/purpleProtocol.cpp
@@ -1,13 +1,14 @@
 /* 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 "purpleProtocol.h"
+#include "purpleLogging.h"
 #include "purpleAccount.h"
 #include "purpleCoreService.h"
 #include "purplePref.h"
 #include "purpleGListEnumerator.h"
 #include <nsIClassInfoImpl.h>
 #include <nsMemory.h>
 #include <nsCOMPtr.h>
 #include <nsComponentManagerUtils.h>
--- a/purplexpcom/src/purpleSockets.cpp
+++ b/purplexpcom/src/purpleSockets.cpp
@@ -1,13 +1,14 @@
 /* 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 "purpleSockets.h"
+#include "purpleLogging.h"
 #include "purpleAccountScoper.h"
 #include <private/pprio.h>
 #include <nsComponentManagerUtils.h>
 #include <nsServiceManagerUtils.h>
 #include <nsIEventTarget.h>
 #include <nsIObserver.h>
 #include <nsIObserverService.h>
 #include <nsThreadUtils.h>
--- a/purplexpcom/src/purpleTimer.cpp
+++ b/purplexpcom/src/purpleTimer.cpp
@@ -1,15 +1,15 @@
 /* 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 <mozilla/Logging.h>
+#include "purpleLogging.h"
 #include <nsComponentManagerUtils.h>
 #include <nsServiceManagerUtils.h>
 #include <nsIThreadManager.h>
 #include <nsIEventTarget.h>
 #include <nsThreadUtils.h>
 #include <nsXPCOMCIDInternal.h>
 
 //