Bug 1171663 - Change PR_LOG to MOZ_LOG in mailnews/, r=rkent
authorEdmund Wong <ewong@pw-wspx.org>
Fri, 05 Jun 2015 11:44:02 -0700
changeset 17819 4531fe7c34da0e572c59ed23db5f29ff4233faaa
parent 17818 a2ca69d3bcce00f253431b65850d12291f1e07f7
child 17820 724e8467d630c007ed9cc73513d4fb714bc07fa6
push id1443
push usermbanner@mozilla.com
push dateMon, 10 Aug 2015 18:31:17 +0000
treeherdercomm-esr52@90a7d0c47f7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrkent
bugs1171663
Bug 1171663 - Change PR_LOG to MOZ_LOG in mailnews/, r=rkent * * * Bug 1171663 - RKJ revs to merge
ldap/xpcom/src/nsLDAPConnection.cpp
ldap/xpcom/src/nsLDAPMessage.cpp
ldap/xpcom/src/nsLDAPOperation.cpp
ldap/xpcom/src/nsLDAPProtocolModule.cpp
ldap/xpcom/src/nsLDAPService.cpp
mailnews/addrbook/src/nsAbOutlookDirFactory.cpp
mailnews/addrbook/src/nsAbOutlookDirectory.cpp
mailnews/addrbook/src/nsAbWinHelper.cpp
mailnews/addrbook/src/nsMapiAddressBook.cpp
mailnews/addrbook/src/nsWabAddressBook.cpp
mailnews/base/src/nsMsgBiffManager.cpp
mailnews/base/src/nsMsgCopyService.cpp
mailnews/base/src/nsMsgPurgeService.cpp
mailnews/compose/src/nsMsgComposeService.cpp
mailnews/compose/src/nsSmtpProtocol.cpp
mailnews/db/msgdb/src/nsMailDatabase.cpp
mailnews/db/msgdb/src/nsMsgDatabase.cpp
mailnews/db/msgdb/src/nsMsgOfflineImapOperation.cpp
mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp
mailnews/imap/src/nsAutoSyncManager.cpp
mailnews/imap/src/nsAutoSyncState.cpp
mailnews/imap/src/nsIMAPBodyShell.cpp
mailnews/imap/src/nsImapMailFolder.cpp
mailnews/imap/src/nsImapProtocol.cpp
mailnews/imap/src/nsImapServerResponseParser.cpp
mailnews/import/applemail/src/nsAppleMailImport.h
mailnews/import/eudora/src/EudoraDebugLog.h
mailnews/import/oexpress/OEDebugLog.h
mailnews/import/outlook/src/OutlookDebugLog.h
mailnews/import/src/ImportDebug.h
mailnews/import/text/src/TextDebugLog.h
mailnews/import/vcard/src/nsVCardAddress.h
mailnews/import/winlivemail/WMDebugLog.h
mailnews/local/src/nsMailboxProtocol.cpp
mailnews/local/src/nsMovemailService.cpp
mailnews/local/src/nsMsgMaildirStore.cpp
mailnews/local/src/nsPop3Protocol.cpp
mailnews/local/src/nsPop3Sink.cpp
mailnews/mapi/mapihook/src/msgMapiHook.cpp
mailnews/mapi/mapihook/src/msgMapiImp.cpp
mailnews/mime/emitters/nsMimeBaseEmitter.cpp
mailnews/mime/src/nsCMS.cpp
mailnews/mime/src/nsCMSSecureMessage.cpp
mailnews/news/src/nsNNTPProtocol.cpp
--- a/ldap/xpcom/src/nsLDAPConnection.cpp
+++ b/ldap/xpcom/src/nsLDAPConnection.cpp
@@ -21,16 +21,17 @@
 #include "nsILDAPErrors.h"
 #include "nsIClassInfoImpl.h"
 #include "nsILDAPURL.h"
 #include "nsIObserverService.h"
 #include "mozilla/Services.h"
 #include "nsMemory.h"
 #include "nsLDAPUtils.h"
 #include "nsProxyRelease.h"
+#include "mozilla/Logging.h"
 
 using namespace mozilla;
 
 const char kConsoleServiceContractId[] = "@mozilla.org/consoleservice;1";
 const char kDNSServiceContractId[] = "@mozilla.org/network/dns-service;1";
 
 // constructor
 //
@@ -171,35 +172,35 @@ nsLDAPConnection::Init(nsILDAPURL *aUrl,
 }
 
 // this might get exposed to clients, so we've broken it
 // out of the destructor.
 void
 nsLDAPConnection::Close()
 {
   int rc;
-  PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, ("unbinding\n"));
+  MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug, ("unbinding\n"));
 
   if (mConnectionHandle) {
       // note that the ldap_unbind() call in the 5.0 version of the LDAP C SDK
       // appears to be exactly identical to ldap_unbind_s(), so it may in fact
       // still be synchronous
       //
       rc = ldap_unbind(mConnectionHandle);
 #ifdef PR_LOGGING
       if (rc != LDAP_SUCCESS) {
-          PR_LOG(gLDAPLogModule, PR_LOG_WARNING,
+          MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Warning,
                  ("nsLDAPConnection::Close(): %s\n",
                   ldap_err2string(rc)));
       }
 #endif
       mConnectionHandle = nullptr;
   }
 
-  PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, ("unbound\n"));
+  MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug, ("unbound\n"));
 
   NS_ASSERTION(!mThread || NS_SUCCEEDED(mThread->Shutdown()),
                "Failed to shutdown thread cleanly");
 
   // Cancel the DNS lookup if needed, and also drop the reference to the
   // Init listener (if still there).
   //
   if (mDNSRequest) {
@@ -328,17 +329,17 @@ nsLDAPConnection::AddPendingOperation(ui
 {
   NS_ENSURE_ARG_POINTER(aOperation);
 
   nsIRunnable* runnable = new nsLDAPConnectionRunnable(aOperationID, aOperation,
                                                        this);
   {
     MutexAutoLock lock(mPendingOperationsMutex);
     mPendingOperations.Put((uint32_t)aOperationID, aOperation);
-    PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("pending operation added; total pending operations now = %d\n",
             mPendingOperations.Count()));
   }
 
   nsresult rv;
   if (!mThread)
   {
     rv = NS_NewThread(getter_AddRefs(mThread), runnable);
@@ -364,23 +365,23 @@ nsLDAPConnection::AddPendingOperation(ui
  *
  * void removePendingOperation(in nsILDAPOperation aOperation);
  */
 nsresult
 nsLDAPConnection::RemovePendingOperation(uint32_t aOperationID)
 {
   NS_ENSURE_TRUE(aOperationID > 0, NS_ERROR_UNEXPECTED);
 
-  PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+  MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
          ("nsLDAPConnection::RemovePendingOperation(): operation removed\n"));
 
   {
     MutexAutoLock lock(mPendingOperationsMutex);
     mPendingOperations.Remove(aOperationID);
-    PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("nsLDAPConnection::RemovePendingOperation(): operation "
             "removed; total pending operations now = %d\n",
             mPendingOperations.Count()));
   }
 
   return NS_OK;
 }
 
@@ -423,17 +424,17 @@ NS_IMETHODIMP nsOnLDAPMessageRunnable::R
 nsresult
 nsLDAPConnection::InvokeMessageCallback(LDAPMessage *aMsgHandle,
                                         nsILDAPMessage *aMsg,
                                         int32_t aOperation,
                                         bool aRemoveOpFromConnQ)
 {
 #if defined(DEBUG)
   // We only want this being logged for debug builds so as not to affect performance too much.
-  PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, ("InvokeMessageCallback entered\n"));
+  MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug, ("InvokeMessageCallback entered\n"));
 #endif
 
   // Get the operation.
   nsCOMPtr<nsILDAPOperation> operation;
   {
     MutexAutoLock lock(mPendingOperationsMutex);
     mPendingOperations.Get((uint32_t)aOperation, getter_AddRefs(operation));
   }
@@ -451,17 +452,17 @@ nsLDAPConnection::InvokeMessageCallback(
 
   // if requested (ie the operation is done), remove the operation
   // from the connection queue.
   if (aRemoveOpFromConnQ)
   {
     MutexAutoLock lock(mPendingOperationsMutex);
     mPendingOperations.Remove(aOperation);
 
-    PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("pending operation removed; total pending operations now ="
             " %d\n", mPendingOperations.Count()));
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/ldap/xpcom/src/nsLDAPMessage.cpp
+++ b/ldap/xpcom/src/nsLDAPMessage.cpp
@@ -10,16 +10,17 @@
 #include "nsDebug.h"
 #include "nsMemory.h"
 #include "nsLDAPConnection.h"
 #include "nsISupportsUtils.h"
 #include "nsLDAPBERValue.h"
 #include "nsILDAPErrors.h"
 #include "nsIClassInfoImpl.h"
 #include "nsLDAPUtils.h"
+#include "mozilla/Logging.h"
 
 NS_IMPL_CLASSINFO(nsLDAPMessage, NULL, nsIClassInfo::THREADSAFE,
                   NS_LDAPMESSAGE_CID)
 
 NS_IMPL_ADDREF(nsLDAPMessage)
 NS_IMPL_RELEASE(nsLDAPMessage)
 NS_INTERFACE_MAP_BEGIN(nsLDAPMessage)
   NS_INTERFACE_MAP_ENTRY(nsILDAPMessage)
@@ -65,24 +66,24 @@ nsLDAPMessage::~nsLDAPMessage(void)
         case LDAP_RES_SEARCH_REFERENCE:
         case LDAP_RES_EXTENDED:
         case LDAP_RES_ANY:
             // success
             break;
 
         case LDAP_SUCCESS:
             // timed out (dunno why LDAP_SUCCESS is used to indicate this) 
-            PR_LOG(gLDAPLogModule, PR_LOG_WARNING, 
+            MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Warning, 
                    ("nsLDAPMessage::~nsLDAPMessage: ldap_msgfree() "
                     "timed out\n"));
             break;
 
         default:
             // other failure
-            PR_LOG(gLDAPLogModule, PR_LOG_WARNING, 
+            MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Warning, 
                    ("nsLDAPMessage::~nsLDAPMessage: ldap_msgfree() "
                     "failed: %s\n", ldap_err2string(rc)));
             break;
         }
     }
 
     if (mMatchedDn) {
         ldap_memfree(mMatchedDn);
@@ -431,17 +432,17 @@ NS_IMETHODIMP nsLDAPMessage::GetDn(nsACS
 
         case LDAP_PARAM_ERROR:
         default:
             NS_ERROR("nsLDAPMessage::GetDn(): internal error");
             return NS_ERROR_UNEXPECTED;
         }
     }
 
-    PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("nsLDAPMessage::GetDn(): dn = '%s'", rawDn));
 
     aDn.Assign(rawDn);
     ldap_memfree(rawDn);
 
     return NS_OK;
 }
 
@@ -450,32 +451,32 @@ NS_IMETHODIMP nsLDAPMessage::GetDn(nsACS
 NS_IMETHODIMP
 nsLDAPMessage::GetValues(const char *aAttr, uint32_t *aCount, 
                          char16_t ***aValues)
 {
     char **values;
     
 #if defined(DEBUG)
     // We only want this being logged for debug builds so as not to affect performance too much.
-    PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("nsLDAPMessage::GetValues(): called with aAttr = '%s'", aAttr));
 #endif
 
     values = ldap_get_values(mConnectionHandle, mMsgHandle, aAttr);
 
     // bail out if there was a problem
     //
     if (!values) {
         int32_t lderrno = ldap_get_lderrno(mConnectionHandle, 0, 0);
 
         if ( lderrno == LDAP_DECODING_ERROR ) {
             // this may not be an error; it could just be that the 
             // caller has asked for an attribute that doesn't exist.
             //
-            PR_LOG(gLDAPLogModule, PR_LOG_WARNING, 
+            MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Warning, 
                    ("nsLDAPMessage::GetValues(): ldap_get_values returned "
                     "LDAP_DECODING_ERROR"));
             return NS_ERROR_LDAP_DECODING_ERROR;
 
         } else if ( lderrno == LDAP_PARAM_ERROR ) {
             NS_ERROR("nsLDAPMessage::GetValues(): internal error: 1");
             return NS_ERROR_UNEXPECTED;
 
@@ -527,33 +528,33 @@ nsLDAPMessage::GetValues(const char *aAt
 NS_IMETHODIMP 
 nsLDAPMessage::GetBinaryValues(const char *aAttr, uint32_t *aCount,
                                nsILDAPBERValue ***aValues)
 {
     struct berval **values;
 
 #if defined(DEBUG)
     // We only want this being logged for debug builds so as not to affect performance too much.
-    PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("nsLDAPMessage::GetBinaryValues(): called with aAttr = '%s'", 
             aAttr));
 #endif
 
     values = ldap_get_values_len(mConnectionHandle, mMsgHandle, aAttr);
 
     // bail out if there was a problem
     //
     if (!values) {
         int32_t lderrno = ldap_get_lderrno(mConnectionHandle, 0, 0);
 
         if ( lderrno == LDAP_DECODING_ERROR ) {
             // this may not be an error; it could just be that the 
             // caller has asked for an attribute that doesn't exist.
             //
-            PR_LOG(gLDAPLogModule, PR_LOG_WARNING, 
+            MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Warning, 
                    ("nsLDAPMessage::GetBinaryValues(): ldap_get_values "
                     "returned LDAP_DECODING_ERROR"));
             return NS_ERROR_LDAP_DECODING_ERROR;
 
         } else if ( lderrno == LDAP_PARAM_ERROR ) {
             NS_ERROR("nsLDAPMessage::GetBinaryValues(): internal error: 1");
             return NS_ERROR_UNEXPECTED;
 
--- a/ldap/xpcom/src/nsLDAPOperation.cpp
+++ b/ldap/xpcom/src/nsLDAPOperation.cpp
@@ -13,16 +13,17 @@
 #include "nspr.h"
 #include "nsISimpleEnumerator.h"
 #include "nsLDAPControl.h"
 #include "nsILDAPErrors.h"
 #include "nsIClassInfoImpl.h"
 #include "nsIAuthModule.h"
 #include "nsArrayUtils.h"
 #include "nsMemory.h"
+#include "mozilla/Logging.h"
 
 // Helper function
 static nsresult TranslateLDAPErrorToNSError(const int ldapError)
 {
   switch (ldapError) {
   case LDAP_SUCCESS:
     return NS_OK;
 
@@ -43,17 +44,17 @@ static nsresult TranslateLDAPErrorToNSEr
 
   case LDAP_PARAM_ERROR:
     return NS_ERROR_INVALID_ARG;
 
   case LDAP_FILTER_ERROR:
     return NS_ERROR_LDAP_FILTER_ERROR;
 
   default:
-    PR_LOG(gLDAPLogModule, PR_LOG_ERROR,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Error,
            ("TranslateLDAPErrorToNSError: "
             "Do not know how to translate LDAP error: 0x%x", ldapError));
     return NS_ERROR_UNEXPECTED;
   }
 }
 
 
 // constructor
@@ -274,17 +275,17 @@ nsLDAPOperation::SimpleBind(const nsACSt
       mSavePassword = passwd;
 
     NS_PRECONDITION(mMessageListener != 0, "MessageListener not set");
 
     rv = connection->GetBindName(bindName);
     if (NS_FAILED(rv))
         return rv;
 
-    PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("nsLDAPOperation::SimpleBind(): called; bindName = '%s'; ",
             bindName.get()));
 
     // this (nsLDAPOperation) may be released by RemovePendingOperation()
     // See https://bugzilla.mozilla.org/show_bug.cgi?id=1063829.
     nsRefPtr<nsLDAPOperation> kungFuDeathGrip = this;
 
     // If this is a second try at binding, remove the operation from pending ops
@@ -407,40 +408,40 @@ nsLDAPOperation::SearchExt(const nsACStr
                            PRIntervalTime aTimeOut, int32_t aSizeLimit)
 {
     if (!mMessageListener) {
         NS_ERROR("nsLDAPOperation::SearchExt(): mMessageListener not set");
         return NS_ERROR_NOT_INITIALIZED;
     }
 
     // XXX add control logging
-    PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("nsLDAPOperation::SearchExt(): called with aBaseDn = '%s'; "
             "aFilter = '%s'; aAttributes = %s; aSizeLimit = %d",
             PromiseFlatCString(aBaseDn).get(),
             PromiseFlatCString(aFilter).get(),
             PromiseFlatCString(aAttributes).get(), aSizeLimit));
 
     LDAPControl **serverctls = 0;
     nsresult rv;
     if (mServerControls) {
         rv = convertControlArray(mServerControls, &serverctls);
         if (NS_FAILED(rv)) {
-            PR_LOG(gLDAPLogModule, PR_LOG_ERROR,
+            MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Error,
                    ("nsLDAPOperation::SearchExt(): error converting server "
                     "control array: %x", rv));
             return rv;
         }
     }
 
     LDAPControl **clientctls = 0;
     if (mClientControls) {
         rv = convertControlArray(mClientControls, &clientctls);
         if (NS_FAILED(rv)) {
-            PR_LOG(gLDAPLogModule, PR_LOG_ERROR,
+            MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Error,
                    ("nsLDAPOperation::SearchExt(): error converting client "
                     "control array: %x", rv));
             ldap_controls_free(serverctls);
             return rv;
         }
     }
 
     // Convert our comma separated string to one that the C-SDK will like, i.e.
@@ -676,31 +677,31 @@ nsLDAPOperation::AddExt(const char *base
  *
  * void addExt (in AUTF8String aBaseDn, in unsigned long aModCount,
  *              [array, size_is (aModCount)] in nsILDAPModification aMods);
  */
 NS_IMETHODIMP
 nsLDAPOperation::AddExt(const nsACString& aBaseDn,
                         nsIArray *aMods)
 {
-  PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+  MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
          ("nsLDAPOperation::AddExt(): called with aBaseDn = '%s'",
           PromiseFlatCString(aBaseDn).get()));
 
   nsresult rv = AddExt(PromiseFlatCString(aBaseDn).get(), aMods, 0, 0);
   if (NS_FAILED(rv))
     return rv;
 
   // make sure the connection knows where to call back once the messages
   // for this operation start coming in
   rv = mConnection->AddPendingOperation(mMsgID, this);
 
   if (NS_FAILED(rv)) {
     (void)ldap_abandon_ext(mConnectionHandle, mMsgID, 0, 0);
-    PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("nsLDAPOperation::AddExt(): abandoned due to rv %x",
             rv));
   }
   return rv;
 }
 
 // wrappers for ldap_delete_ext
 //
@@ -726,31 +727,31 @@ nsLDAPOperation::DeleteExt(const char *b
  *
  * XXX doesn't currently handle LDAPControl params
  *
  * void deleteExt(in AUTF8String aBaseDn);
  */
 NS_IMETHODIMP
 nsLDAPOperation::DeleteExt(const nsACString& aBaseDn)
 {
-  PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+  MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
          ("nsLDAPOperation::DeleteExt(): called with aBaseDn = '%s'",
           PromiseFlatCString(aBaseDn).get()));
 
   nsresult rv = DeleteExt(PromiseFlatCString(aBaseDn).get(), 0, 0);
   if (NS_FAILED(rv))
     return rv;
 
   // make sure the connection knows where to call back once the messages
   // for this operation start coming in
   rv = mConnection->AddPendingOperation(mMsgID, this);
 
   if (NS_FAILED(rv)) {
     (void)ldap_abandon_ext(mConnectionHandle, mMsgID, 0, 0);
-    PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("nsLDAPOperation::AddExt(): abandoned due to rv %x",
             rv));
   }
   return rv;
 }
 
 // wrappers for ldap_modify_ext
 //
@@ -838,32 +839,32 @@ nsLDAPOperation::ModifyExt(const char *b
  *
  * void modifyExt (in AUTF8String aBaseDn, in unsigned long aModCount,
  *                 [array, size_is (aModCount)] in nsILDAPModification aMods);
  */
 NS_IMETHODIMP
 nsLDAPOperation::ModifyExt(const nsACString& aBaseDn,
                            nsIArray *aMods)
 {
-  PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+  MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
          ("nsLDAPOperation::ModifyExt(): called with aBaseDn = '%s'",
           PromiseFlatCString(aBaseDn).get()));
 
   nsresult rv = ModifyExt(PromiseFlatCString(aBaseDn).get(),
                           aMods, 0, 0);
   if (NS_FAILED(rv))
     return rv;
 
   // make sure the connection knows where to call back once the messages
   // for this operation start coming in
   rv = mConnection->AddPendingOperation(mMsgID, this);
 
   if (NS_FAILED(rv)) {
     (void)ldap_abandon_ext(mConnectionHandle, mMsgID, 0, 0);
-    PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("nsLDAPOperation::AddExt(): abandoned due to rv %x",
             rv));
   }
   return rv;
 }
 
 // wrappers for ldap_rename
 //
@@ -899,34 +900,34 @@ nsLDAPOperation::Rename(const char *base
  *             in AUTF8String aNewParent, in boolean aDeleteOldRDn);
  */
 NS_IMETHODIMP
 nsLDAPOperation::Rename(const nsACString& aBaseDn,
                         const nsACString& aNewRDn,
                         const nsACString& aNewParent,
                         bool aDeleteOldRDn)
 {
-  PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+  MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
          ("nsLDAPOperation::Rename(): called with aBaseDn = '%s'",
           PromiseFlatCString(aBaseDn).get()));
 
   nsresult rv = Rename(PromiseFlatCString(aBaseDn).get(),
                        PromiseFlatCString(aNewRDn).get(),
                        PromiseFlatCString(aNewParent).get(),
                        aDeleteOldRDn, 0, 0);
   if (NS_FAILED(rv))
     return rv;
 
   // make sure the connection knows where to call back once the messages
   // for this operation start coming in
   rv = mConnection->AddPendingOperation(mMsgID, this);
 
   if (NS_FAILED(rv)) {
     (void)ldap_abandon_ext(mConnectionHandle, mMsgID, 0, 0);
-    PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug,
            ("nsLDAPOperation::AddExt(): abandoned due to rv %x",
             rv));
   }
   return rv;
 }
 
 // wrappers for ldap_search_ext
 //
--- a/ldap/xpcom/src/nsLDAPProtocolModule.cpp
+++ b/ldap/xpcom/src/nsLDAPProtocolModule.cpp
@@ -17,16 +17,17 @@
 #include "nsLDAPService.h"
 #include "nsLDAPBERValue.h"
 #include "nsLDAPBERElement.h"
 #include "nsLDAPControl.h"
 #ifdef MOZ_PREF_EXTENSIONS
 #include "nsLDAPSyncQuery.h"
 #endif
 #include "ldappr.h"
+#include "mozilla/Logging.h"
 
 // use the default constructor
 //
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPConnection)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPOperation)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPMessage)
 NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsLDAPModification, Init)
 NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPServer)
@@ -103,29 +104,29 @@ nsLDAPInitialize()
     }
 #endif
 
     // use NSPR under the hood for all networking
     //
     int rv = prldap_install_routines( NULL, 1 /* shared */ );
 
     if (rv != LDAP_SUCCESS) {
-        PR_LOG(gLDAPLogModule, PR_LOG_ERROR,
+        MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Error,
                ("nsLDAPInitialize(): pr_ldap_install_routines() failed: %s\n",
                ldap_err2string(rv)));
         return NS_ERROR_FAILURE;
     }
 
     // Never block for more than 10000 milliseconds (ie 10 seconds) doing any 
     // sort of I/O operation.
     //
     rv = prldap_set_session_option(0, 0, PRLDAP_OPT_IO_MAX_TIMEOUT, 
                                    10000);
     if (rv != LDAP_SUCCESS) {
-        PR_LOG(gLDAPLogModule, PR_LOG_ERROR,
+        MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Error,
                ("nsLDAPInitialize(): error setting PRLDAP_OPT_IO_MAX_TIMEOUT:"
                 " %s\n", ldap_err2string(rv)));
         return NS_ERROR_FAILURE;
     }
 
     return NS_OK;
 }
 
--- a/ldap/xpcom/src/nsLDAPService.cpp
+++ b/ldap/xpcom/src/nsLDAPService.cpp
@@ -10,16 +10,17 @@
 #include "nsLDAPOperation.h"
 #include "nsIServiceManager.h"
 #include "nsIConsoleService.h"
 #include "nsILDAPURL.h"
 #include "nsMemory.h"
 #include "nsILDAPErrors.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
+#include "mozilla/Logging.h"
 
 using namespace mozilla;
 
 // Constants for CIDs used here.
 //
 static NS_DEFINE_CID(kLDAPConnectionCID, NS_LDAPCONNECTION_CID);
 static NS_DEFINE_CID(kLDAPOperationCID, NS_LDAPOPERATION_CID);
 
@@ -793,17 +794,17 @@ NS_IMETHODIMP nsLDAPService::CreateFilte
                    const_cast<char *>(PromiseFlatCString(aValue).get()),
                    valueWords);
     switch (result) {
     case LDAP_SUCCESS:
         rv = NS_OK;
         break;
 
     case LDAP_SIZELIMIT_EXCEEDED:
-        PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, 
+        MOZ_LOG(gLDAPLogModule, mozilla::LogLevel::Debug, 
                    ("nsLDAPService::CreateFilter(): "
                     "filter longer than max size of %d generated", 
                     aMaxSize));
         rv = NS_ERROR_NOT_AVAILABLE;
         break;
 
     case LDAP_PARAM_ERROR:
         rv = NS_ERROR_INVALID_ARG;
--- a/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp
+++ b/mailnews/addrbook/src/nsAbOutlookDirFactory.cpp
@@ -7,25 +7,24 @@
 #include "nsIAbDirectory.h"
 #include "nsIAbManager.h"
 #include "nsEnumeratorUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsIMutableArray.h"
 #include "nsArrayEnumerator.h"
 #include "nsAbBaseCID.h"
-
-#include "prlog.h"
+#include "mozilla/Logging.h"
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gAbOutlookDirFactoryLog
     = PR_NewLogModule("nsAbOutlookDirFactoryLog");
 #endif
 
-#define PRINTF(args) PR_LOG(nsAbOutlookDirFactoryLog, PR_LOG_DEBUG, args)
+#define PRINTF(args) MOZ_LOG(nsAbOutlookDirFactoryLog, mozilla::LogLevel::Debug, args)
 
 
 NS_IMPL_ISUPPORTS(nsAbOutlookDirFactory, nsIAbDirFactory)
 
 nsAbOutlookDirFactory::nsAbOutlookDirFactory(void)
 {
 }
 
--- a/mailnews/addrbook/src/nsAbOutlookDirectory.cpp
+++ b/mailnews/addrbook/src/nsAbOutlookDirectory.cpp
@@ -12,31 +12,31 @@
 #include "nsIAbBooleanExpression.h"
 #include "nsIAbManager.h"
 #include "nsIAbMDBDirectory.h"
 #include "nsAbQueryStringToExpression.h"
 #include "nsAbUtils.h"
 #include "nsEnumeratorUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "prthread.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsCRTGlue.h"
 #include "nsArrayUtils.h"
 #include "nsArrayEnumerator.h"
 #include "nsMsgUtils.h"
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gAbOutlookDirectoryLog
     = PR_NewLogModule("nsAbOutlookDirectoryLog");
 #endif
 
-#define PRINTF(args) PR_LOG(gAbOutlookDirectoryLog, PR_LOG_DEBUG, args)
+#define PRINTF(args) MOZ_LOG(gAbOutlookDirectoryLog, mozilla::LogLevel::Debug, args)
 
 nsAbOutlookDirectory::nsAbOutlookDirectory(void)
   : nsAbDirProperty(),
   mCurrentQueryId(0), mSearchContext(-1),
   mAbWinType(nsAbWinType_Unknown), mMapiData(nullptr)
 {
     mMapiData = new nsMapiEntry ;
     mProtector = PR_NewLock() ;
--- a/mailnews/addrbook/src/nsAbWinHelper.cpp
+++ b/mailnews/addrbook/src/nsAbWinHelper.cpp
@@ -10,24 +10,24 @@
 #define USES_IID_IDistList
 
 #include "nsAbWinHelper.h"
 #include "nsMapiAddressBook.h"
 #include "nsWabAddressBook.h"
 
 #include <mapiguid.h>
 
-#include "prlog.h"
+#include "mozilla/Logging.h"
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gAbWinHelperLog
     = PR_NewLogModule("nsAbWinHelperLog");
 #endif
 
-#define PRINTF(args) PR_LOG(gAbWinHelperLog, PR_LOG_DEBUG, args)
+#define PRINTF(args) MOZ_LOG(gAbWinHelperLog, mozilla::LogLevel::Debug, args)
 
 // Small utility to ensure release of all MAPI interfaces
 template <class tInterface> struct nsMapiInterfaceWrapper
 {
     tInterface mInterface ;
 
     nsMapiInterfaceWrapper(void) : mInterface(NULL) {}
     ~nsMapiInterfaceWrapper(void) {
--- a/mailnews/addrbook/src/nsMapiAddressBook.cpp
+++ b/mailnews/addrbook/src/nsMapiAddressBook.cpp
@@ -1,22 +1,22 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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 "nsMapiAddressBook.h"
 
-#include "prlog.h"
+#include "mozilla/Logging.h"
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gMapiAddressBookLog
     = PR_NewLogModule("nsMapiAddressBookLog");
 #endif
 
-#define PRINTF(args) PR_LOG(gMapiAddressBookLog, PR_LOG_DEBUG, args)
+#define PRINTF(args) MOZ_LOG(gMapiAddressBookLog, mozilla::LogLevel::Debug, args)
 
 using namespace mozilla;
 
 HMODULE nsMapiAddressBook::mLibrary = NULL ;
 int32_t nsMapiAddressBook::mLibUsage = 0 ;
 LPMAPIINITIALIZE nsMapiAddressBook::mMAPIInitialize = NULL ;
 LPMAPIUNINITIALIZE nsMapiAddressBook::mMAPIUninitialize = NULL ;
 LPMAPIALLOCATEBUFFER nsMapiAddressBook::mMAPIAllocateBuffer = NULL ;
--- a/mailnews/addrbook/src/nsWabAddressBook.cpp
+++ b/mailnews/addrbook/src/nsWabAddressBook.cpp
@@ -1,24 +1,24 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* 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 <tchar.h>
 #include "nsWabAddressBook.h"
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include <algorithm>
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* gWabAddressBookLog
     = PR_NewLogModule("nsWabAddressBookLog");
 #endif
 
-#define PRINTF(args) PR_LOG(gWabAddressBookLog, PR_LOG_DEBUG, args)
+#define PRINTF(args) MOZ_LOG(gWabAddressBookLog, mozilla::LogLevel::Debug, args)
 
 using namespace mozilla;
 
 HMODULE nsWabAddressBook::mLibrary = NULL ;
 int32_t nsWabAddressBook::mLibUsage = 0 ;
 LPWABOPEN nsWabAddressBook::mWABOpen = NULL ;
 LPWABOBJECT nsWabAddressBook::mRootSession = NULL ;
 LPADRBOOK nsWabAddressBook::mRootBook = NULL ;
--- a/mailnews/base/src/nsMsgBiffManager.cpp
+++ b/mailnews/base/src/nsMsgBiffManager.cpp
@@ -3,17 +3,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/. */
 
 #include "nsMsgBiffManager.h"
 #include "nsIMsgAccountManager.h"
 #include "nsMsgBaseCID.h"
 #include "nsStatusBarBiffManager.h"
 #include "nsCOMArray.h"
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "nspr.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIObserverService.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsMsgUtils.h"
 #include "mozilla/Services.h"
@@ -221,17 +221,17 @@ nsresult nsMsgBiffManager::AddBiffEntry(
 {
   uint32_t i;
   uint32_t count = mBiffArray.Length();
   for (i = 0; i < count; i++)
   {
     if (biffEntry.nextBiffTime < mBiffArray[i].nextBiffTime)
       break;
   }
-  PR_LOG(MsgBiffLogModule, PR_LOG_ALWAYS, ("inserting biff entry at %d\n", i));
+  MOZ_LOG(MsgBiffLogModule, mozilla::LogLevel::Info, ("inserting biff entry at %d\n", i));
   mBiffArray.InsertElementAt(i, biffEntry);
   return NS_OK;
 }
 
 nsresult nsMsgBiffManager::SetNextBiffTime(nsBiffEntry &biffEntry, PRTime currentTime)
 {
   nsIMsgIncomingServer *server = biffEntry.server;
   NS_ENSURE_TRUE(server, NS_ERROR_FAILURE);
@@ -289,31 +289,31 @@ nsresult nsMsgBiffManager::SetupNextBiff
     int64_t timeInMS = biffDelay / ms;
     uint32_t timeInMSUint32 = (uint32_t)timeInMS;
 
     // Can't currently reset a timer when it's in the process of
     // calling Notify. So, just release the timer here and create a new one.
     if (mBiffTimer)
       mBiffTimer->Cancel();
 
-    PR_LOG(MsgBiffLogModule, PR_LOG_ALWAYS, ("setting %d timer\n", timeInMSUint32));
+    MOZ_LOG(MsgBiffLogModule, mozilla::LogLevel::Info, ("setting %d timer\n", timeInMSUint32));
     mBiffTimer = do_CreateInstance("@mozilla.org/timer;1");
     mBiffTimer->InitWithFuncCallback(OnBiffTimer, (void*)this, timeInMSUint32, 
                                      nsITimer::TYPE_ONE_SHOT);
 
   }
   return NS_OK;
 }
 
 //This is the function that does a biff on all of the servers whose time it is to biff.
 nsresult nsMsgBiffManager::PerformBiff()
 {
   PRTime currentTime = PR_Now();
   nsCOMArray<nsIMsgFolder> targetFolders;
-  PR_LOG(MsgBiffLogModule, PR_LOG_ALWAYS, ("performing biffs\n"));
+  MOZ_LOG(MsgBiffLogModule, mozilla::LogLevel::Info, ("performing biffs\n"));
 
   uint32_t count = mBiffArray.Length();
   for (uint32_t i = 0; i < count; i++)
   {
     // Take a copy of the entry rather than the a reference so that we can
     // remove and add if necessary, but keep the references and memory alive.
     nsBiffEntry current = mBiffArray[i];
     if (current.nextBiffTime < currentTime)
@@ -338,21 +338,21 @@ nsresult nsMsgBiffManager::PerformBiff()
       // new messages
       if (!serverBusy &&
           (!serverRequiresPassword || !passwordPromptRequired) &&
           targetFolderIndex == kNotFound)
       {
         nsCString serverKey;
         current.server->GetKey(serverKey);
         nsresult rv = current.server->PerformBiff(nullptr);
-        PR_LOG(MsgBiffLogModule, PR_LOG_ALWAYS, ("biffing server %s rv = %x\n", serverKey.get(), rv));
+        MOZ_LOG(MsgBiffLogModule, mozilla::LogLevel::Info, ("biffing server %s rv = %x\n", serverKey.get(), rv));
       }
       else
       {
-        PR_LOG(MsgBiffLogModule, PR_LOG_ALWAYS, ("not biffing server serverBusy = %d requirespassword = %d password prompt required = %d targetFolderIndex = %d\n",
+        MOZ_LOG(MsgBiffLogModule, mozilla::LogLevel::Info, ("not biffing server serverBusy = %d requirespassword = %d password prompt required = %d targetFolderIndex = %d\n",
           serverBusy, serverRequiresPassword, passwordPromptRequired, targetFolderIndex));
       }
       // if we didn't do this server because the destination server was already being
       // biffed into, leave this server in the biff array so it will fire next.
       if (targetFolderIndex == kNotFound)
       {
         mBiffArray.RemoveElementAt(i);
         i--; //Because we removed it we need to look at the one that just moved up.
--- a/mailnews/base/src/nsMsgCopyService.cpp
+++ b/mailnews/base/src/nsMsgCopyService.cpp
@@ -9,16 +9,17 @@
 #include "nsIFile.h"
 #include "nsIMsgFolderNotificationService.h"
 #include "nsMsgBaseCID.h"
 #include "nsIMutableArray.h"
 #include "nsArrayUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsMsgUtils.h"
+#include "mozilla/Logging.h"
 
 static PRLogModuleInfo *gCopyServiceLog;
 
 // ******************** nsCopySource ******************
 //
 
 nsCopySource::nsCopySource() : m_processed(false)
 {
@@ -138,45 +139,45 @@ nsMsgCopyService::~nsMsgCopyService()
 
 void nsMsgCopyService::LogCopyCompletion(nsISupports *aSrc, nsIMsgFolder *aDest)
 {
   nsCString srcFolderUri, destFolderUri;
   nsCOMPtr<nsIMsgFolder> srcFolder(do_QueryInterface(aSrc));
   if (srcFolder)
     srcFolder->GetURI(srcFolderUri);
   aDest->GetURI(destFolderUri);
-  PR_LOG(gCopyServiceLog, PR_LOG_ALWAYS,
+  MOZ_LOG(gCopyServiceLog, mozilla::LogLevel::Info,
          ("NotifyCompletion - src %s dest %s\n",
           srcFolderUri.get(), destFolderUri.get()));
 }
 
 void nsMsgCopyService::LogCopyRequest(const char *logMsg, nsCopyRequest* aRequest)
 {
   nsCString srcFolderUri, destFolderUri;
   nsCOMPtr<nsIMsgFolder> srcFolder(do_QueryInterface(aRequest->m_srcSupport));
   if (srcFolder)
     srcFolder->GetURI(srcFolderUri);
   aRequest->m_dstFolder->GetURI(destFolderUri);
   uint32_t numMsgs = 0;
   if (aRequest->m_requestType == nsCopyMessagesType &&
       aRequest->m_copySourceArray.Length() > 0 &&
       aRequest->m_copySourceArray[0]->m_messageArray)
     aRequest->m_copySourceArray[0]->m_messageArray->GetLength(&numMsgs);
-  PR_LOG(gCopyServiceLog, PR_LOG_ALWAYS,
+  MOZ_LOG(gCopyServiceLog, mozilla::LogLevel::Info,
          ("request %lx %s - src %s dest %s numItems %d type=%d",
          aRequest, logMsg, srcFolderUri.get(),
          destFolderUri.get(), numMsgs, aRequest->m_requestType));
 }
 
 nsresult
 nsMsgCopyService::ClearRequest(nsCopyRequest* aRequest, nsresult rv)
 {
   if (aRequest)
   {
-    if (PR_LOG_TEST(gCopyServiceLog, PR_LOG_ALWAYS))
+    if (MOZ_LOG_TEST(gCopyServiceLog, mozilla::LogLevel::Info))
       LogCopyRequest(NS_SUCCEEDED(rv) ? "Clearing OK request" 
                                       : "Clearing failed request", aRequest);
 
     // Send notifications to nsIMsgFolderListeners
     if (NS_SUCCEEDED(rv) && aRequest->m_requestType == nsCopyFoldersType)
     {
       nsCOMPtr<nsIMsgFolderNotificationService> notifier(do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID));
       if (notifier)
@@ -247,17 +248,17 @@ nsMsgCopyService::QueueRequest(nsCopyReq
 
 nsresult
 nsMsgCopyService::DoCopy(nsCopyRequest* aRequest)
 {
   NS_ENSURE_ARG(aRequest);
   bool copyImmediately;
   QueueRequest(aRequest, &copyImmediately);
   m_copyRequests.AppendElement(aRequest);
-  if (PR_LOG_TEST(gCopyServiceLog, PR_LOG_ALWAYS))
+  if (MOZ_LOG_TEST(gCopyServiceLog, mozilla::LogLevel::Info))
     LogCopyRequest(copyImmediately ? "DoCopy" : "QueueRequest", aRequest);
 
   // if no active request for this dest folder then we can copy immediately
   if (copyImmediately)
     return DoNextCopy();
 
   return NS_OK;
 }
@@ -434,17 +435,17 @@ nsMsgCopyService::CopyMessages(nsIMsgFol
                                nsIMsgCopyServiceListener* listener,
                                nsIMsgWindow* window,
                                bool allowUndo)
 {
   NS_ENSURE_ARG_POINTER(srcFolder);
   NS_ENSURE_ARG_POINTER(messages);
   NS_ENSURE_ARG_POINTER(dstFolder);
 
-  PR_LOG(gCopyServiceLog, PR_LOG_DEBUG, ("CopyMessages"));
+  MOZ_LOG(gCopyServiceLog, mozilla::LogLevel::Debug, ("CopyMessages"));
 
   if (srcFolder == dstFolder)
   {
     NS_ERROR("src and dest folders for msg copy can't be the same");
     return NS_ERROR_FAILURE;
   }
   nsCopyRequest* copyRequest;
   nsCopySource* copySource = nullptr;
@@ -479,17 +480,17 @@ nsMsgCopyService::CopyMessages(nsIMsgFol
   aSupport = do_QueryInterface(srcFolder, &rv);
 
   rv = copyRequest->Init(nsCopyMessagesType, aSupport, dstFolder, isMove,
                         0 /* new msg flags, not used */, EmptyCString(), 
                         listener, window, allowUndo);
   if (NS_FAILED(rv))
     goto done;
 
-  if (PR_LOG_TEST(gCopyServiceLog, PR_LOG_ALWAYS))
+  if (MOZ_LOG_TEST(gCopyServiceLog, mozilla::LogLevel::Info))
     LogCopyRequest("CopyMessages request", copyRequest);
 
   // duplicate the message array so we could sort the messages by it's
   // folder easily
   for (uint32_t i = 0; i < cnt; i++)
   {
     nsCOMPtr<nsIMsgDBHdr> currMsg = do_QueryElementAt(messages, i);
     msgArray.AppendObject(currMsg);
@@ -648,17 +649,17 @@ done:
     return rv;
 }
 
 NS_IMETHODIMP
 nsMsgCopyService::NotifyCompletion(nsISupports* aSupport,
                                    nsIMsgFolder* dstFolder,
                                    nsresult result)
 {
-  if (PR_LOG_TEST(gCopyServiceLog, PR_LOG_ALWAYS))
+  if (MOZ_LOG_TEST(gCopyServiceLog, mozilla::LogLevel::Info))
     LogCopyCompletion(aSupport, dstFolder);
   nsCopyRequest* copyRequest = nullptr;
   uint32_t numOrigRequests = m_copyRequests.Length();
   do
   {
     // loop for copy requests, because if we do a cross server folder copy,
     // we'll have a copy request for the folder copy, which will in turn
     // generate a copy request for the messages in the folder, which
--- a/mailnews/base/src/nsMsgPurgeService.cpp
+++ b/mailnews/base/src/nsMsgPurgeService.cpp
@@ -11,17 +11,17 @@
 #include "msgCore.h"
 #include "nsISpamSettings.h"
 #include "nsIMsgSearchTerm.h"
 #include "nsIMsgHdr.h"
 #include "nsIMsgProtocolInfo.h"
 #include "nsIMsgFilterPlugin.h"
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "nsMsgFolderFlags.h"
 #include <stdlib.h>
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsArrayUtils.h"
 
 static PRLogModuleInfo *MsgPurgeLogModule = nullptr;
 
@@ -66,18 +66,18 @@ NS_IMETHODIMP nsMsgPurgeService::Init()
       mMinDelayBetweenPurges = min_delay;
 
     int32_t purge_timer_interval;
     rv = prefBranch->GetIntPref("mail.purge.timer_interval", &purge_timer_interval);
     if (NS_SUCCEEDED(rv) &&  purge_timer_interval)
       mPurgeTimerInterval = purge_timer_interval;
   }
 
-  PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("mail.purge.min_delay=%d minutes",mMinDelayBetweenPurges));
-  PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("mail.purge.timer_interval=%d minutes",mPurgeTimerInterval));
+  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("mail.purge.min_delay=%d minutes",mMinDelayBetweenPurges));
+  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("mail.purge.timer_interval=%d minutes",mPurgeTimerInterval));
 
   // don't start purging right away.
   // because the accounts aren't loaded and because the user might be trying to sign in
   // or startup, etc.
   SetupNextPurge();
 
   mHaveShutdown = false;
   return NS_OK;
@@ -92,17 +92,17 @@ NS_IMETHODIMP nsMsgPurgeService::Shutdow
   }
 
   mHaveShutdown = true;
   return NS_OK;
 }
 
 nsresult nsMsgPurgeService::SetupNextPurge()
 {
-  PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("setting to check again in %d minutes",mPurgeTimerInterval));
+  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("setting to check again in %d minutes",mPurgeTimerInterval));
 
   // Convert mPurgeTimerInterval into milliseconds
   uint32_t timeInMSUint32 = mPurgeTimerInterval * 60000;
 
   // Can't currently reset a timer when it's in the process of
   // calling Notify. So, just release the timer here and create a new one.
   if(mPurgeTimer)
     mPurgeTimer->Cancel();
@@ -120,31 +120,31 @@ nsresult nsMsgPurgeService::SetupNextPur
 // However, if we've spent more than .5 seconds in this loop, don't
 // apply any more retention settings because it might lock up the UI.
 // This might starve folders later on in the hierarchy, since we always
 // start at the top, but since we also apply retention settings when you
 // open a folder, or when you compact all folders, I think this will do
 // for now, until we have a cleanup on shutdown architecture.
 nsresult nsMsgPurgeService::PerformPurge()
 {
-  PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("performing purge"));
+  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("performing purge"));
 
   nsresult rv;
 
   nsCOMPtr <nsIMsgAccountManager> accountManager = do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
   bool keepApplyingRetentionSettings = true;
 
   nsCOMPtr<nsIArray> allServers;
   rv = accountManager->GetAllServers(getter_AddRefs(allServers));
   if (NS_SUCCEEDED(rv) && allServers)
   {
     uint32_t numServers;
     rv = allServers->GetLength(&numServers);
-    PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("%d servers", numServers));
+    MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("%d servers", numServers));
     nsCOMPtr<nsIMsgFolder> folderToPurge;
     PRIntervalTime startTime = PR_IntervalNow();
     int32_t purgeIntervalToUse;
     PRTime oldestPurgeTime = 0; // we're going to pick the least-recently purged folder
 
     // apply retention settings to folders that haven't had retention settings
     // applied in mMinDelayBetweenPurges minutes (default 8 hours)
     // Because we get last purge time from the folder cache,
@@ -192,27 +192,27 @@ nsresult nsMsgPurgeService::PerformPurge
               if (!curFolderLastPurgeTimeString.IsEmpty())
               {
                 PRTime theTime;
                 PR_ParseTimeString(curFolderLastPurgeTimeString.get(), false, &theTime);
                 curFolderLastPurgeTime = theTime;
               }
 
               childFolder->GetURI(curFolderUri);
-              PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("%s curFolderLastPurgeTime=%s (if blank, then never)", curFolderUri.get(), curFolderLastPurgeTimeString.get()));
+              MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("%s curFolderLastPurgeTime=%s (if blank, then never)", curFolderUri.get(), curFolderLastPurgeTimeString.get()));
 
               // check if this folder is due to purge
               // has to have been purged at least mMinDelayBetweenPurges minutes ago
               // we don't want to purge the folders all the time - once a day is good enough
               int64_t minDelayBetweenPurges(mMinDelayBetweenPurges);
               int64_t microSecondsPerMinute(60000000);
               PRTime nextPurgeTime = curFolderLastPurgeTime + (minDelayBetweenPurges * microSecondsPerMinute);
               if (nextPurgeTime < PR_Now())
               {
-                PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("purging %s", curFolderUri.get()));
+                MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("purging %s", curFolderUri.get()));
                 childFolder->ApplyRetentionSettings();
               }
               PRIntervalTime elapsedTime = PR_IntervalNow() - startTime;
               // check if more than 500 milliseconds have elapsed in this purge process
               if (PR_IntervalToMilliseconds(elapsedTime) > 500)
               {
                 keepApplyingRetentionSettings = false;
                 break;
@@ -221,122 +221,122 @@ nsresult nsMsgPurgeService::PerformPurge
           }
         }
         nsCString type;
         nsresult rv = server->GetType(type);
         NS_ENSURE_SUCCESS(rv, rv);
 
         nsCString realHostName;
         server->GetRealHostName(realHostName);
-        PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] %s (%s)", serverIndex, realHostName.get(), type.get()));
+        MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] %s (%s)", serverIndex, realHostName.get(), type.get()));
 
         nsCOMPtr <nsISpamSettings> spamSettings;
         rv = server->GetSpamSettings(getter_AddRefs(spamSettings));
         NS_ENSURE_SUCCESS(rv, rv);
 
         int32_t spamLevel;
         spamSettings->GetLevel(&spamLevel);
-        PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] spamLevel=%d (if 0, don't purge)", serverIndex, spamLevel));
+        MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] spamLevel=%d (if 0, don't purge)", serverIndex, spamLevel));
         if (!spamLevel)
           continue;
 
         // check if we are set up to purge for this server
         // if not, skip it.
         bool purgeSpam;
         spamSettings->GetPurge(&purgeSpam);
 
-        PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] purgeSpam=%s (if false, don't purge)", serverIndex, purgeSpam ? "true" : "false"));
+        MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] purgeSpam=%s (if false, don't purge)", serverIndex, purgeSpam ? "true" : "false"));
         if (!purgeSpam)
           continue;
 
         // check if the spam folder uri is set for this server
         // if not skip it.
         nsCString junkFolderURI;
         rv = spamSettings->GetSpamFolderURI(getter_Copies(junkFolderURI));
         NS_ENSURE_SUCCESS(rv,rv);
 
-        PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] junkFolderURI=%s (if empty, don't purge)", serverIndex, junkFolderURI.get()));
+        MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] junkFolderURI=%s (if empty, don't purge)", serverIndex, junkFolderURI.get()));
         if (junkFolderURI.IsEmpty())
           continue;
 
         // if the junk folder doesn't exist
         // because the folder pane isn't built yet, for example
         // skip this account
         nsCOMPtr<nsIMsgFolder> junkFolder;
         GetExistingFolder(junkFolderURI, getter_AddRefs(junkFolder));
 
-        PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] %s exists? %s (if doesn't exist, don't purge)", serverIndex, junkFolderURI.get(), junkFolder ? "true" : "false"));
+        MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] %s exists? %s (if doesn't exist, don't purge)", serverIndex, junkFolderURI.get(), junkFolder ? "true" : "false"));
         if (!junkFolder)
           continue;
 
         PRTime curJunkFolderLastPurgeTime = 0;
         nsCString curJunkFolderLastPurgeTimeString;
         rv = junkFolder->GetStringProperty("curJunkFolderLastPurgeTime", curJunkFolderLastPurgeTimeString);
         if (NS_FAILED(rv))
           continue; // it is ok to fail, junk folder may not exist
 
         if (!curJunkFolderLastPurgeTimeString.IsEmpty())
         {
           PRTime theTime;
           PR_ParseTimeString(curJunkFolderLastPurgeTimeString.get(), false, &theTime);
           curJunkFolderLastPurgeTime = theTime;
         }
 
-        PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] %s curJunkFolderLastPurgeTime=%s (if blank, then never)", serverIndex, junkFolderURI.get(), curJunkFolderLastPurgeTimeString.get()));
+        MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] %s curJunkFolderLastPurgeTime=%s (if blank, then never)", serverIndex, junkFolderURI.get(), curJunkFolderLastPurgeTimeString.get()));
 
         // check if this account is due to purge
         // has to have been purged at least mMinDelayBetweenPurges minutes ago
         // we don't want to purge the folders all the time
         PRTime nextPurgeTime = curJunkFolderLastPurgeTime + mMinDelayBetweenPurges * 60000000 /* convert mMinDelayBetweenPurges to into microseconds */;
         if (nextPurgeTime < PR_Now())
         {
-          PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] last purge greater than min delay", serverIndex));
+          MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] last purge greater than min delay", serverIndex));
 
           nsCOMPtr <nsIMsgIncomingServer> junkFolderServer;
           rv = junkFolder->GetServer(getter_AddRefs(junkFolderServer));
           NS_ENSURE_SUCCESS(rv,rv);
 
           bool serverBusy = false;
           bool serverRequiresPassword = true;
           bool passwordPromptRequired;
           bool canSearchMessages = false;
           junkFolderServer->GetPasswordPromptRequired(&passwordPromptRequired);
           junkFolderServer->GetServerBusy(&serverBusy);
           junkFolderServer->GetServerRequiresPasswordForBiff(&serverRequiresPassword);
           junkFolderServer->GetCanSearchMessages(&canSearchMessages);
           // Make sure we're logged on before doing the search (assuming we need to be)
           // and make sure the server isn't already in the middle of downloading new messages
           // and make sure a search isn't already going on
-          PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] (search in progress? %s)", serverIndex, mSearchSession ? "true" : "false"));
-          PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] (server busy? %s)", serverIndex, serverBusy ? "true" : "false"));
-          PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] (serverRequiresPassword? %s)", serverIndex, serverRequiresPassword ? "true" : "false"));
-          PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] (passwordPromptRequired? %s)", serverIndex, passwordPromptRequired ? "true" : "false"));
+          MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] (search in progress? %s)", serverIndex, mSearchSession ? "true" : "false"));
+          MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] (server busy? %s)", serverIndex, serverBusy ? "true" : "false"));
+          MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] (serverRequiresPassword? %s)", serverIndex, serverRequiresPassword ? "true" : "false"));
+          MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] (passwordPromptRequired? %s)", serverIndex, passwordPromptRequired ? "true" : "false"));
           if (canSearchMessages && !mSearchSession && !serverBusy && (!serverRequiresPassword || !passwordPromptRequired))
           {
             int32_t purgeInterval;
             spamSettings->GetPurgeInterval(&purgeInterval);
 
             if ((oldestPurgeTime == 0) || (curJunkFolderLastPurgeTime < oldestPurgeTime))
             {
-              PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] purging! searching for messages older than %d days", serverIndex, purgeInterval));
+              MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] purging! searching for messages older than %d days", serverIndex, purgeInterval));
               oldestPurgeTime = curJunkFolderLastPurgeTime;
               purgeIntervalToUse = purgeInterval;
               folderToPurge = junkFolder;
               // if we've never purged this folder, do it...
               if (curJunkFolderLastPurgeTime == 0)
                 break;
             }
           }
           else {
             NS_ASSERTION(canSearchMessages, "unexpected, you should be able to search");
-            PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] not a good time for this server, try again later", serverIndex));
+            MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] not a good time for this server, try again later", serverIndex));
           }
         }
         else {
-          PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("[%d] last purge too recent", serverIndex));
+          MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("[%d] last purge too recent", serverIndex));
         }
       }
     }
     if (folderToPurge)
       rv = SearchFolderToPurge(folderToPurge, purgeIntervalToUse);
   }
 
   // set up timer to check accounts again
@@ -354,17 +354,17 @@ nsresult nsMsgPurgeService::SearchFolder
 
   // update the time we attempted to purge this folder
   char dateBuf[100];
   dateBuf[0] = '\0';
   PRExplodedTime exploded;
   PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &exploded);
   PR_FormatTimeUSEnglish(dateBuf, sizeof(dateBuf), "%a %b %d %H:%M:%S %Y", &exploded);
   folder->SetStringProperty("curJunkFolderLastPurgeTime", nsDependentCString(dateBuf));
-  PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("curJunkFolderLastPurgeTime is now %s", dateBuf));
+  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("curJunkFolderLastPurgeTime is now %s", dateBuf));
 
   nsCOMPtr<nsIMsgIncomingServer> server;
   rv = folder->GetServer(getter_AddRefs(server)); //we need to get the folder's server scope because imap can have local junk folder
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsMsgSearchScopeValue searchScope;
   server->GetSearchScope(&searchScope);
 
@@ -408,72 +408,72 @@ nsresult nsMsgPurgeService::SearchFolder
   }
 
   mSearchFolder = folder;
   return mSearchSession->Search(nullptr);
 }
 
 NS_IMETHODIMP nsMsgPurgeService::OnNewSearch()
 {
-  PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("on new search"));
+  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("on new search"));
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgPurgeService::OnSearchHit(nsIMsgDBHdr* aMsgHdr, nsIMsgFolder *aFolder)
 {
   NS_ENSURE_ARG_POINTER(aMsgHdr);
 
   nsCString messageId;
   nsCString author;
   nsCString subject;
 
   aMsgHdr->GetMessageId(getter_Copies(messageId));
-  PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("messageId=%s", messageId.get()));
+  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("messageId=%s", messageId.get()));
   aMsgHdr->GetSubject(getter_Copies(subject));
-  PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("subject=%s",subject.get()));
+  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("subject=%s",subject.get()));
   aMsgHdr->GetAuthor(getter_Copies(author));
-  PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("author=%s",author.get()));
+  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("author=%s",author.get()));
 
   // double check that the message is junk before adding to
   // the list of messages to delete
   //
   // note, we can't just search for messages that are junk
   // because not all imap server support keywords
   // (which we use for the junk score)
   // so the junk status would be in the message db.
   //
   // see bug #194090
   nsCString junkScoreStr;
   nsresult rv = aMsgHdr->GetStringProperty("junkscore", getter_Copies(junkScoreStr));
   NS_ENSURE_SUCCESS(rv,rv);
 
-  PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("junkScore=%s (if empty or != nsIJunkMailPlugin::IS_SPAM_SCORE, don't add to list delete)", junkScoreStr.get()));
+  MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("junkScore=%s (if empty or != nsIJunkMailPlugin::IS_SPAM_SCORE, don't add to list delete)", junkScoreStr.get()));
 
   // if "junkscore" is not set, don't delete the message
   if (junkScoreStr.IsEmpty())
     return NS_OK;
 
   if (atoi(junkScoreStr.get()) == nsIJunkMailPlugin::IS_SPAM_SCORE) {
-    PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("added message to delete"));
+    MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("added message to delete"));
     return mHdrsToDelete->AppendElement(aMsgHdr, false);
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgPurgeService::OnSearchDone(nsresult status)
 {
   if (NS_SUCCEEDED(status))
   {
     uint32_t count;
     if (mHdrsToDelete)
       mHdrsToDelete->GetLength(&count);
-    PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("%d messages to delete", count));
+    MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("%d messages to delete", count));
 
     if (count > 0) {
-      PR_LOG(MsgPurgeLogModule, PR_LOG_ALWAYS, ("delete messages"));
+      MOZ_LOG(MsgPurgeLogModule, mozilla::LogLevel::Info, ("delete messages"));
       if (mSearchFolder)
         mSearchFolder->DeleteMessages(mHdrsToDelete, nullptr, false /*delete storage*/, false /*isMove*/, nullptr, false /*allowUndo*/);
     }
   }
   if (mHdrsToDelete)
     mHdrsToDelete->Clear();
   if (mSearchSession)
     mSearchSession->UnregisterListener(this);
--- a/mailnews/compose/src/nsMsgComposeService.cpp
+++ b/mailnews/compose/src/nsMsgComposeService.cpp
@@ -46,17 +46,17 @@
 #include "nsISelection.h"
 #include "nsUTF8Utils.h"
 #include "nsILineBreaker.h"
 #include "nsLWBrkCIID.h"
 #include "mozilla/Services.h"
 #include "mimemoz2.h"
 
 #ifdef MSGCOMP_TRACE_PERFORMANCE
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "nsIMsgHdr.h"
 #include "nsIMsgMessageService.h"
 #include "nsMsgUtils.h"
 #endif
 
 #include "nsICommandLine.h"
 #include "nsIAppStartup.h"
 #include "nsMsgUtils.h"
@@ -763,29 +763,29 @@ NS_IMETHODIMP nsMsgComposeService::TimeS
     return NS_OK;
 
 #ifdef MSGCOMP_TRACE_PERFORMANCE
 
   PRIntervalTime now;
 
   if (resetTime)
   {
-    PR_LOG(MsgComposeLogModule, PR_LOG_ALWAYS, ("\n[process]: [totalTime][deltaTime]\n--------------------\n"));
+    MOZ_LOG(MsgComposeLogModule, mozilla::LogLevel::Info, ("\n[process]: [totalTime][deltaTime]\n--------------------\n"));
 
     mStartTime = PR_IntervalNow();
     mPreviousTime = mStartTime;
     now = mStartTime;
   }
   else
     now = PR_IntervalNow();
 
   PRIntervalTime totalTime = PR_IntervalToMilliseconds(now - mStartTime);
   PRIntervalTime deltaTime = PR_IntervalToMilliseconds(now - mPreviousTime);
 
-  PR_LOG(MsgComposeLogModule, PR_LOG_ALWAYS, ("[%3.2f][%3.2f] - %s\n",
+  MOZ_LOG(MsgComposeLogModule, mozilla::LogLevel::Info, ("[%3.2f][%3.2f] - %s\n",
 ((double)totalTime/1000.0) + 0.005, ((double)deltaTime/1000.0) + 0.005, label));
 
   mPreviousTime = now;
 #endif
   return NS_OK;
 }
 
 NS_IMETHODIMP
--- a/mailnews/compose/src/nsSmtpProtocol.cpp
+++ b/mailnews/compose/src/nsSmtpProtocol.cpp
@@ -15,17 +15,17 @@
 #include "nsMsgCompCID.h"
 #include "nsIPrompt.h"
 #include "nsIAuthPrompt.h"
 #include "nsStringGlue.h"
 #include "nsTextFormatter.h"
 #include "nsIMsgIdentity.h"
 #include "nsISmtpServer.h"
 #include "prtime.h"
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "prerror.h"
 #include "prprf.h"
 #include "prmem.h"
 #include "plbase64.h"
 #include "prnetdb.h"
 #include "prsystem.h"
 #include "nsMsgUtils.h"
 #include "nsIPipe.h"
@@ -296,17 +296,17 @@ void nsSmtpProtocol::Initialize(nsIURI *
     InitPrefAuthMethods(authMethod);
 
     nsAutoCString hostName;
     int32_t port = 0;
 
     aURL->GetPort(&port);
     aURL->GetAsciiHost(hostName);
 
-    PR_LOG(SMTPLogModule, PR_LOG_ALWAYS, ("SMTP Connecting to: %s", hostName.get()));
+    MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Info, ("SMTP Connecting to: %s", hostName.get()));
 
     // When we are making a secure connection, we need to make sure that we
     // pass an interface requestor down to the socket transport so that PSM can
     // retrieve a nsIPrompt instance if needed.
     nsCOMPtr<nsIInterfaceRequestor> callbacks;
     nsCOMPtr<nsISmtpUrl> smtpUrl(do_QueryInterface(aURL));
     if (smtpUrl)
         smtpUrl->GetNotificationCallbacks(getter_AddRefs(callbacks));
@@ -404,26 +404,26 @@ NS_IMETHODIMP nsSmtpProtocol::OnStopRequ
                                             nsresult aStatus)
 {
   bool connDroppedDuringAuth = NS_SUCCEEDED(aStatus) && !m_sendDone &&
       (m_nextStateAfterResponse == SMTP_AUTH_LOGIN_STEP0_RESPONSE ||
        m_nextStateAfterResponse == SMTP_AUTH_LOGIN_RESPONSE);
   // ignore errors handling the QUIT command so fcc can continue.
   if (m_sendDone && NS_FAILED(aStatus))
   {
-    PR_LOG(SMTPLogModule, PR_LOG_ALWAYS,
+    MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Info,
      ("SMTP connection error quitting %lx, ignoring ", aStatus));
     aStatus = NS_OK;
   }
   if (NS_SUCCEEDED(aStatus) && !m_sendDone) {
     // if we are getting OnStopRequest() with NS_OK,
     // but we haven't finished clean, that's spells trouble.
     // it means that the server has dropped us before we could send the whole mail
     // for example, see bug #200647
-    PR_LOG(SMTPLogModule, PR_LOG_ALWAYS,
+    MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Info,
  ("SMTP connection dropped after %ld total bytes read", m_totalAmountRead));
     if (!connDroppedDuringAuth)
       nsMsgAsyncWriteProtocol::OnStopRequest(nullptr, ctxt, NS_ERROR_NET_INTERRUPT);
   }
   else
     nsMsgAsyncWriteProtocol::OnStopRequest(nullptr, ctxt, aStatus);
 
   // okay, we've been told that the send is done and the connection is going away. So
@@ -495,17 +495,17 @@ nsresult nsSmtpProtocol::SmtpResponse(ns
   {
     SetFlag(SMTP_PAUSE_FOR_READ); /* pause */
     PR_Free(line);
     return NS_OK;
   }
 
   m_totalAmountRead += ln;
 
-  PR_LOG(SMTPLogModule, PR_LOG_ALWAYS, ("SMTP Response: %s", line));
+  MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Info, ("SMTP Response: %s", line));
   cont_char = ' '; /* default */
   // sscanf() doesn't update m_responseCode if line doesn't start
   // with a number. That can be dangerous. So be sure to set
   // m_responseCode to 0 if no items read.
   if (PR_sscanf(line, "%d%c", &m_responseCode, &cont_char) <= 0)
     m_responseCode = 0;
 
   if (m_continuationResponse == -1)
@@ -875,17 +875,17 @@ void nsSmtpProtocol::InitPrefAuthMethods
       m_prefAuthMethods = SMTP_AUTH_CRAM_MD5_ENABLED |
           SMTP_AUTH_GSSAPI_ENABLED |
           SMTP_AUTH_NTLM_ENABLED | SMTP_AUTH_MSN_ENABLED |
           SMTP_AUTH_EXTERNAL_ENABLED; // TODO: Expose EXTERNAL? How?
       break;
     default:
       NS_ASSERTION(false, "SMTP: authMethod pref invalid");
       // TODO log to error console
-      PR_LOG(SMTPLogModule, PR_LOG_ERROR,
+      MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Error,
           ("SMTP: bad pref authMethod = %d\n", authMethodPrefValue));
       // fall to any
     case nsMsgAuthMethod::anything:
       m_prefAuthMethods =
           SMTP_AUTH_LOGIN_ENABLED | SMTP_AUTH_PLAIN_ENABLED |
           SMTP_AUTH_CRAM_MD5_ENABLED | SMTP_AUTH_GSSAPI_ENABLED |
           SMTP_AUTH_NTLM_ENABLED | SMTP_AUTH_MSN_ENABLED |
           SMTP_AUTH_OAUTH2_ENABLED |
@@ -905,20 +905,20 @@ void nsSmtpProtocol::InitPrefAuthMethods
  * which is allowed by server and prefs and not marked failed.
  * The order of preference and trying of auth methods is encoded here.
  */
 nsresult nsSmtpProtocol::ChooseAuthMethod()
 {
   int32_t serverCaps = m_flags; // from nsMsgProtocol::TestFlag()
   int32_t availCaps = serverCaps & m_prefAuthMethods & ~m_failedAuthMethods;
 
-  PR_LOG(SMTPLogModule, PR_LOG_DEBUG,
+  MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug,
         ("SMTP auth: server caps 0x%X, pref 0x%X, failed 0x%X, avail caps 0x%X",
         serverCaps, m_prefAuthMethods, m_failedAuthMethods, availCaps));
-  PR_LOG(SMTPLogModule, PR_LOG_DEBUG,
+  MOZ_LOG(SMTPLogModule, mozilla::LogLevel:: Debug,
         ("(GSSAPI = 0x%X, CRAM = 0x%X, NTLM = 0x%X, "
         "MSN =  0x%X, PLAIN = 0x%X, LOGIN = 0x%X, EXTERNAL = 0x%X)",
         SMTP_AUTH_GSSAPI_ENABLED, SMTP_AUTH_CRAM_MD5_ENABLED,
         SMTP_AUTH_NTLM_ENABLED, SMTP_AUTH_MSN_ENABLED, SMTP_AUTH_PLAIN_ENABLED,
         SMTP_AUTH_LOGIN_ENABLED, SMTP_AUTH_EXTERNAL_ENABLED));
 
   if (SMTP_AUTH_GSSAPI_ENABLED & availCaps)
     m_currentAuthMethod = SMTP_AUTH_GSSAPI_ENABLED;
@@ -933,27 +933,27 @@ nsresult nsSmtpProtocol::ChooseAuthMetho
   else if (SMTP_AUTH_PLAIN_ENABLED & availCaps)
     m_currentAuthMethod = SMTP_AUTH_PLAIN_ENABLED;
   else if (SMTP_AUTH_LOGIN_ENABLED & availCaps)
     m_currentAuthMethod = SMTP_AUTH_LOGIN_ENABLED;
   else if (SMTP_AUTH_EXTERNAL_ENABLED & availCaps)
     m_currentAuthMethod = SMTP_AUTH_EXTERNAL_ENABLED;
   else
   {
-    PR_LOG(SMTPLogModule, PR_LOG_ERROR, ("no auth method remaining"));
+    MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Error, ("no auth method remaining"));
     m_currentAuthMethod = 0;
     return NS_ERROR_SMTP_AUTH_FAILURE;
   }
-  PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("trying auth method 0x%X", m_currentAuthMethod));
+  MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("trying auth method 0x%X", m_currentAuthMethod));
   return NS_OK;
 }
 
 void nsSmtpProtocol::MarkAuthMethodAsFailed(int32_t failedAuthMethod)
 {
-  PR_LOG(SMTPLogModule, PR_LOG_DEBUG,
+  MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug,
       ("marking auth method 0x%X failed", failedAuthMethod));
   m_failedAuthMethods |= failedAuthMethod;
 }
 
 /**
  * Start over, trying all auth methods again
  */
 void nsSmtpProtocol::ResetAuthMethods()
@@ -1042,17 +1042,17 @@ nsresult nsSmtpProtocol::ProcessAuth()
   }
   else // All auth methods failed
   {
     // show an appropriate error msg
     if (m_failedAuthMethods == 0)
     {
       // we didn't even try anything, so we had a non-working config:
       // pref doesn't match server
-      PR_LOG(SMTPLogModule, PR_LOG_ERROR,
+      MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Error,
           ("no working auth mech - pref doesn't match server capas"));
 
       // pref has encrypted pw & server claims to support plaintext pw
       if (m_prefAuthMethods == SMTP_AUTH_CRAM_MD5_ENABLED &&
           m_flags & (SMTP_AUTH_LOGIN_ENABLED | SMTP_AUTH_PLAIN_ENABLED))
       {
         // have SSL
         if (m_prefSocketType == nsMsgSocketType::SSL ||
@@ -1073,37 +1073,37 @@ nsresult nsSmtpProtocol::ProcessAuth()
       {
         // just "change auth method"
         m_urlErrorState = NS_ERROR_SMTP_AUTH_MECH_NOT_SUPPORTED;
       }
     }
     else if (m_failedAuthMethods == SMTP_AUTH_GSSAPI_ENABLED)
     {
       // We have only GSSAPI, and it failed, so nothing left to do.
-      PR_LOG(SMTPLogModule, PR_LOG_ERROR, ("GSSAPI only and it failed"));
+      MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Error, ("GSSAPI only and it failed"));
       m_urlErrorState = NS_ERROR_SMTP_AUTH_GSSAPI;
     }
     else
     {
       // we tried to login, but it all failed
-      PR_LOG(SMTPLogModule, PR_LOG_ERROR, ("All auth attempts failed"));
+      MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Error, ("All auth attempts failed"));
       m_urlErrorState = NS_ERROR_SMTP_AUTH_FAILURE;
     }
     m_nextState = SMTP_ERROR_DONE;
     return NS_ERROR_SMTP_AUTH_FAILURE;
   }
 
   return NS_OK;
 }
 
 
 
 nsresult nsSmtpProtocol::AuthLoginResponse(nsIInputStream * stream, uint32_t length)
 {
-  PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("SMTP Login response, code %d", m_responseCode));
+  MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("SMTP Login response, code %d", m_responseCode));
   nsresult status = NS_OK;
 
   switch (m_responseCode/100)
   {
     case 2:
       m_nextState = SMTP_SEND_HELO_RESPONSE;
       // fake to 250 because SendHeloResponse() tests for this
       m_responseCode = 250;
@@ -1123,63 +1123,63 @@ nsresult nsSmtpProtocol::AuthLoginRespon
 
         bool allFailed = NS_FAILED(ChooseAuthMethod());
         if (allFailed && m_failedAuthMethods > 0 &&
             m_failedAuthMethods != SMTP_AUTH_GSSAPI_ENABLED &&
             m_failedAuthMethods != SMTP_AUTH_EXTERNAL_ENABLED)
         {
           // We've tried all avail. methods, and they all failed, and we have no mechanism left.
           // Ask user to try with a new password.
-          PR_LOG(SMTPLogModule, PR_LOG_WARN,
+          MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Warning,
               ("SMTP: ask user what to do (after login failed): new password, retry or cancel"));
 
           nsCOMPtr<nsISmtpServer> smtpServer;
           nsresult rv = m_runningURL->GetSmtpServer(getter_AddRefs(smtpServer));
           NS_ENSURE_SUCCESS(rv, rv);
 
           nsCString hostname;
           rv = smtpServer->GetHostname(hostname);
           NS_ENSURE_SUCCESS(rv, rv);
 
           int32_t buttonPressed = 1;
           if (NS_SUCCEEDED(MsgPromptLoginFailed(nullptr, hostname,
                                                 &buttonPressed)))
           {
             if (buttonPressed == 1) // Cancel button
             {
-              PR_LOG(SMTPLogModule, PR_LOG_WARN, ("cancel button pressed"));
+              MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Warning, ("cancel button pressed"));
               // abort and get out of here
               status = NS_ERROR_ABORT;
               break;
             }
             else if (buttonPressed == 2) // 'New password' button
             {
-              PR_LOG(SMTPLogModule, PR_LOG_WARN, ("new password button pressed"));
+              MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Warning, ("new password button pressed"));
               // Change password was pressed. For now, forget the stored
               // password and we'll prompt for a new one next time around.
               smtpServer->ForgetPassword();
               if (m_usernamePrompted)
                 smtpServer->SetUsername(EmptyCString());
 
               // Let's restore the original auth flags from SendEhloResponse
               // so we can try them again with new password and username
               ResetAuthMethods();
               // except for GSSAPI and EXTERNAL, which don't care about passwords.
               MarkAuthMethodAsFailed(SMTP_AUTH_GSSAPI_ENABLED);
               MarkAuthMethodAsFailed(SMTP_AUTH_EXTERNAL_ENABLED);
             }
             else if (buttonPressed == 0) // Retry button
             {
-              PR_LOG(SMTPLogModule, PR_LOG_WARN, ("retry button pressed"));
+              MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Warning, ("retry button pressed"));
               // try all again, including GSSAPI
               ResetAuthMethods();
             }
           }
         }
-        PR_LOG(SMTPLogModule, PR_LOG_ERROR,
+        MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Error,
             ("SMTP: login failed: failed %X, current %X", m_failedAuthMethods, m_currentAuthMethod));
 
         m_nextState = SMTP_AUTH_PROCESS_STATE; // try auth (ProcessAuth()) again, with other method
       }
       else
           status = NS_ERROR_SMTP_PASSWORD_UNDEFINED;
       break;
   }
@@ -1204,23 +1204,23 @@ nsresult nsSmtpProtocol::AuthGSSAPIFirst
   rv = smtpServer->GetUsername(userName);
   if (NS_FAILED(rv))
     return NS_ERROR_FAILURE;
 
   rv = smtpServer->GetHostname(hostName);
   if (NS_FAILED(rv))
     return NS_ERROR_FAILURE;
   service.Append(hostName);
-  PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("SMTP: GSSAPI step 1 for user %s at server %s, service %s",
+  MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("SMTP: GSSAPI step 1 for user %s at server %s, service %s",
       userName.get(), hostName.get(), service.get()));
 
   rv = DoGSSAPIStep1(service.get(), userName.get(), resp);
   if (NS_FAILED(rv))
   {
-    PR_LOG(SMTPLogModule, PR_LOG_ERROR, ("SMTP: GSSAPI step 1 failed early"));
+    MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Error, ("SMTP: GSSAPI step 1 failed early"));
     MarkAuthMethodAsFailed(SMTP_AUTH_GSSAPI_ENABLED);
     m_nextState = SMTP_AUTH_PROCESS_STATE;
     return NS_OK;
   }
   else
     command.Append(resp);
   command.Append(CRLF);
   m_nextState = SMTP_RESPONSE;
@@ -1228,17 +1228,17 @@ nsresult nsSmtpProtocol::AuthGSSAPIFirst
   SetFlag(SMTP_PAUSE_FOR_READ);
   return SendData(command.get());
 }
 
 // GSSAPI may consist of multiple round trips
 
 nsresult nsSmtpProtocol::AuthGSSAPIStep()
 {
-  PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("SMTP: GSSAPI auth step 2"));
+  MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("SMTP: GSSAPI auth step 2"));
   NS_ASSERTION(m_currentAuthMethod == SMTP_AUTH_GSSAPI_ENABLED, "called in invalid state");
   nsresult rv;
   nsAutoCString cmd;
 
   // Check to see what the server said
   if (m_responseCode / 100 != 3) {
     m_nextState = SMTP_AUTH_LOGIN_RESPONSE;
     return NS_OK;
@@ -1261,17 +1261,17 @@ nsresult nsSmtpProtocol::AuthGSSAPIStep(
 // but by non-RFC2821 compliant implementation in MS servers) not two as
 // PLAIN or CRAM-MD5, so we've to start here and continue with AuthStep1
 // if the server responds with with a 3xx code to "AUTH LOGIN" or "AUTH MSN"
 nsresult nsSmtpProtocol::AuthLoginStep0()
 {
     NS_ASSERTION(m_currentAuthMethod == SMTP_AUTH_MSN_ENABLED ||
         m_currentAuthMethod == SMTP_AUTH_LOGIN_ENABLED,
         "called in invalid state");
-    PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("SMTP: MSN or LOGIN auth, step 0"));
+    MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("SMTP: MSN or LOGIN auth, step 0"));
     nsAutoCString command(m_currentAuthMethod == SMTP_AUTH_MSN_ENABLED
         ? "AUTH MSN" CRLF : "AUTH LOGIN" CRLF);
     m_nextState = SMTP_RESPONSE;
     m_nextStateAfterResponse = SMTP_AUTH_LOGIN_STEP0_RESPONSE;
     SetFlag(SMTP_PAUSE_FOR_READ);
 
     return SendData(command.get());
 }
@@ -1302,61 +1302,61 @@ nsresult nsSmtpProtocol::AuthLoginStep1(
   rv = smtpServer->GetUsername(username);
   if (username.IsEmpty())
   {
     rv = GetUsernamePassword(username, password);
     m_usernamePrompted = true;
     if (username.IsEmpty() || password.IsEmpty())
       return NS_ERROR_SMTP_PASSWORD_UNDEFINED;
   }
-  PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("SMTP AuthLoginStep1() for %s@%s",
+  MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("SMTP AuthLoginStep1() for %s@%s",
       username.get(), smtpServer.get()));
 
   GetPassword(password);
   if (password.IsEmpty())
   {
-    PR_LOG(SMTPLogModule, PR_LOG_ERROR, ("SMTP: password undefined"));
+    MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Error, ("SMTP: password undefined"));
     m_urlErrorState = NS_ERROR_SMTP_PASSWORD_UNDEFINED;
     return NS_ERROR_SMTP_PASSWORD_UNDEFINED;
   }
 
   if (m_currentAuthMethod == SMTP_AUTH_CRAM_MD5_ENABLED)
   {
-    PR_LOG(SMTPLogModule, PR_LOG_ERROR, ("CRAM auth, step 1"));
+    MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Error, ("CRAM auth, step 1"));
     PR_snprintf(buffer, sizeof(buffer), "AUTH CRAM-MD5" CRLF);
   }
   else if (m_currentAuthMethod == SMTP_AUTH_NTLM_ENABLED ||
            m_currentAuthMethod == SMTP_AUTH_MSN_ENABLED)
   {
-    PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("NTLM/MSN auth, step 1"));
+    MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("NTLM/MSN auth, step 1"));
     nsAutoCString response;
     rv = DoNtlmStep1(username.get(), password.get(), response);
     PR_snprintf(buffer, sizeof(buffer), TestFlag(SMTP_AUTH_NTLM_ENABLED) ?
                                         "AUTH NTLM %.256s" CRLF :
                                         "%.256s" CRLF, response.get());
   }
   else if (m_currentAuthMethod == SMTP_AUTH_PLAIN_ENABLED)
   {
-    PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("PLAIN auth"));
+    MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("PLAIN auth"));
     char plain_string[512];
     int len = 1; /* first <NUL> char */
 
     memset(plain_string, 0, 512);
     PR_snprintf(&plain_string[1], 510, "%s", username.get());
     len += username.Length();
     len++; /* second <NUL> char */
     PR_snprintf(&plain_string[len], 511-len, "%s", password.get());
     len += password.Length();
 
     base64Str = PL_Base64Encode(plain_string, len, nullptr);
     PR_snprintf(buffer, sizeof(buffer), "AUTH PLAIN %.256s" CRLF, base64Str);
   }
   else if (m_currentAuthMethod == SMTP_AUTH_LOGIN_ENABLED)
   {
-    PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("LOGIN auth"));
+    MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("LOGIN auth"));
     base64Str = PL_Base64Encode(username.get(),
         username.Length(), nullptr);
     PR_snprintf(buffer, sizeof(buffer), "%.256s" CRLF, base64Str);
   }
   else
     return (NS_ERROR_COMMUNICATIONS_ERROR);
 
   status = SendData(buffer, true);
@@ -1380,24 +1380,24 @@ nsresult nsSmtpProtocol::AuthLoginStep2(
   nsAutoCString password;
 
   GetPassword(password);
   if (password.IsEmpty())
   {
     m_urlErrorState = NS_ERROR_SMTP_PASSWORD_UNDEFINED;
     return NS_ERROR_SMTP_PASSWORD_UNDEFINED;
   }
-  PR_LOG(SMTPLogModule, PR_LOG_MAX, ("SMTP AuthLoginStep2"));
+  MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("SMTP AuthLoginStep2"));
 
   if (!password.IsEmpty())
   {
     char buffer[512];
     if (m_currentAuthMethod == SMTP_AUTH_CRAM_MD5_ENABLED)
     {
-      PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("CRAM auth, step 2"));
+      MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("CRAM auth, step 2"));
       unsigned char digest[DIGEST_LENGTH];
       char * decodedChallenge = PL_Base64Decode(m_responseText.get(),
         m_responseText.Length(), nullptr);
 
       if (decodedChallenge)
         rv = MSGCramMD5(decodedChallenge, strlen(decodedChallenge), password.get(), password.Length(), digest);
       else
         rv = NS_ERROR_FAILURE;
@@ -1427,25 +1427,25 @@ nsresult nsSmtpProtocol::AuthLoginStep2(
         NS_Free(base64Str);
       }
       if (NS_FAILED(rv))
         PR_snprintf(buffer, sizeof(buffer), "*" CRLF);
     }
     else if (m_currentAuthMethod == SMTP_AUTH_NTLM_ENABLED ||
              m_currentAuthMethod == SMTP_AUTH_MSN_ENABLED)
     {
-      PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("NTLM/MSN auth, step 2"));
+      MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("NTLM/MSN auth, step 2"));
       nsAutoCString response;
       rv = DoNtlmStep2(m_responseText, response);
       PR_snprintf(buffer, sizeof(buffer), "%.256s" CRLF, response.get());
     }
     else if (m_currentAuthMethod == SMTP_AUTH_PLAIN_ENABLED ||
              m_currentAuthMethod == SMTP_AUTH_LOGIN_ENABLED)
     {
-      PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("PLAIN/LOGIN auth, step 2"));
+      MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("PLAIN/LOGIN auth, step 2"));
       char *base64Str = PL_Base64Encode(password.get(), password.Length(), nullptr);
       PR_snprintf(buffer, sizeof(buffer), "%.256s" CRLF, base64Str);
       NS_Free(base64Str);
     }
     else
       return NS_ERROR_COMMUNICATIONS_ERROR;
 
     status = SendData(buffer, true);
@@ -1497,17 +1497,17 @@ nsresult nsSmtpProtocol::OnSuccess(const
   SetFlag(SMTP_PAUSE_FOR_READ);
 
   ProcessProtocolState(nullptr, nullptr, 0, 0);
   return NS_OK;
 }
 
 nsresult nsSmtpProtocol::OnFailure(nsresult aError)
 {
-  PR_LOG(SMTPLogModule, PR_LOG_DEBUG, ("OAuth2 login error %08x",
+  MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Debug, ("OAuth2 login error %08x",
     (uint32_t)aError));
   m_urlErrorState = aError;
   m_nextState = SMTP_ERROR_DONE;
   return ProcessProtocolState(nullptr, nullptr, 0, 0);
 }
 
 
 nsresult nsSmtpProtocol::SendMailResponse()
@@ -1665,19 +1665,19 @@ nsresult nsSmtpProtocol::SendRecipientRe
 
 
 nsresult nsSmtpProtocol::SendData(const char *dataBuffer, bool aSuppressLogging)
 {
   // XXX -1 is not a valid nsresult
   if (!dataBuffer) return static_cast<nsresult>(-1);
 
   if (!aSuppressLogging) {
-      PR_LOG(SMTPLogModule, PR_LOG_ALWAYS, ("SMTP Send: %s", dataBuffer));
+      MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Info, ("SMTP Send: %s", dataBuffer));
   } else {
-      PR_LOG(SMTPLogModule, PR_LOG_ALWAYS, ("Logging suppressed for this command (it probably contained authentication information)"));
+      MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Info, ("Logging suppressed for this command (it probably contained authentication information)"));
   }
   return nsMsgAsyncWriteProtocol::SendData(dataBuffer);
 }
 
 
 nsresult nsSmtpProtocol::SendDataResponse()
 {
   nsresult status = NS_OK;
@@ -1913,17 +1913,17 @@ nsresult nsSmtpProtocol::LoadUrl(nsIURI 
 nsresult nsSmtpProtocol::ProcessProtocolState(nsIURI * url, nsIInputStream * inputStream,
                                               uint64_t sourceOffset, uint32_t length)
  {
    nsresult status = NS_OK;
    ClearFlag(SMTP_PAUSE_FOR_READ); /* already paused; reset */
 
    while(!TestFlag(SMTP_PAUSE_FOR_READ))
    {
-     PR_LOG(SMTPLogModule, PR_LOG_ALWAYS, ("SMTP entering state: %d",
+     MOZ_LOG(SMTPLogModule, mozilla::LogLevel::Info, ("SMTP entering state: %d",
        m_nextState));
      switch(m_nextState)
      {
      case SMTP_RESPONSE:
        if (inputStream == nullptr)
          SetFlag(SMTP_PAUSE_FOR_READ);
        else
          status = SmtpResponse(inputStream, length);
--- a/mailnews/db/msgdb/src/nsMailDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMailDatabase.cpp
@@ -6,23 +6,25 @@
 #include "msgCore.h"
 #include "nsMailDatabase.h"
 #include "nsDBFolderInfo.h"
 #include "nsMsgLocalFolderHdrs.h"
 #include "nsNetUtil.h"
 #include "nsISeekableStream.h"
 #include "nsMsgOfflineImapOperation.h"
 #include "nsMsgFolderFlags.h"
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "prprf.h"
 #include "nsMsgUtils.h"
 #include "nsIMsgPluggableStore.h"
 
 extern PRLogModuleInfo *IMAPOffline;
 
+using namespace mozilla;
+
 // scope for all offine ops table
 const char *kOfflineOpsScope = "ns:msg:db:row:scope:ops:all";
 const char *kOfflineOpsTableKind = "ns:msg:db:table:kind:ops";
 struct mdbOid gAllOfflineOpsTableOID;
 
 nsMailDatabase::nsMailDatabase() : m_reparse(false)
 {
   m_mdbAllOfflineOpsTable = nullptr;
@@ -235,17 +237,17 @@ NS_IMETHODIMP nsMailDatabase::ListAllOff
       
       err = rowCursor->NextRowOid(GetEnv(), &outOid, &outPos);
       // is this right? Mork is returning a 0 id, but that should valid.
       if (outPos < 0 || outOid.mOid_Id == (mdb_id) -1)
         break;
       if (NS_SUCCEEDED(err))
       {
         offlineOpIds->AppendElement(outOid.mOid_Id);
-        if (PR_LOG_TEST(IMAPOffline, PR_LOG_ALWAYS))
+        if (MOZ_LOG_TEST(IMAPOffline, LogLevel::Info))
         {
           nsCOMPtr <nsIMsgOfflineImapOperation> offlineOp;
           GetOfflineOpForKey(outOid.mOid_Id, false, getter_AddRefs(offlineOp));
           if (offlineOp)
           {
             nsMsgOfflineImapOperation *logOp = static_cast<nsMsgOfflineImapOperation *>(static_cast<nsIMsgOfflineImapOperation *>(offlineOp.get()));
             if (logOp)
               logOp->Log(IMAPOffline);
--- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp
+++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp
@@ -10,17 +10,17 @@
 #include "nsMailDatabase.h"
 #include "nsDBFolderInfo.h"
 #include "nsMsgKeySet.h"
 #include "nsMsgThread.h"
 #include "nsIMsgSearchTerm.h"
 #include "nsMsgBaseCID.h"
 #include "nsMorkCID.h"
 #include "nsIMdbFactoryFactory.h"
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "prprf.h"
 #include "nsMsgDBCID.h"
 #include "nsILocale.h"
 #include "nsMsgMimeCID.h"
 #include "nsILocaleService.h"
 #include "nsMsgFolderFlags.h"
 #include "nsIMsgAccountManager.h"
 #include "nsIMsgDBView.h"
@@ -41,16 +41,17 @@
 #include "nsAlgorithm.h"
 #include "nsArrayEnumerator.h"
 #include "nsIMemoryReporter.h"
 #include "mozilla/mailnews/MimeHeaderParser.h"
 #include "mozilla/mailnews/Services.h"
 #include <algorithm>
 
 using namespace mozilla::mailnews;
+using namespace mozilla;
 
 #if defined(DEBUG_sspitzer_) || defined(DEBUG_seth_)
 #define DEBUG_MSGKEYSET 1
 #endif
 
 #define MSG_HASH_SIZE 512
 
 // This will be used on discovery, since we don't know total.
@@ -964,21 +965,21 @@ void nsMsgDBService::AddToCache(nsMsgDat
 }
 
 /**
  * Log the open db's, and how many headers are in memory.
  */
 void nsMsgDBService::DumpCache()
 {
   nsMsgDatabase* db = nullptr;
-  PR_LOG(DBLog, PR_LOG_ALWAYS, ("%d open DB's\n", m_dbCache.Length()));
+  MOZ_LOG(DBLog, LogLevel::Info, ("%d open DB's\n", m_dbCache.Length()));
   for (uint32_t i = 0; i < m_dbCache.Length(); i++)
   {
     db = m_dbCache.ElementAt(i);
-    PR_LOG(DBLog, PR_LOG_ALWAYS, ("%s - %ld hdrs in use\n",
+    MOZ_LOG(DBLog, LogLevel::Info, ("%s - %ld hdrs in use\n",
       (const char*)db->m_dbName.get(),
       db->m_headersInUse ? db->m_headersInUse->EntryCount() : 0));
   }
 }
 
 // Memory Reporting implementations
 
 size_t nsMsgDatabase::HeaderHashSizeOf(PLDHashEntryHdr *hdr,
@@ -1144,17 +1145,17 @@ nsMsgDatabase::~nsMsgDatabase()
   delete m_headersInUse;
 
   if (m_msgReferences)
   {
     delete m_msgReferences;
     m_msgReferences = nullptr;
   }
 
-  PR_LOG(DBLog, PR_LOG_ALWAYS, ("closing database    %s\n",
+  MOZ_LOG(DBLog, LogLevel::Info, ("closing database    %s\n",
     (const char*)m_dbName.get()));
 
   nsCOMPtr<nsIMsgDBService> serv(do_GetService(NS_MSGDB_SERVICE_CONTRACTID));
   if (serv)
     static_cast<nsMsgDBService*>(serv.get())->RemoveFromCache(this);
 
   // if the db folder info refers to the mdb db, we must clear it because
   // the reference will be a dangling one soon.
@@ -1205,26 +1206,26 @@ nsresult nsMsgDatabase::Open(nsMsgDBServ
 
 nsresult nsMsgDatabase::OpenInternal(nsMsgDBService *aDBService,
                                      nsIFile *summaryFile, bool aCreate,
                                      bool aLeaveInvalidDB, bool sync)
 {
   nsAutoCString summaryFilePath;
   summaryFile->GetNativePath(summaryFilePath);
 
-  PR_LOG(DBLog, PR_LOG_ALWAYS, ("nsMsgDatabase::Open(%s, %s, %p, %s)\n",
+  MOZ_LOG(DBLog, LogLevel::Info, ("nsMsgDatabase::Open(%s, %s, %p, %s)\n",
     (const char*)summaryFilePath.get(), aCreate ? "TRUE":"FALSE",
     this, aLeaveInvalidDB ? "TRUE":"FALSE"));
 
 
   nsresult rv = OpenMDB(summaryFilePath.get(), aCreate, sync);
   if (NS_FAILED(rv))
-    PR_LOG(DBLog, PR_LOG_ALWAYS, ("error opening db %lx", rv));
-
-  if (PR_LOG_TEST(DBLog, PR_LOG_DEBUG))
+    MOZ_LOG(DBLog, LogLevel::Info, ("error opening db %lx", rv));
+
+  if (MOZ_LOG_TEST(DBLog, LogLevel::Debug))
     aDBService->DumpCache();
 
   if (rv == NS_ERROR_FILE_TARGET_DOES_NOT_EXIST)
     return rv;
 
   m_create = aCreate;
   m_leaveInvalidDB = aLeaveInvalidDB;
   if (!sync && NS_SUCCEEDED(rv))
--- a/mailnews/db/msgdb/src/nsMsgOfflineImapOperation.cpp
+++ b/mailnews/db/msgdb/src/nsMsgOfflineImapOperation.cpp
@@ -1,16 +1,19 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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 "msgCore.h"
 #include "nsMsgOfflineImapOperation.h"
 #include "nsMsgUtils.h"
+#include "mozilla/Logging.h"
+
+using namespace mozilla;
 
 PRLogModuleInfo *IMAPOffline;
 
 /* Implementation file */
 NS_IMPL_ISUPPORTS(nsMsgOfflineImapOperation, nsIMsgOfflineImapOperation)
 
 // property names for offine imap operation fields.
 #define PROP_OPERATION "op"
@@ -59,28 +62,28 @@ NS_IMETHODIMP nsMsgOfflineImapOperation:
 {
   NS_ENSURE_ARG(aOperation);
   *aOperation = m_operation;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgOfflineImapOperation::SetOperation(nsOfflineImapOperationType aOperation)
 {
-  if (PR_LOG_TEST(IMAPOffline, PR_LOG_ALWAYS))
-    PR_LOG(IMAPOffline, PR_LOG_ALWAYS, ("msg id %x setOperation was %x add %x", m_messageKey, m_operation, aOperation));
+  if (MOZ_LOG_TEST(IMAPOffline, LogLevel::Info))
+    MOZ_LOG(IMAPOffline, LogLevel::Info, ("msg id %x setOperation was %x add %x", m_messageKey, m_operation, aOperation));
 
   m_operation |= aOperation;
   return m_mdb->SetUint32Property(m_mdbRow, PROP_OPERATION, m_operation);
 }
 
 /* void clearOperation (in nsOfflineImapOperationType operation); */
 NS_IMETHODIMP nsMsgOfflineImapOperation::ClearOperation(nsOfflineImapOperationType aOperation)
 {
-  if (PR_LOG_TEST(IMAPOffline, PR_LOG_ALWAYS))
-    PR_LOG(IMAPOffline, PR_LOG_ALWAYS, ("msg id %x clearOperation was %x clear %x", m_messageKey, m_operation, aOperation));
+  if (MOZ_LOG_TEST(IMAPOffline, LogLevel::Info))
+    MOZ_LOG(IMAPOffline, LogLevel::Info, ("msg id %x clearOperation was %x clear %x", m_messageKey, m_operation, aOperation));
   m_operation &= ~aOperation;
   switch (aOperation)
   {
   case kMsgMoved:
   case kAppendTemplate:
   case kAppendDraft:
     m_moveDestination.Truncate();
     break;
@@ -123,18 +126,18 @@ NS_IMETHODIMP nsMsgOfflineImapOperation:
 {
   NS_ENSURE_ARG(aFlagOperation);
   *aFlagOperation = m_operationFlags;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsMsgOfflineImapOperation::SetFlagOperation(imapMessageFlagsType aFlagOperation)
 {
-  if (PR_LOG_TEST(IMAPOffline, PR_LOG_ALWAYS))
-    PR_LOG(IMAPOffline, PR_LOG_ALWAYS, ("msg id %x setFlagOperation was %x add %x", m_messageKey, m_operationFlags, aFlagOperation));
+  if (MOZ_LOG_TEST(IMAPOffline, LogLevel::Info))
+    MOZ_LOG(IMAPOffline, LogLevel::Info, ("msg id %x setFlagOperation was %x add %x", m_messageKey, m_operationFlags, aFlagOperation));
   SetOperation(kFlagsChanged);
   nsresult rv = SetNewFlags(aFlagOperation);
   NS_ENSURE_SUCCESS(rv, rv);
   m_operationFlags |= aFlagOperation;
   return m_mdb->SetUint32Property(m_mdbRow, PROP_OPERATION_FLAGS, m_operationFlags);
 }
 
 /* attribute imapMessageFlagsType flagOperation; */
@@ -144,36 +147,36 @@ NS_IMETHODIMP nsMsgOfflineImapOperation:
   uint32_t flags;
   nsresult rv = m_mdb->GetUint32Property(m_mdbRow, PROP_NEW_FLAGS, &flags, 0);
   *aNewFlags = m_newFlags = (imapMessageFlagsType) flags;
   return rv;
 }
 
 NS_IMETHODIMP nsMsgOfflineImapOperation::SetNewFlags(imapMessageFlagsType aNewFlags)
 {
-  if (PR_LOG_TEST(IMAPOffline, PR_LOG_ALWAYS) && m_newFlags != aNewFlags)
-    PR_LOG(IMAPOffline, PR_LOG_ALWAYS, ("msg id %x SetNewFlags was %x to %x", m_messageKey, m_newFlags, aNewFlags));
+  if (MOZ_LOG_TEST(IMAPOffline, LogLevel::Info) && m_newFlags != aNewFlags)
+    MOZ_LOG(IMAPOffline, LogLevel::Info, ("msg id %x SetNewFlags was %x to %x", m_messageKey, m_newFlags, aNewFlags));
   m_newFlags = aNewFlags;
   return m_mdb->SetUint32Property(m_mdbRow, PROP_NEW_FLAGS, m_newFlags);
 }
 
 
 /* attribute string destinationFolderURI; */
 NS_IMETHODIMP nsMsgOfflineImapOperation::GetDestinationFolderURI(char * *aDestinationFolderURI)
 {
   NS_ENSURE_ARG(aDestinationFolderURI);
   (void) m_mdb->GetProperty(m_mdbRow, PROP_MOVE_DEST_FOLDER_URI, getter_Copies(m_moveDestination));
   *aDestinationFolderURI = ToNewCString(m_moveDestination);
   return (*aDestinationFolderURI) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
 }
 
 NS_IMETHODIMP nsMsgOfflineImapOperation::SetDestinationFolderURI(const char * aDestinationFolderURI)
 {
-  if (PR_LOG_TEST(IMAPOffline, PR_LOG_ALWAYS))
-    PR_LOG(IMAPOffline, PR_LOG_ALWAYS, ("msg id %x SetDestinationFolderURI to %s", m_messageKey, aDestinationFolderURI));
+  if (MOZ_LOG_TEST(IMAPOffline, LogLevel::Info))
+    MOZ_LOG(IMAPOffline, LogLevel::Info, ("msg id %x SetDestinationFolderURI to %s", m_messageKey, aDestinationFolderURI));
   m_moveDestination = aDestinationFolderURI ? aDestinationFolderURI : 0;
   return m_mdb->SetProperty(m_mdbRow, PROP_MOVE_DEST_FOLDER_URI, aDestinationFolderURI);
 }
 
 /* attribute string sourceFolderURI; */
 NS_IMETHODIMP nsMsgOfflineImapOperation::GetSourceFolderURI(char * *aSourceFolderURI)
 {
   NS_ENSURE_ARG(aSourceFolderURI);
@@ -338,38 +341,38 @@ NS_IMETHODIMP nsMsgOfflineImapOperation:
   return m_mdb->GetBooleanProperty(m_mdbRow, PROP_PLAYINGBACK, aPlayingBack);
 }
 
 
 void nsMsgOfflineImapOperation::Log(PRLogModuleInfo *logFile)
 {
   if (!IMAPOffline)
     IMAPOffline = PR_NewLogModule("IMAPOFFLINE");
-  if (!PR_LOG_TEST(IMAPOffline, PR_LOG_ALWAYS))
+  if (!MOZ_LOG_TEST(IMAPOffline, LogLevel::Info))
     return;
   //  const long kMoveResult              = 0x8;
   //  const long kAppendDraft           = 0x10;
   //  const long kAddedHeader           = 0x20;
   //  const long kDeletedMsg              = 0x40;
   //  const long kMsgMarkedDeleted = 0x80;
   //  const long kAppendTemplate      = 0x100;
   //  const long kDeleteAllMsgs          = 0x200;
   if (m_operation & nsIMsgOfflineImapOperation::kFlagsChanged)
-    PR_LOG(IMAPOffline, PR_LOG_ALWAYS, ("msg id %x changeFlag:%x", m_messageKey, m_newFlags));
+    MOZ_LOG(IMAPOffline, LogLevel::Info, ("msg id %x changeFlag:%x", m_messageKey, m_newFlags));
   if (m_operation & nsIMsgOfflineImapOperation::kMsgMoved)
   {
     nsCString moveDestFolder;
     GetDestinationFolderURI(getter_Copies(moveDestFolder));
-    PR_LOG(IMAPOffline, PR_LOG_ALWAYS, ("msg id %x moveTo:%s", m_messageKey, moveDestFolder.get()));
+    MOZ_LOG(IMAPOffline, LogLevel::Info, ("msg id %x moveTo:%s", m_messageKey, moveDestFolder.get()));
   }
   if (m_operation & nsIMsgOfflineImapOperation::kMsgCopy)
   {
     nsCString copyDests;
     m_mdb->GetProperty(m_mdbRow, PROP_COPY_DESTS, getter_Copies(copyDests));
-    PR_LOG(IMAPOffline, PR_LOG_ALWAYS, ("msg id %x moveTo:%s", m_messageKey, copyDests.get()));
+    MOZ_LOG(IMAPOffline, LogLevel::Info, ("msg id %x moveTo:%s", m_messageKey, copyDests.get()));
   }
   if (m_operation & nsIMsgOfflineImapOperation::kAppendDraft)
-    PR_LOG(IMAPOffline, PR_LOG_ALWAYS, ("msg id %x append draft", m_messageKey));
+    MOZ_LOG(IMAPOffline, LogLevel::Info, ("msg id %x append draft", m_messageKey));
   if (m_operation & nsIMsgOfflineImapOperation::kAddKeywords)
-    PR_LOG(IMAPOffline, PR_LOG_ALWAYS, ("msg id %x add keyword:%s", m_messageKey, m_keywordsToAdd.get()));
+    MOZ_LOG(IMAPOffline, LogLevel::Info, ("msg id %x add keyword:%s", m_messageKey, m_keywordsToAdd.get()));
   if (m_operation & nsIMsgOfflineImapOperation::kRemoveKeywords)
-    PR_LOG(IMAPOffline, PR_LOG_ALWAYS, ("msg id %x remove keyword:%s", m_messageKey, m_keywordsToRemove.get()));
+    MOZ_LOG(IMAPOffline, LogLevel::Info, ("msg id %x remove keyword:%s", m_messageKey, m_keywordsToRemove.get()));
 }
--- a/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp
+++ b/mailnews/extensions/bayesian-spam-filter/src/nsBayesianFilter.cpp
@@ -7,31 +7,33 @@
 #include "nsIInputStream.h"
 #include "nsIStreamListener.h"
 #include "nsNetUtil.h"
 #include "nsQuickSort.h"
 #include "nsIMsgMessageService.h"
 #include "nsMsgUtils.h" // for GetMessageServiceFromURI
 #include "prnetdb.h"
 #include "nsIMsgWindow.h"
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsUnicharUtils.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsIMIMEHeaderParam.h"
 #include "nsNetCID.h"
 #include "nsIMimeHeaders.h"
 #include "nsMsgMimeCID.h"
 #include "nsIMsgMailNewsUrl.h"
 #include "nsIMimeMiscStatus.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 #include "nsIStringEnumerator.h"
 #include "nsIObserverService.h"
 
+using namespace mozilla;
+
 // needed to mark attachment flag on the db hdr
 #include "nsIMsgHdr.h"
 
 // needed to strip html out of the body
 #include "nsIContentSerializer.h"
 #include "nsLayoutCID.h"
 #include "nsIParserUtils.h"
 #include "nsIDocumentEncoder.h"
@@ -190,45 +192,45 @@ inline BaseToken* TokenHash::get(const c
 BaseToken* TokenHash::add(const char* word)
 {
     if (!word || !*word)
     {
       NS_ERROR("Trying to add a null word");
       return nullptr;
     }
 
-    PR_LOG(BayesianFilterLogModule, PR_LOG_DEBUG, ("add word: %s", word));
+    MOZ_LOG(BayesianFilterLogModule, LogLevel::Debug, ("add word: %s", word));
 
     PLDHashEntryHdr* entry = PL_DHashTableAdd(&mTokenTable, word, mozilla::fallible);
     BaseToken* token = static_cast<BaseToken*>(entry);
     if (token) {
         if (token->mWord == NULL) {
             uint32_t len = strlen(word);
             NS_ASSERTION(len != 0, "adding zero length word to tokenizer");
             if (!len)
-              PR_LOG(BayesianFilterLogModule, PR_LOG_DEBUG, ("adding zero length word to tokenizer"));
+              MOZ_LOG(BayesianFilterLogModule, LogLevel::Debug, ("adding zero length word to tokenizer"));
             token->mWord = copyWord(word, len);
             NS_ASSERTION(token->mWord, "copyWord failed");
             if (!token->mWord) {
-                PR_LOG(BayesianFilterLogModule, PR_LOG_ERROR, ("copyWord failed: %s (%d)", word, len));
+                MOZ_LOG(BayesianFilterLogModule, LogLevel::Error, ("copyWord failed: %s (%d)", word, len));
                 PL_DHashTableRawRemove(&mTokenTable, entry);
                 return NULL;
             }
         }
     }
     return token;
 }
 
 void TokenHash::visit(bool (*f) (BaseToken*, void*), void* data)
 {
     VisitClosure closure = { f, data };
     uint32_t visitCount = PL_DHashTableEnumerate(&mTokenTable, VisitEntry, &closure);
     NS_ASSERTION(visitCount == mTokenTable.EntryCount(), "visitCount != entryCount!");
     if (visitCount != mTokenTable.EntryCount()) {
-      PR_LOG(BayesianFilterLogModule, PR_LOG_ERROR, ("visitCount != entryCount!: %d vs %d", visitCount, mTokenTable.EntryCount()));
+      MOZ_LOG(BayesianFilterLogModule, LogLevel::Error, ("visitCount != entryCount!: %d vs %d", visitCount, mTokenTable.EntryCount()));
     }
 }
 
 inline uint32_t TokenHash::countTokens()
 {
   return mTokenTable.EntryCount();
 }
 
@@ -357,24 +359,24 @@ Tokenizer::~Tokenizer()
 
 inline Token* Tokenizer::get(const char* word)
 {
   return static_cast<Token*>(TokenHash::get(word));
 }
 
 Token* Tokenizer::add(const char* word, uint32_t count)
 {
-  PR_LOG(BayesianFilterLogModule, PR_LOG_DEBUG, ("add word: %s (count=%d)",
+  MOZ_LOG(BayesianFilterLogModule, LogLevel::Debug, ("add word: %s (count=%d)",
          word, count));
 
   Token* token = static_cast<Token*>(TokenHash::add(word));
   if (token)
   {
     token->mCount += count; // hash code initializes this to zero
-    PR_LOG(BayesianFilterLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(BayesianFilterLogModule, LogLevel::Debug,
            ("adding word to tokenizer: %s (count=%d) (mCount=%d)",
            word, count, token->mCount));
   }
   return token;
 }
 
 static bool isDecimalNumber(const char* word)
 {
@@ -688,17 +690,17 @@ static bool isFWNumeral(const char16_t* 
       return false;
 
   return true;
 }
 
 // The japanese tokenizer was added as part of Bug #277354
 void Tokenizer::tokenize_japanese_word(char* chunk)
 {
-  PR_LOG(BayesianFilterLogModule, PR_LOG_DEBUG, ("entering tokenize_japanese_word(%s)", chunk));
+  MOZ_LOG(BayesianFilterLogModule, LogLevel::Debug, ("entering tokenize_japanese_word(%s)", chunk));
 
   nsString srcStr = NS_ConvertUTF8toUTF16(chunk);
   const char16_t* p1 = srcStr.get();
   const char16_t* p2 = p1;
   if(!*p2) return;
 
   char_class cc = getCharClass(*p2);
   while(*(++p2))
@@ -728,17 +730,17 @@ nsresult Tokenizer::stripHTML(const nsAS
                  | nsIDocumentEncoder::OutputBodyOnly;
   nsCOMPtr<nsIParserUtils> utils =
     do_GetService(NS_PARSERUTILS_CONTRACTID);
   return utils->ConvertToPlainText(inString, flags, 80, outString);
 }
 
 void Tokenizer::tokenize(const char* aText)
 {
-  PR_LOG(BayesianFilterLogModule, PR_LOG_DEBUG, ("tokenize: %s", aText));
+  MOZ_LOG(BayesianFilterLogModule, LogLevel::Debug, ("tokenize: %s", aText));
 
   // strip out HTML tags before we begin processing
   // uggh but first we have to blow up our string into UCS2
   // since that's what the document encoder wants. UTF8/UCS2, I wish we all
   // spoke the same language here..
   nsString text = NS_ConvertUTF8toUTF16(aText);
   nsString strippedUCS2;
 
@@ -764,17 +766,17 @@ void Tokenizer::tokenize(const char* aTe
   while (substr_start != substr_end) {
     if (*substr_start == 0x3000)
         *substr_start = 0x0020;
     ++substr_start;
   }
 
   nsCString strippedStr = NS_ConvertUTF16toUTF8(strippedUCS2);
   char * strippedText = strippedStr.BeginWriting();
-  PR_LOG(BayesianFilterLogModule, PR_LOG_DEBUG, ("tokenize stripped html: %s", strippedText));
+  MOZ_LOG(BayesianFilterLogModule, LogLevel::Debug, ("tokenize stripped html: %s", strippedText));
 
   char* word;
   char* next = strippedText;
   while ((word = NS_strtok(mBodyDelimiters.get(), &next)) != NULL) {
     if (!*word) continue;
     if (isDecimalNumber(word)) continue;
     if (isASCII(word))
         tokenize_ascii_word(word);
@@ -1108,17 +1110,17 @@ NS_IMETHODIMP TokenStreamListener::OnSto
 {
     if (mLeftOverCount) {
         /* assume final buffer is complete. */
         mBuffer[mLeftOverCount] = '\0';
         mTokenizer.tokenize(mBuffer);
     }
 
     /* finally, analyze the tokenized message. */
-    PR_LOG(BayesianFilterLogModule, PR_LOG_DEBUG, ("analyze the tokenized message"));
+    MOZ_LOG(BayesianFilterLogModule, LogLevel::Debug, ("analyze the tokenized message"));
     if (mAnalyzer)
         mAnalyzer->analyzeTokens(mTokenizer);
 
     return NS_OK;
 }
 
 /* Implementation file */
 
@@ -1137,17 +1139,17 @@ nsBayesianFilter::nsBayesianFilter()
     nsCOMPtr<nsIPrefBranch> pPrefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID, &rv));
     if (pPrefBranch)
       pPrefBranch->GetIntPref("mail.adaptivefilters.junk_threshold", &junkThreshold);
 
     mJunkProbabilityThreshold = (static_cast<double>(junkThreshold)) / 100.0;
     if (mJunkProbabilityThreshold == 0 || mJunkProbabilityThreshold >= 1)
       mJunkProbabilityThreshold = kDefaultJunkThreshold;
 
-    PR_LOG(BayesianFilterLogModule, PR_LOG_WARNING, ("junk probability threshold: %f", mJunkProbabilityThreshold));
+    MOZ_LOG(BayesianFilterLogModule, LogLevel::Warning, ("junk probability threshold: %f", mJunkProbabilityThreshold));
 
     mCorpus.readTrainingData();
 
     // get parameters for training data flushing, from the prefs
 
     nsCOMPtr<nsIPrefBranch> prefBranch;
 
     nsCOMPtr<nsIPrefService> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
@@ -1158,17 +1160,17 @@ nsBayesianFilter::nsBayesianFilter()
     rv = prefBranch->GetIntPref("mailnews.bayesian_spam_filter.flush.minimum_interval",&mMinFlushInterval);
     // it is not a good idea to allow a minimum interval of under 1 second
     if (NS_FAILED(rv) || (mMinFlushInterval <= 1000) )
         mMinFlushInterval = DEFAULT_MIN_INTERVAL_BETWEEN_WRITES;
 
     rv = prefBranch->GetIntPref("mailnews.bayesian_spam_filter.junk_maxtokens", &mMaximumTokenCount);
     if (NS_FAILED(rv))
       mMaximumTokenCount = 0; // which means do not limit token counts
-    PR_LOG(BayesianFilterLogModule, PR_LOG_WARNING, ("maximum junk tokens: %d", mMaximumTokenCount));
+    MOZ_LOG(BayesianFilterLogModule, LogLevel::Warning, ("maximum junk tokens: %d", mMaximumTokenCount));
 
     mTimer = do_CreateInstance(NS_TIMER_CONTRACTID, &rv);
     NS_ASSERTION(NS_SUCCEEDED(rv), "unable to create a timer; training data will only be written on exit");
 
     // the timer is not used on object construction, since for
     // the time being there are no dirying messages
 
     // give a default capacity to the memory structure used to store
@@ -1288,17 +1290,17 @@ public:
         tokenizer.clearTokens();
         classifyNextMessage();
     }
 
     virtual void classifyNextMessage()
     {
 
       if (++mCurMessageToClassify < mNumMessagesToClassify && mMessageURIs[mCurMessageToClassify]) {
-        PR_LOG(BayesianFilterLogModule, PR_LOG_WARNING, ("classifyNextMessage(%s)", mMessageURIs[mCurMessageToClassify]));
+        MOZ_LOG(BayesianFilterLogModule, LogLevel::Warning, ("classifyNextMessage(%s)", mMessageURIs[mCurMessageToClassify]));
         mFilter->tokenizeMessage(mMessageURIs[mCurMessageToClassify], mMsgWindow, this);
       }
       else
       {
         // call all listeners with null parameters to signify end of batch
         if (mJunkListener)
           mJunkListener->OnMessageClassified(nullptr, nsIJunkMailPlugin::UNCLASSIFIED, 0);
         if (mTraitListener)
@@ -1446,17 +1448,17 @@ void nsBayesianFilter::classifyMessage(
       antiAliasArrays.SetCapacity(traitCount);
     }
 
     nsresult rv;
     nsCOMPtr<nsIMsgTraitService> traitService(do_GetService("@mozilla.org/msg-trait-service;1", &rv));
     if (NS_FAILED(rv))
     {
       NS_ERROR("Failed to get trait service");
-      PR_LOG(BayesianFilterLogModule, PR_LOG_ERROR, ("Failed to get trait service"));
+      MOZ_LOG(BayesianFilterLogModule, LogLevel::Error, ("Failed to get trait service"));
     }
 
     // get aliases and message counts for the pro and anti traits
     for (uint32_t traitIndex = 0; traitIndex < traitCount; traitIndex++)
     {
       nsresult rv;
 
       // pro trait
@@ -1464,17 +1466,17 @@ void nsBayesianFilter::classifyMessage(
       uint32_t* proAliases = nullptr;
       uint32_t proTrait = aProTraits[traitIndex];
       if (traitService)
       {
         rv = traitService->GetAliases(proTrait, &proAliasesLength, &proAliases);
         if (NS_FAILED(rv))
         {
           NS_ERROR("trait service failed to get aliases");
-          PR_LOG(BayesianFilterLogModule, PR_LOG_ERROR, ("trait service failed to get aliases"));
+          MOZ_LOG(BayesianFilterLogModule, LogLevel::Error, ("trait service failed to get aliases"));
         }
       }
       proAliasesLengths.AppendElement(proAliasesLength);
       proAliasArrays.AppendElement(proAliases);
       uint32_t proMessageCount = mCorpus.getMessageCount(proTrait);
       for (uint32_t aliasIndex = 0; aliasIndex < proAliasesLength; aliasIndex++)
         proMessageCount += mCorpus.getMessageCount(proAliases[aliasIndex]);
       numProMessages.AppendElement(proMessageCount);
@@ -1484,17 +1486,17 @@ void nsBayesianFilter::classifyMessage(
       uint32_t* antiAliases = nullptr;
       uint32_t antiTrait = aAntiTraits[traitIndex];
       if (traitService)
       {
         rv = traitService->GetAliases(antiTrait, &antiAliasesLength, &antiAliases);
         if (NS_FAILED(rv))
         {
           NS_ERROR("trait service failed to get aliases");
-          PR_LOG(BayesianFilterLogModule, PR_LOG_ERROR, ("trait service failed to get aliases"));
+          MOZ_LOG(BayesianFilterLogModule, LogLevel::Error, ("trait service failed to get aliases"));
         }
       }
       antiAliasesLengths.AppendElement(antiAliasesLength);
       antiAliasArrays.AppendElement(antiAliases);
       uint32_t antiMessageCount = mCorpus.getMessageCount(antiTrait);
       for (uint32_t aliasIndex = 0; aliasIndex < antiAliasesLength; aliasIndex++)
         antiMessageCount += mCorpus.getMessageCount(antiAliases[aliasIndex]);
       numAntiMessages.AppendElement(antiMessageCount);
@@ -1604,17 +1606,17 @@ void nsBayesianFilter::classifyMessage(
             S = frexp(S, &e);
             Sexp += e;
           }
           if ( H < 1e-200 )
           {
             H = frexp(H, &e);
             Hexp += e;
           }
-          PR_LOG(BayesianFilterLogModule, PR_LOG_WARNING,
+          MOZ_LOG(BayesianFilterLogModule, LogLevel::Warning,
                  ("token probability (%s) is %f",
                   tokens[ta.mTokenIndex].mWord, ta.mProbability));
         }
         if (aDetailListener)
         {
           sArray.AppendElement(log(S) + Sexp * M_LN2);
           hArray.AppendElement(log(H) + Hexp * M_LN2);
         }
@@ -1677,17 +1679,17 @@ void nsBayesianFilter::classifyMessage(
       }
 
       uint32_t proPercent = static_cast<uint32_t>(prob*100. + .5);
 
       // directly classify junk to maintain backwards compatibility
       if (aProTraits[traitIndex] == kJunkTrait)
       {
         bool isJunk = (prob >= mJunkProbabilityThreshold);
-        PR_LOG(BayesianFilterLogModule, PR_LOG_ALWAYS,
+        MOZ_LOG(BayesianFilterLogModule, LogLevel::Info,
                ("%s is junk probability = (%f)  HAM SCORE:%f SPAM SCORE:%f",
                 messageURI, prob,H,S));
 
         // the algorithm in "A Plan For Spam" assumes that you have a large good
         // corpus and a large junk corpus.
         // that won't be the case with users who first use the junk mail trait
         // so, we do certain things to encourage them to train.
         //
@@ -2048,18 +2050,18 @@ void nsBayesianFilter::observeMessage(
       aTraitListener->OnMessageTraitsClassified(messageURL,
           traits.Length(), traits.Elements(), percents.Elements());
     }
 
     if (mTrainingDataDirty && !trainingDataWasDirty && ( mTimer != nullptr ))
     {
         // if training data became dirty just now, schedule flush
         // mMinFlushInterval msec from now
-        PR_LOG(
-            BayesianFilterLogModule, PR_LOG_DEBUG,
+        MOZ_LOG(
+            BayesianFilterLogModule, LogLevel::Debug,
             ("starting training data flush timer %i msec", mMinFlushInterval));
         mTimer->InitWithFuncCallback(nsBayesianFilter::TimerCallback, this, mMinFlushInterval, nsITimer::TYPE_ONE_SHOT);
     }
 }
 
 NS_IMETHODIMP nsBayesianFilter::GetUserHasClassified(bool *aResult)
 {
   *aResult = (  (mCorpus.getMessageCount(kGoodTrait) +
@@ -2371,17 +2373,17 @@ nsresult CorpusStore::getTraitFile(nsIFi
 
 static const char kMagicCookie[] = { '\xFE', '\xED', '\xFA', '\xCE' };
 
 // random string used to identify trait file and version (last byte is version)
 static const char kTraitCookie[] = { '\xFC', '\xA9', '\x36', '\x01' };
 
 void CorpusStore::writeTrainingData(uint32_t aMaximumTokenCount)
 {
-  PR_LOG(BayesianFilterLogModule, PR_LOG_DEBUG, ("writeTrainingData() entered"));
+  MOZ_LOG(BayesianFilterLogModule, LogLevel::Debug, ("writeTrainingData() entered"));
   if (!mTrainingFile)
     return;
 
   /*
    * For backwards compatibility, write the good and junk tokens to
    * training.dat; additional traits are added to a different file
    */
 
@@ -2392,17 +2394,17 @@ void CorpusStore::writeTrainingData(uint
     return;
 
   // If the number of tokens exceeds our limit, set the shrink flag
   bool shrink = false;
   if ((aMaximumTokenCount > 0) && // if 0, do not limit tokens
       (countTokens() > aMaximumTokenCount))
   {
     shrink = true;
-    PR_LOG(BayesianFilterLogModule, PR_LOG_WARNING, ("shrinking token data file"));
+    MOZ_LOG(BayesianFilterLogModule, LogLevel::Warning, ("shrinking token data file"));
   }
 
   // We implement shrink by dividing counts by two
   uint32_t shrinkFactor = shrink ? 2 : 1;
 
   if (!((fwrite(kMagicCookie, sizeof(kMagicCookie), 1, stream) == 1) &&
       (writeUInt32(stream, getMessageCount(kGoodTrait) / shrinkFactor)) &&
       (writeUInt32(stream, getMessageCount(kJunkTrait) / shrinkFactor)) &&
@@ -2513,17 +2515,17 @@ void CorpusStore::readTrainingData()
   uint32_t goodMessageCount, junkMessageCount;
   if (!((fread(cookie, sizeof(cookie), 1, stream) == 1) &&
         (memcmp(cookie, kMagicCookie, sizeof(cookie)) == 0) &&
         (readUInt32(stream, &goodMessageCount) == 1) &&
         (readUInt32(stream, &junkMessageCount) == 1) &&
          readTokens(stream, fileSize, kGoodTrait, true) &&
          readTokens(stream, fileSize, kJunkTrait, true))) {
       NS_WARNING("failed to read training data.");
-      PR_LOG(BayesianFilterLogModule, PR_LOG_ERROR, ("failed to read training data."));
+      MOZ_LOG(BayesianFilterLogModule, LogLevel::Error, ("failed to read training data."));
   }
   setMessageCount(kGoodTrait, goodMessageCount);
   setMessageCount(kJunkTrait, junkMessageCount);
 
   fclose(stream);
 
   /*
    * Additional traits are stored in traits.dat
@@ -2540,17 +2542,17 @@ void CorpusStore::readTrainingData()
   if (NS_FAILED(rv) || !exists)
     return;
 
   rv = UpdateData(mTraitFile, true, 0, nullptr, nullptr);
 
   if (NS_FAILED(rv))
   {
     NS_WARNING("failed to read training data.");
-    PR_LOG(BayesianFilterLogModule, PR_LOG_ERROR, ("failed to read training data."));
+    MOZ_LOG(BayesianFilterLogModule, LogLevel::Error, ("failed to read training data."));
   }
   return;
 }
 
 nsresult CorpusStore::resetTrainingData()
 {
   // clear out our in memory training tokens...
   if (countTokens())
@@ -2640,27 +2642,27 @@ uint32_t CorpusStore::getTraitCount(Corp
   // trait not found (or error), so count is zero
   return 0;
 }
 
 CorpusToken* CorpusStore::add(const char* word, uint32_t aTraitId, uint32_t aCount)
 {
   CorpusToken* token = static_cast<CorpusToken*>(TokenHash::add(word));
   if (token) {
-    PR_LOG(BayesianFilterLogModule, PR_LOG_DEBUG,
+    MOZ_LOG(BayesianFilterLogModule, LogLevel::Debug,
            ("adding word to corpus store: %s (Trait=%d) (deltaCount=%d)",
             word, aTraitId, aCount));
     updateTrait(token, aTraitId, aCount);
   }
   return token;
  }
 
 void CorpusStore::remove(const char* word, uint32_t aTraitId, uint32_t aCount)
 {
-  PR_LOG(BayesianFilterLogModule, PR_LOG_DEBUG,
+  MOZ_LOG(BayesianFilterLogModule, LogLevel::Debug,
          ("remove word: %s (TraitId=%d) (Count=%d)",
          word, aTraitId, aCount));
   CorpusToken* token = get(word);
   if (token)
     updateTrait(token, aTraitId, -static_cast<int32_t>(aCount));
 }
 
 uint32_t CorpusStore::getMessageCount(uint32_t aTraitId)
--- a/mailnews/imap/src/nsAutoSyncManager.cpp
+++ b/mailnews/imap/src/nsAutoSyncManager.cpp
@@ -15,16 +15,19 @@
 #include "nsMsgFolderFlags.h"
 #include "nsImapIncomingServer.h"
 #include "nsMsgUtils.h"
 #include "nsIIOService.h"
 #include "nsComponentManagerUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/Services.h"
 #include "nsArrayUtils.h"
+#include "mozilla/Logging.h"
+
+using namespace mozilla;
 
 NS_IMPL_ISUPPORTS(nsDefaultAutoSyncMsgStrategy, nsIAutoSyncMsgStrategy)
 
 const char* kAppIdleNotification = "mail:appIdle";
 const char* kStartupDoneNotification = "mail-startup-done";
 PRLogModuleInfo *gAutoSyncLog;
 
 // recommended size of each group of messages per download
@@ -531,25 +534,25 @@ NS_IMETHODIMP nsAutoSyncManager::OnStopR
 
   return aExitCode;
 }
 
 NS_IMETHODIMP nsAutoSyncManager::Pause()
 {
   StopTimer();
   mPaused = true;
-  PR_LOG(gAutoSyncLog, PR_LOG_DEBUG, ("autosync paused\n"));
+  MOZ_LOG(gAutoSyncLog, LogLevel::Debug, ("autosync paused\n"));
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAutoSyncManager::Resume()
 {
   mPaused = false;
   StartTimerIfNeeded();
-  PR_LOG(gAutoSyncLog, PR_LOG_DEBUG, ("autosync resumed\n"));
+  MOZ_LOG(gAutoSyncLog, LogLevel::Debug, ("autosync resumed\n"));
   return NS_OK;
 }
 
 NS_IMETHODIMP nsAutoSyncManager::Observe(nsISupports*, const char *aTopic, const char16_t *aSomeData)
 {
   if (!PL_strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
   {
     nsCOMPtr<nsIObserverService> observerService =
--- a/mailnews/imap/src/nsAutoSyncState.cpp
+++ b/mailnews/imap/src/nsAutoSyncState.cpp
@@ -9,16 +9,19 @@
 #include "nsMsgKeyArray.h"
 #include "nsIMsgWindow.h"
 #include "nsIMsgMailSession.h"
 #include "nsMsgFolderFlags.h"
 #include "nsIAutoSyncManager.h"
 #include "nsIAutoSyncMsgStrategy.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
+#include "mozilla/Logging.h"
+
+using namespace mozilla;
 
 extern PRLogModuleInfo *gAutoSyncLog;
 
 MsgStrategyComparatorAdaptor::MsgStrategyComparatorAdaptor(nsIAutoSyncMsgStrategy* aStrategy, 
   nsIMsgFolder *aFolder, nsIMsgDatabase *aDatabase) : mStrategy(aStrategy), mFolder(aFolder), 
     mDatabase(aDatabase)
 {
 }
@@ -357,17 +360,17 @@ NS_IMETHODIMP nsAutoSyncState::ProcessEx
     folder->HasMsgOffline(mExistingHeadersQ[mProcessPointer], &hasMessageOffline);
     if (!hasMessageOffline)
       msgKeys.AppendElement(mExistingHeadersQ[mProcessPointer]);
   }
   if (!msgKeys.IsEmpty())
   {
     nsCString folderName;
     folder->GetURI(folderName);
-    PR_LOG(gAutoSyncLog, PR_LOG_DEBUG,
+    MOZ_LOG(gAutoSyncLog, LogLevel::Debug,
           ("%d messages will be added into the download q of folder %s\n",
             msgKeys.Length(), folderName.get()));
 
     rv = PlaceIntoDownloadQ(msgKeys);
     if (NS_FAILED(rv))
       mProcessPointer = lastIdx;
   }
 
@@ -441,20 +444,20 @@ NS_IMETHODIMP nsAutoSyncState::OnStopRun
     imapFolder->GetServerUnseen(&serverUnseen);
     imapFolder->GetServerRecent(&serverRecent);
     imapFolder->GetServerNextUID(&serverNextUID);
     if (serverNextUID != mLastNextUID || serverTotal != mLastServerTotal ||
         serverUnseen != mLastServerUnseen || serverRecent != mLastServerRecent)
     {
       nsCString folderName;
       ownerFolder->GetURI(folderName);
-      PR_LOG(gAutoSyncLog, PR_LOG_DEBUG,
+      MOZ_LOG(gAutoSyncLog, LogLevel::Debug,
              ("folder %s status changed serverNextUID = %lx lastNextUID = %lx\n", folderName.get(),
               serverNextUID, mLastNextUID));
-      PR_LOG(gAutoSyncLog, PR_LOG_DEBUG,
+      MOZ_LOG(gAutoSyncLog, LogLevel::Debug,
              ("serverTotal = %lx lastServerTotal = %lx serverRecent = %lx lastServerRecent = %lx\n",
               serverTotal, mLastServerTotal, serverRecent, mLastServerRecent));
       SetServerCounts(serverTotal, serverRecent, serverUnseen, serverNextUID);
       SetState(nsAutoSyncState::stUpdateIssued);
       return imapFolder->UpdateFolderWithListener(nullptr, autoSyncMgrListener);
     }
     else
     {
@@ -637,17 +640,17 @@ NS_IMETHODIMP nsAutoSyncState::DownloadM
   nsCOMPtr <nsIMsgFolder> folder = do_QueryReferent(mOwnerFolder, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
   
   rv = folder->AcquireSemaphore(folder);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCString folderName;
   folder->GetURI(folderName);
-  PR_LOG(gAutoSyncLog, PR_LOG_DEBUG, ("downloading %s for %s", messageIds.get(),
+  MOZ_LOG(gAutoSyncLog, LogLevel::Debug, ("downloading %s for %s", messageIds.get(),
            folderName.get()));
   // start downloading
   rv = imapService->DownloadMessagesForOffline(messageIds, 
                                                folder, 
                                                this, 
                                                nullptr);
   if (NS_SUCCEEDED(rv))
     SetState(stDownloadInProgress);                                              
@@ -706,21 +709,21 @@ void nsAutoSyncState::LogQWithSize(nsTAr
     {
       x--;
       nsCOMPtr<nsIMsgDBHdr> h;
       database->GetMsgHdrForKey(q[x], getter_AddRefs(h));
       uint32_t s;
       if (h)
       {
         h->GetMessageSize(&s);
-        PR_LOG(gAutoSyncLog, PR_LOG_DEBUG,
+        MOZ_LOG(gAutoSyncLog, LogLevel::Debug,
               ("Elem #%d, size: %u bytes\n", x+1, s));
       }
       else
-        PR_LOG(gAutoSyncLog, PR_LOG_DEBUG, ("unable to get header for key %ul", q[x]));
+        MOZ_LOG(gAutoSyncLog, LogLevel::Debug, ("unable to get header for key %ul", q[x]));
     }
   }
 }
 
 void nsAutoSyncState::LogQWithSize(nsIMutableArray *q, uint32_t toOffset)
 {
   nsCOMPtr <nsIMsgFolder> ownerFolder = do_QueryReferent(mOwnerFolder);
   if (ownerFolder)
@@ -735,28 +738,28 @@ void nsAutoSyncState::LogQWithSize(nsIMu
       x--;
       nsCOMPtr<nsIMsgDBHdr> h;
       q->QueryElementAt(x, NS_GET_IID(nsIMsgDBHdr),
                         getter_AddRefs(h));
       uint32_t s;
       if (h)
       {
         h->GetMessageSize(&s);
-        PR_LOG(gAutoSyncLog, PR_LOG_DEBUG,
+        MOZ_LOG(gAutoSyncLog, LogLevel::Debug,
               ("Elem #%d, size: %u bytes\n", x+1, s));
       }
       else
-        PR_LOG(gAutoSyncLog, PR_LOG_DEBUG, ("null header in q at index %ul", x));
+        MOZ_LOG(gAutoSyncLog, LogLevel::Debug, ("null header in q at index %ul", x));
     }
   }
 }
 
 void nsAutoSyncState::LogOwnerFolderName(const char *s)
 {
   nsCOMPtr <nsIMsgFolder> ownerFolder = do_QueryReferent(mOwnerFolder);
   if (ownerFolder)
   {
     nsCString folderName;
     ownerFolder->GetURI(folderName);
-    PR_LOG(gAutoSyncLog, PR_LOG_DEBUG,
+    MOZ_LOG(gAutoSyncLog, LogLevel::Debug,
            ("*** %s Folder: %s ***\n", s, folderName.get()));
   }
 }
--- a/mailnews/imap/src/nsIMAPBodyShell.cpp
+++ b/mailnews/imap/src/nsIMAPBodyShell.cpp
@@ -179,17 +179,17 @@ void nsIMAPBodyShell::FlushPrefetchQueue
 
 // Requires that the shell is valid when called
 // Performs a preflight check on all message parts to see if they are all
 // inline.  Returns true if all parts are inline, false otherwise.
 bool nsIMAPBodyShell::PreflightCheckAllInline()
 {
   bool rv = m_message->PreflightCheckAllInline(this);
   //	if (rv)
-  //		PR_LOG(IMAP, out, ("BODYSHELL: All parts inline.  Reverting to whole message download."));
+  //		MOZ_LOG(IMAP, out, ("BODYSHELL: All parts inline.  Reverting to whole message download."));
   return rv;
 }
 
 // When partNum is NULL, Generates a whole message and intelligently
 // leaves out parts that are not inline.
 
 // When partNum is not NULL, Generates a MIME part that hasn't been downloaded yet
 // Ok, here's how we're going to do this.  Essentially, this
@@ -327,17 +327,17 @@ nsIMAPBodypart::~nsIMAPBodypart()
   PR_FREEIF(m_boundaryData);
 }
 
 void nsIMAPBodypart::SetIsValid(bool valid)
 {
   m_isValid = valid;
   if (!m_isValid)
   {
-    //PR_LOG(IMAP, out, ("BODYSHELL: Part is invalid.  Part Number: %s Content-Type: %s", m_partNumberString, m_contentType));
+    //MOZ_LOG(IMAP, out, ("BODYSHELL: Part is invalid.  Part Number: %s Content-Type: %s", m_partNumberString, m_contentType));
   }
 }
 
 // Adopts storage for part data buffer.  If NULL, sets isValid to false.
 void nsIMAPBodypart::AdoptPartDataBuffer(char *buf)
 {
   m_partData = buf;
   if (!m_partData)
--- a/mailnews/imap/src/nsImapMailFolder.cpp
+++ b/mailnews/imap/src/nsImapMailFolder.cpp
@@ -88,16 +88,17 @@
 #include "nsAutoSyncManager.h"
 #include "nsIMsgFilterCustomAction.h"
 #include "nsMsgReadStateTxn.h"
 #include "nsIStringEnumerator.h"
 #include "nsIMsgStatusFeedback.h"
 #include "nsAlgorithm.h"
 #include "nsMsgLineBuffer.h"
 #include <algorithm>
+#include "mozilla/Logging.h"
 
 static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
 static NS_DEFINE_CID(kParseMailMsgStateCID, NS_PARSEMAILMSGSTATE_CID);
 static NS_DEFINE_CID(kCImapHostSessionList, NS_IIMAPHOSTSESSIONLIST_CID);
 
 extern PRLogModuleInfo *gAutoSyncLog;
 extern PRLogModuleInfo* IMAP;
 
@@ -3208,61 +3209,61 @@ NS_IMETHODIMP nsImapMailFolder::BeginCop
   nsresult rv;
   if (m_copyState->m_tmpFile) // leftover file spec nuke it
   {
     rv = m_copyState->m_tmpFile->Remove(false);
     if (NS_FAILED(rv))
     {
       nsCString nativePath;
       m_copyState->m_tmpFile->GetNativePath(nativePath);
-      PR_LOG(IMAP, PR_LOG_ALWAYS, ("couldn't remove prev temp file %s: %lx\n", nativePath.get(), rv));
+      MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("couldn't remove prev temp file %s: %lx\n", nativePath.get(), rv));
     }
     m_copyState->m_tmpFile = nullptr;
   }
   if (message)
     m_copyState->m_message = do_QueryInterface(message, &rv);
 
   rv = GetSpecialDirectoryWithFileName(NS_OS_TEMP_DIR,
                                        "nscpmsg.txt",
                                         getter_AddRefs(m_copyState->m_tmpFile));
   if (NS_FAILED(rv))
-    PR_LOG(IMAP, PR_LOG_ALWAYS, ("couldn't find nscpmsg.txt:%lx\n", rv));
+    MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("couldn't find nscpmsg.txt:%lx\n", rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // create a unique file, since multiple copies may be open on multiple folders
   rv = m_copyState->m_tmpFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 00600);
   if (NS_FAILED(rv))
   {
-    PR_LOG(IMAP, PR_LOG_ALWAYS, ("couldn't create temp nscpmsg.txt:%lx\n", rv));
+    MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("couldn't create temp nscpmsg.txt:%lx\n", rv));
     // Last ditch attempt to create a temp file, because virus checker might
     // be locking the previous temp file, and CreateUnique fails if the file
     // is locked. Use the message key to make a unique name.
     if (message)
     {
       nsCString tmpFileName("nscpmsg-");
       nsMsgKey msgKey;
       message->GetMessageKey(&msgKey);
       tmpFileName.AppendInt(msgKey);
       tmpFileName.Append(".txt");
       m_copyState->m_tmpFile->SetNativeLeafName(tmpFileName);
       rv = m_copyState->m_tmpFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 00600);
       if (NS_FAILED(rv))
       {
-        PR_LOG(IMAP, PR_LOG_ALWAYS, ("couldn't create temp nscpmsg.txt:%lx\n", rv));
+        MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("couldn't create temp nscpmsg.txt:%lx\n", rv));
         OnCopyCompleted(m_copyState->m_srcSupport, rv);
         return rv;
       }
     }
   }
 
   nsCOMPtr<nsIOutputStream> fileOutputStream;
   rv = MsgNewBufferedFileOutputStream(getter_AddRefs(m_copyState->m_msgFileStream),
                                       m_copyState->m_tmpFile, -1, 00600);
   if (NS_FAILED(rv))
-    PR_LOG(IMAP, PR_LOG_ALWAYS, ("couldn't create output file stream:%lx\n", rv));
+    MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("couldn't create output file stream:%lx\n", rv));
 
   if (!m_copyState->m_dataBuffer)
     m_copyState->m_dataBuffer = (char*) PR_CALLOC(COPY_BUFFER_SIZE+1);
   NS_ENSURE_TRUE(m_copyState->m_dataBuffer, NS_ERROR_OUT_OF_MEMORY);
   m_copyState->m_dataBufferSize = COPY_BUFFER_SIZE;
   return NS_OK;
 }
 
@@ -3350,17 +3351,17 @@ NS_IMETHODIMP nsImapMailFolder::CopyData
 // sICopyMessageListener methods, BeginCopy, CopyData, EndCopy, EndMove, StartMessage, EndMessage
 NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream, int32_t aLength)
 {
   NS_ENSURE_TRUE(m_copyState && m_copyState->m_msgFileStream && m_copyState->m_dataBuffer, NS_ERROR_NULL_POINTER);
   nsresult rv = CopyDataToOutputStreamForAppend(aIStream, aLength,
                                                 m_copyState->m_msgFileStream);
   if (NS_FAILED(rv))
   {
-    PR_LOG(IMAP, PR_LOG_ALWAYS, ("CopyData failed:%lx\n", rv));
+    MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("CopyData failed:%lx\n", rv));
     OnCopyCompleted(m_copyState->m_srcSupport, rv);
   }
   return rv;
 }
 
 NS_IMETHODIMP nsImapMailFolder::EndCopy(bool copySucceeded)
 {
   nsresult rv = copySucceeded ? NS_OK : NS_ERROR_FAILURE;
@@ -3382,17 +3383,17 @@ NS_IMETHODIMP nsImapMailFolder::EndCopy(
     rv = imapService->AppendMessageFromFile(m_copyState->m_tmpFile,
                                             this, EmptyCString(), true,
                                             m_copyState->m_selectedState,
                                             urlListener, nullptr,
                                             copySupport,
                                             m_copyState->m_msgWindow);
   }
   if (NS_FAILED(rv) || !copySucceeded)
-    PR_LOG(IMAP, PR_LOG_ALWAYS, ("EndCopy failed:%lx\n", rv));
+    MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("EndCopy failed:%lx\n", rv));
   return rv;
 }
 
 NS_IMETHODIMP nsImapMailFolder::EndMove(bool moveSucceeded)
 {
   return NS_OK;
 }
 // this is the beginning of the next message copied
@@ -4620,17 +4621,17 @@ nsImapMailFolder::NormalEndMsgWriteStrea
   if (updatedMessageSize != -1) {
     // retrieve the message header to update size, if we don't already have it
     nsCOMPtr<nsIMsgDBHdr> msgHeader = m_offlineHeader;
     if (!msgHeader)
       GetMessageHeader(uidOfMessage, getter_AddRefs(msgHeader));
     if (msgHeader) {
       uint32_t msgSize;
       msgHeader->GetMessageSize(&msgSize);
-      PR_LOG(IMAP, PR_LOG_DEBUG, ("Updating stored message size from %u, new size %d",
+      MOZ_LOG(IMAP, mozilla::LogLevel::Debug, ("Updating stored message size from %u, new size %d",
                                   msgSize, updatedMessageSize));
       msgHeader->SetMessageSize(updatedMessageSize);
       // only commit here if this isn't an offline message
       // offline header gets committed in EndNewOfflineMessage() called below
       if (mDatabase && !m_offlineHeader)
         mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
     }
     else
@@ -6770,40 +6771,40 @@ nsImapMailFolder::CopyNextStreamMessage(
   //if copy has failed it could be either user interrupted it or for some other reason
   //don't do any subsequent copies or delete src messages if it is move
   if (!copySucceeded)
     return NS_OK;
   nsresult rv;
   nsCOMPtr<nsImapMailCopyState> mailCopyState = do_QueryInterface(copyState, &rv);
   if (NS_FAILED(rv))
   {
-    PR_LOG(IMAP, PR_LOG_ALWAYS, ("QI copyState failed:%lx\n", rv));
+    MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("QI copyState failed:%lx\n", rv));
     return rv; // this can fail...
   }
 
   if (!mailCopyState->m_streamCopy)
     return NS_OK;
 
-  PR_LOG(IMAP, PR_LOG_ALWAYS, ("CopyNextStreamMessage: Copying %ld of %ld\n", mailCopyState->m_curIndex, mailCopyState->m_totalCount));
+  MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("CopyNextStreamMessage: Copying %ld of %ld\n", mailCopyState->m_curIndex, mailCopyState->m_totalCount));
   if (mailCopyState->m_curIndex < mailCopyState->m_totalCount)
   {
     mailCopyState->m_message = do_QueryElementAt(mailCopyState->m_messages,
                                                  mailCopyState->m_curIndex,
                                                  &rv);
     if (NS_SUCCEEDED(rv))
     {
       bool isRead;
       mailCopyState->m_message->GetIsRead(&isRead);
       mailCopyState->m_unreadCount = (isRead) ? 0 : 1;
       rv = CopyStreamMessage(mailCopyState->m_message,
                              this, mailCopyState->m_msgWindow, mailCopyState->m_isMove);
     }
     else
     {
-      PR_LOG(IMAP, PR_LOG_ALWAYS, ("QueryElementAt %ld failed:%lx\n", mailCopyState->m_curIndex, rv));
+      MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("QueryElementAt %ld failed:%lx\n", mailCopyState->m_curIndex, rv));
     }
   }
   else
   {
     // Notify of move/copy completion in case we have some source headers
     nsCOMPtr<nsIMsgFolderNotificationService> notifier(do_GetService(NS_MSGNOTIFICATIONSERVICE_CONTRACTID));
     if (notifier)
     {
@@ -8145,32 +8146,32 @@ nsImapMailFolder::CopyFileMessage(nsIFil
 
 nsresult
 nsImapMailFolder::CopyStreamMessage(nsIMsgDBHdr* message,
                                     nsIMsgFolder* dstFolder, // should be this
                                     nsIMsgWindow *aMsgWindow,
                                     bool isMove)
 {
   if (!m_copyState)
-    PR_LOG(IMAP, PR_LOG_ALWAYS, ("CopyStreamMessage failed with null m_copyState"));
+    MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("CopyStreamMessage failed with null m_copyState"));
   NS_ENSURE_TRUE(m_copyState, NS_ERROR_NULL_POINTER);
   nsresult rv;
   nsCOMPtr<nsICopyMessageStreamListener> copyStreamListener = do_CreateInstance(NS_COPYMESSAGESTREAMLISTENER_CONTRACTID, &rv);
   NS_ENSURE_SUCCESS(rv,rv);
 
   nsCOMPtr<nsICopyMessageListener> copyListener(do_QueryInterface(dstFolder, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIMsgFolder> srcFolder(do_QueryInterface(m_copyState->m_srcSupport, &rv));
   if (NS_FAILED(rv))
-    PR_LOG(IMAP, PR_LOG_ALWAYS, ("CopyStreaMessage failed with null m_copyState->m_srcSupport"));
+    MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("CopyStreaMessage failed with null m_copyState->m_srcSupport"));
   if (NS_FAILED(rv)) return rv;
   rv = copyStreamListener->Init(srcFolder, copyListener, nullptr);
   if (NS_FAILED(rv))
-    PR_LOG(IMAP, PR_LOG_ALWAYS, ("CopyStreaMessage failed in copyStreamListener->Init"));
+    MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("CopyStreaMessage failed in copyStreamListener->Init"));
   if (NS_FAILED(rv)) return rv;
 
   nsCOMPtr<nsIMsgDBHdr> msgHdr(do_QueryInterface(message, &rv));
   if (NS_FAILED(rv)) return rv;
 
   nsCString uri;
   srcFolder->GetUriForMsg(msgHdr, uri);
 
@@ -8212,17 +8213,17 @@ nsImapMailFolder::CopyStreamMessage(nsIM
         int32_t percent;
         percent = (100 * m_copyState->m_curIndex) / (int32_t) m_copyState->m_totalCount;
           statusFeedback->ShowProgress(percent);
       }
     }
     rv = m_copyState->m_msgService->CopyMessage(uri.get(), streamListener,
                                                 isMove && !m_copyState->m_isCrossServerOp, nullptr, aMsgWindow, nullptr);
     if (NS_FAILED(rv))
-      PR_LOG(IMAP, PR_LOG_ALWAYS, ("CopyMessage failed: uri %s\n", uri.get()));
+      MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("CopyMessage failed: uri %s\n", uri.get()));
   } 
   return rv;
 }
 
 nsImapMailCopyState::nsImapMailCopyState() :
     m_isMove(false), m_selectedState(false),
     m_isCrossServerOp(false), m_curIndex(0),
     m_totalCount(0), m_streamCopy(false), m_dataBuffer(nullptr),
@@ -9566,28 +9567,28 @@ NS_IMETHODIMP nsImapMailFolder::GetAutoS
   NS_IF_ADDREF(*autoSyncStateObj = m_autoSyncStateObj);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsImapMailFolder::InitiateAutoSync(nsIUrlListener *aUrlListener)
 {
   nsCString folderName;
   GetURI(folderName);
-  PR_LOG(gAutoSyncLog, PR_LOG_DEBUG, ("Updating folder: %s\n", folderName.get()));
+  MOZ_LOG(gAutoSyncLog, mozilla::LogLevel::Debug, ("Updating folder: %s\n", folderName.get()));
 
   // HACK: if UpdateFolder finds out that it can't open 
   // the folder, it doesn't set the url listener and returns 
   // no error. In this case, we return success from this call 
   // but the caller never gets a notification on its url listener.
   bool canOpenThisFolder = true;
   GetCanOpenFolder(&canOpenThisFolder);
   
   if (!canOpenThisFolder)
   {
-    PR_LOG(gAutoSyncLog, PR_LOG_DEBUG, ("Cannot update folder: %s\n", folderName.get()));
+    MOZ_LOG(gAutoSyncLog, mozilla::LogLevel::Debug, ("Cannot update folder: %s\n", folderName.get()));
     return NS_ERROR_FAILURE;
   }
 
   // create auto-sync state object lazily
   InitAutoSyncState();
 
   // make sure we get the counts from the folder cache.
   ReadDBFolderInfo(false);
--- a/mailnews/imap/src/nsImapProtocol.cpp
+++ b/mailnews/imap/src/nsImapProtocol.cpp
@@ -69,16 +69,18 @@ PRLogModuleInfo *IMAP;
 #include "nsIStreamConverterService.h"
 #include "nsIProxyInfo.h"
 #include "nsISSLSocketControl.h"
 #include "nsProxyRelease.h"
 #include "nsDebug.h"
 #include "nsMsgCompressIStream.h"
 #include "nsMsgCompressOStream.h"
 #include "nsAlgorithm.h"
+#include "mozilla/Logging.h"
+
 using namespace mozilla;
 
 #define ONE_SECOND ((uint32_t)1000)    // one second
 
 #define OUTPUT_BUFFER_SIZE (4096*2) // mscott - i should be able to remove this if I can use nsMsgLineBuffer???
 
 #define IMAP_ENV_HEADERS "From To Cc Bcc Subject Date Message-ID "
 #define IMAP_DB_HEADERS "Priority X-Priority References Newsgroups In-Reply-To Content-Type Reply-To"
@@ -1325,17 +1327,17 @@ nsImapProtocol::PseudoInterruptMsgLoad(n
   printf("interrupt msg load : %s\n", (*interrupted) ? "TRUE" : "FALSE");
 #endif
   return NS_OK;
 }
 
 void
 nsImapProtocol::ImapThreadMainLoop()
 {
-  PR_LOG(IMAP, PR_LOG_DEBUG, ("ImapThreadMainLoop entering [this=%x]\n", this));
+  MOZ_LOG(IMAP, LogLevel::Debug, ("ImapThreadMainLoop entering [this=%x]\n", this));
 
   PRIntervalTime sleepTime = kImapSleepTime;
   while (!DeathSignalReceived())
   {
     nsresult rv = NS_OK;
     bool readyToRun;
 
     // wait for an URL to process...
@@ -1413,17 +1415,17 @@ nsImapProtocol::ImapThreadMainLoop()
 #endif
     // This can happen if the UI thread closes cached connections in the
     // OnStopRunningUrl notification.
     if (m_threadShouldDie)
       TellThreadToDie();
   }
   m_imapThreadIsRunning = false;
 
-  PR_LOG(IMAP, PR_LOG_DEBUG, ("ImapThreadMainLoop leaving [this=%x]\n", this));
+  MOZ_LOG(IMAP, LogLevel::Debug, ("ImapThreadMainLoop leaving [this=%x]\n", this));
 }
 
 void nsImapProtocol::HandleIdleResponses()
 {
   // int32_t oldRecent = GetServerStateParser().NumberOfRecentMessages();
   nsAutoCString commandBuffer(GetServerCommandTag());
   commandBuffer.Append(" IDLE" CRLF);
 
@@ -1837,29 +1839,29 @@ bool nsImapProtocol::ProcessCurrentURL()
   if (imapMailFolderSink)
   {
     if (copyState)
     {
       rv = imapMailFolderSink->CopyNextStreamMessage(GetServerStateParser().LastCommandSuccessful() &&
                                                 NS_SUCCEEDED(GetConnectionStatus()),
                                                 copyState);
       if (NS_FAILED(rv))
-        PR_LOG(IMAP, PR_LOG_ALWAYS, ("CopyNextStreamMessage failed:%lx\n", rv));
+        MOZ_LOG(IMAP, LogLevel::Info, ("CopyNextStreamMessage failed:%lx\n", rv));
 
       nsCOMPtr<nsIThread> thread = do_GetMainThread();
       nsISupports *doomed = nullptr;
       copyState.swap(doomed);
       NS_ProxyRelease(thread, doomed);
     }
     // we might need this to stick around for IDLE support
     m_imapMailFolderSink = imapMailFolderSink;
     imapMailFolderSink = nullptr;
   }
   else
-    PR_LOG(IMAP, PR_LOG_ALWAYS, ("null imapMailFolderSink\n"));
+    MOZ_LOG(IMAP, LogLevel::Info, ("null imapMailFolderSink\n"));
 
   // now try queued urls, now that we've released this connection.
   if (m_imapServerSink)
   {
     if (NS_SUCCEEDED(GetConnectionStatus()))
       rv = m_imapServerSink->LoadNextQueuedUrl(this, &anotherUrlRun);
     else // if we don't do this, they'll just sit and spin until
           // we run some other url on this server.
@@ -2334,17 +2336,17 @@ NS_IMETHODIMP nsImapProtocol::CanHandleU
               {
                 if (isBusy)
                   *hasToWait = true;
                 else
                   *aCanRunUrl = true;
               }
             }
           }
-          PR_LOG(IMAP, PR_LOG_DEBUG,
+          MOZ_LOG(IMAP, LogLevel::Debug,
                  ("proposed url = %s folder for connection %s has To Wait = %s can run = %s",
                   folderNameForProposedUrl, curSelectedUrlFolderName.get(),
                   (*hasToWait) ? "TRUE" : "FALSE", (*aCanRunUrl) ? "TRUE" : "FALSE"));
           PR_FREEIF(folderNameForProposedUrl);
         }
       }
       else // *** jt - an authenticated state url can be run in either
         // authenticated or selected state
@@ -2578,25 +2580,25 @@ void nsImapProtocol::ProcessSelectedStat
                 nsRefPtr<nsIMAPBodyShell> foundShell;
                 res = m_hostSessionList->FindShellInCacheForHost(GetImapServerKey(),
                   GetServerStateParser().GetSelectedMailboxName(),
                   messageIdString.get(), modType, getter_AddRefs(foundShell));
                 if (!foundShell)
                 {
                   // The shell wasn't in the cache.  Deal with this case later.
                   Log("SHELL",NULL,"Loading part, shell not found in cache!");
-                  //PR_LOG(IMAP, out, ("BODYSHELL: Loading part, shell not found in cache!"));
+                  //MOZ_LOG(IMAP, out, ("BODYSHELL: Loading part, shell not found in cache!"));
                   // The parser will extract the part number from the current URL.
                   SetContentModified(modType);
                   Bodystructure(messageIdString, bMessageIdsAreUids);
                 }
                 else
                 {
                   Log("SHELL", NULL, "Loading Part, using cached shell.");
-                  //PR_LOG(IMAP, out, ("BODYSHELL: Loading part, using cached shell."));
+                  //MOZ_LOG(IMAP, out, ("BODYSHELL: Loading part, using cached shell."));
                   SetContentModified(modType);
                   foundShell->SetConnection(this);
                   GetServerStateParser().UseCachedShell(foundShell);
                   //Set the current uid in server state parser (in case it was used for new mail msgs earlier).
                   GetServerStateParser().SetCurrentResponseUID((uint32_t)atoi(messageIdString.get()));
                   foundShell->Generate(imappart);
                   GetServerStateParser().UseCachedShell(NULL);
                 }
@@ -2624,17 +2626,17 @@ void nsImapProtocol::ProcessSelectedStat
               m_runningUrl->GetFetchPartsOnDemand(&urlOKToFetchByParts);
 
 #ifdef PR_LOGGING
               {
                 nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningUrl);
                 nsAutoCString urlSpec;
                 if (mailnewsurl)
                   mailnewsurl->GetSpec(urlSpec);
-                PR_LOG(IMAP, PR_LOG_DEBUG,
+                MOZ_LOG(IMAP, LogLevel::Debug,
                        ("SHELL: URL %s, OKToFetchByParts %d, allowedToBreakApart %d, ShouldFetchAllParts %d",
                         urlSpec.get(), urlOKToFetchByParts, allowedToBreakApart,
                         GetShouldFetchAllParts()));
               }
 #endif
 
               if (urlOKToFetchByParts &&
                   allowedToBreakApart &&
@@ -2668,17 +2670,17 @@ void nsImapProtocol::ProcessSelectedStat
                 if (bMessageIdsAreUids)
                 {
                   res = m_hostSessionList->FindShellInCacheForHost(GetImapServerKey(),
                     GetServerStateParser().GetSelectedMailboxName(),
                     messageIdString.get(), modType, getter_AddRefs(foundShell));
                   if (foundShell)
                   {
                     Log("SHELL",NULL,"Loading message, using cached shell.");
-                    //PR_LOG(IMAP, out, ("BODYSHELL: Loading message, using cached shell."));
+                    //MOZ_LOG(IMAP, out, ("BODYSHELL: Loading message, using cached shell."));
                     foundShell->SetConnection(this);
                     GetServerStateParser().UseCachedShell(foundShell);
                     //Set the current uid in server state parser (in case it was used for new mail msgs earlier).
                     GetServerStateParser().SetCurrentResponseUID((uint32_t)atoi(messageIdString.get()));
                     foundShell->Generate(NULL);
                     GetServerStateParser().UseCachedShell(NULL);
                   }
                 }
@@ -3319,17 +3321,17 @@ nsImapProtocol::FetchMessage(const nsCSt
   switch (whatToFetch) {
   case kEveryThingRFC822:
     m_flagChangeCount++;
     m_fetchingWholeMessage = true;
     if (m_trackingTime)
       AdjustChunkSize();      // we started another segment
     m_startTime = PR_Now();     // save start of download time
     m_trackingTime = true;
-    PR_LOG(IMAP, PR_LOG_DEBUG, ("FetchMessage everything: curFetchSize %u numBytes %u",
+    MOZ_LOG(IMAP, LogLevel::Debug, ("FetchMessage everything: curFetchSize %u numBytes %u",
                                 m_curFetchSize, numBytes));
     if (numBytes > 0)
       m_curFetchSize = numBytes;
 
     if (GetServerStateParser().ServerHasIMAP4Rev1Capability())
     {
       if (GetServerStateParser().GetCapabilityFlag() & kHasXSenderCapability)
         commandString.Append(" %s (XSENDER UID RFC822.SIZE BODY[]");
@@ -3354,17 +3356,17 @@ nsImapProtocol::FetchMessage(const nsCSt
       }
     }
     commandString.Append(")");
 
     break;
 
   case kEveryThingRFC822Peek:
     {
-      PR_LOG(IMAP, PR_LOG_DEBUG, ("FetchMessage peek: curFetchSize %u numBytes %u",
+      MOZ_LOG(IMAP, LogLevel::Debug, ("FetchMessage peek: curFetchSize %u numBytes %u",
                                   m_curFetchSize, numBytes));
       if (numBytes > 0)
         m_curFetchSize = numBytes;
       const char *formatString = "";
       eIMAPCapabilityFlags server_capabilityFlags = GetServerStateParser().GetCapabilityFlag();
 
       m_fetchingWholeMessage = true;
       if (server_capabilityFlags & kIMAP4rev1Capability)
@@ -3580,17 +3582,17 @@ nsImapProtocol::FetchMessage(const nsCSt
 void nsImapProtocol::FetchTryChunking(const nsCString &messageIds,
                                       nsIMAPeFetchFields whatToFetch,
                                       bool idIsUid,
                                       char *part,
                                       uint32_t downloadSize,
                                       bool tryChunking)
 {
   GetServerStateParser().SetTotalDownloadSize(downloadSize);
-  PR_LOG(IMAP, PR_LOG_DEBUG, ("FetchTryChunking: curFetchSize %u", downloadSize));
+  MOZ_LOG(IMAP, LogLevel::Debug, ("FetchTryChunking: curFetchSize %u", downloadSize));
   m_curFetchSize = downloadSize; // we'll change this if chunking.
   if (m_fetchByChunks && tryChunking &&
         GetServerStateParser().ServerHasIMAP4Rev1Capability() &&
     (downloadSize > (uint32_t) m_chunkThreshold))
   {
     uint32_t startByte = 0;
     GetServerStateParser().ClearLastFetchChunkReceived();
     while (!DeathSignalReceived() && !GetPseudoInterrupted() &&
@@ -3941,17 +3943,17 @@ void nsImapProtocol::NormalMessageEndDow
   if (!GetServerStateParser().GetDownloadingHeaders())
   {
     int32_t updatedMessageSize = -1;
     if (m_fetchingWholeMessage)
     {
       updatedMessageSize = m_bytesToChannel;
 #ifdef PR_LOGGING
       if (m_bytesToChannel != GetServerStateParser().SizeOfMostRecentMessage()) {
-        PR_LOG(IMAP, PR_LOG_DEBUG, ("STREAM:CLOSE Server's RFC822.SIZE %u, actual size %u",
+        MOZ_LOG(IMAP, LogLevel::Debug, ("STREAM:CLOSE Server's RFC822.SIZE %u, actual size %u",
                                     GetServerStateParser().SizeOfMostRecentMessage(),
                                     m_bytesToChannel));
       }
 #endif
     }
     // need to know if we're downloading for display or not. We'll use action == nsImapMsgFetch for now
     nsImapAction imapAction = nsIImapUrl::nsImapSelectFolder; // just set it to some legal value
     if (m_runningUrl)
@@ -4362,33 +4364,33 @@ bool nsImapProtocol::CheckNewMail()
 }
 
 /* static */ void nsImapProtocol::LogImapUrl(const char *logMsg, nsIImapUrl *imapUrl)
 {
   // nsImapProtocol is not always constructed before this static method is called
   if (!IMAP)
     IMAP = PR_NewLogModule("IMAP");
 
-  if (PR_LOG_TEST(IMAP, PR_LOG_ALWAYS))
+  if (MOZ_LOG_TEST(IMAP, LogLevel::Info))
   {
     nsCOMPtr<nsIMsgMailNewsUrl> mailnewsUrl = do_QueryInterface(imapUrl);
     if (mailnewsUrl)
     {
       nsAutoCString urlSpec, unescapedUrlSpec;
       mailnewsUrl->GetSpec(urlSpec);
       MsgUnescapeString(urlSpec, 0, unescapedUrlSpec);
-      PR_LOG(IMAP, PR_LOG_ALWAYS, ("%s:%s", logMsg, unescapedUrlSpec.get()));
+      MOZ_LOG(IMAP, LogLevel::Info, ("%s:%s", logMsg, unescapedUrlSpec.get()));
     }
   }
 }
 
 // log info including current state...
 void nsImapProtocol::Log(const char *logSubName, const char *extraInfo, const char *logData)
 {
-  if (PR_LOG_TEST(IMAP, PR_LOG_ALWAYS))
+  if (MOZ_LOG_TEST(IMAP, LogLevel::Info))
   {
     static const char nonAuthStateName[] = "NA";
     static const char authStateName[] = "A";
     static const char selectedStateName[] = "S";
     const nsCString& hostName = GetImapHostName();  // initilize to empty string
 
     int32_t logDataLen = PL_strlen(logData); // PL_strlen checks for null
     nsCString logDataLines;
@@ -4414,51 +4416,51 @@ void nsImapProtocol::Log(const char *log
     {
       logDataToLog = logData;
       lastLineEnd = logDataLen;
     }
     switch (GetServerStateParser().GetIMAPstate())
     {
     case nsImapServerResponseParser::kFolderSelected:
       if (extraInfo)
-        PR_LOG(IMAP, PR_LOG_ALWAYS, ("%x:%s:%s-%s:%s:%s: %.400s", this, hostName.get(),
+        MOZ_LOG(IMAP, LogLevel::Info, ("%x:%s:%s-%s:%s:%s: %.400s", this, hostName.get(),
                selectedStateName, GetServerStateParser().GetSelectedMailboxName(),
                logSubName, extraInfo, logDataToLog));
       else
-        PR_LOG(IMAP, PR_LOG_ALWAYS, ("%x:%s:%s-%s:%s: %.400s", this, hostName.get(),
+        MOZ_LOG(IMAP, LogLevel::Info, ("%x:%s:%s-%s:%s: %.400s", this, hostName.get(),
                selectedStateName, GetServerStateParser().GetSelectedMailboxName(),
                logSubName, logDataToLog));
       break;
     case nsImapServerResponseParser::kNonAuthenticated:
     case nsImapServerResponseParser::kAuthenticated:
     {
       const char *stateName = (GetServerStateParser().GetIMAPstate() ==
                                nsImapServerResponseParser::kNonAuthenticated)
                                ? nonAuthStateName : authStateName;
       if (extraInfo)
-        PR_LOG(IMAP, PR_LOG_ALWAYS, ("%x:%s:%s:%s:%s: %.400s", this,
+        MOZ_LOG(IMAP, LogLevel::Info, ("%x:%s:%s:%s:%s: %.400s", this,
                hostName.get(),stateName,logSubName,extraInfo,logDataToLog));
       else
-        PR_LOG(IMAP, PR_LOG_ALWAYS, ("%x:%s:%s:%s: %.400s",this,
+        MOZ_LOG(IMAP, LogLevel::Info, ("%x:%s:%s:%s: %.400s",this,
                hostName.get(),stateName,logSubName,logDataToLog));
     }
     }
 
     // dump the rest of the string in < 400 byte chunks
     while (logDataLen > kLogDataChunkSize)
     {
       logDataLines.Cut(0, lastLineEnd + 2); // + 2 to account for the LF and the '\0' we added
       logDataLen = logDataLines.Length();
       lastLineEnd = (logDataLen > kLogDataChunkSize) ? MsgRFindChar(logDataLines, '\n', kLogDataChunkSize) : kNotFound;
       // null terminate the last line
       if (lastLineEnd == kNotFound)
         lastLineEnd = kLogDataChunkSize - 1;
       logDataLines.Insert( '\0', lastLineEnd + 1);
       logDataToLog = logDataLines.get();
-      PR_LOG(IMAP, PR_LOG_ALWAYS, ("%.400s", logDataToLog));
+      MOZ_LOG(IMAP, LogLevel::Info, ("%.400s", logDataToLog));
     }
   }
 }
 
 // In 4.5, this posted an event back to libmsg and blocked until it got a response.
 // We may still have to do this.It would be nice if we could preflight this value,
 // but we may not always know when we'll need it.
 uint32_t nsImapProtocol::GetMessageSize(const char * messageId,
@@ -4693,17 +4695,17 @@ char* nsImapProtocol::CreateNewLineFromS
   // ui thread, which releases our ref to the input stream, and can
   // cause the pipe to get deleted before the monitor the read is
   // blocked on gets notified. When that happens, the imap thread
   // will stay blocked.
   nsCOMPtr <nsIInputStream> kungFuGrip = m_inputStream;
   do
   {
     newLine = m_inputStreamBuffer->ReadNextLine(m_inputStream, numBytesInLine, needMoreData, &rv);
-    PR_LOG(IMAP, PR_LOG_DEBUG, ("ReadNextLine [stream=%x nb=%u needmore=%u]\n",
+    MOZ_LOG(IMAP, LogLevel::Debug, ("ReadNextLine [stream=%x nb=%u needmore=%u]\n",
         m_inputStream.get(), numBytesInLine, needMoreData));
 
   } while (!newLine && NS_SUCCEEDED(rv) && !DeathSignalReceived()); // until we get the next line and haven't been interrupted
 
   kungFuGrip = nullptr;
 
   if (NS_FAILED(rv))
   {
@@ -5532,17 +5534,17 @@ void nsImapProtocol::InitPrefAuthMethods
       case nsMsgAuthMethod::secure:
         m_prefAuthMethods = kHasCRAMCapability |
             kHasAuthGssApiCapability |
             kHasAuthNTLMCapability | kHasAuthMSNCapability;
         break;
       default:
         NS_ASSERTION(false, "IMAP: authMethod pref invalid");
         // TODO log to error console
-        PR_LOG(IMAP, PR_LOG_ERROR,
+        MOZ_LOG(IMAP, LogLevel::Error,
             ("IMAP: bad pref authMethod = %d\n", authMethodPrefValue));
         // fall to any
       case nsMsgAuthMethod::anything:
         m_prefAuthMethods = kHasAuthOldLoginCapability |
             kHasAuthLoginCapability | kHasAuthPlainCapability |
             kHasCRAMCapability | kHasAuthGssApiCapability |
             kHasAuthNTLMCapability | kHasAuthMSNCapability |
             kHasAuthExternalCapability | kHasXOAuth2Capability;
@@ -5569,19 +5571,19 @@ void nsImapProtocol::InitPrefAuthMethods
  * which is allowed by server and prefs and not marked failed.
  * The order of preference and trying of auth methods is encoded here.
  */
 nsresult nsImapProtocol::ChooseAuthMethod()
 {
   eIMAPCapabilityFlags serverCaps = GetServerStateParser().GetCapabilityFlag();
   eIMAPCapabilityFlags availCaps = serverCaps & m_prefAuthMethods & ~m_failedAuthMethods;
 
-  PR_LOG(IMAP, PR_LOG_DEBUG, ("IMAP auth: server caps 0x%llx, pref 0x%llx, failed 0x%llx, avail caps 0x%llx",
+  MOZ_LOG(IMAP, LogLevel::Debug, ("IMAP auth: server caps 0x%llx, pref 0x%llx, failed 0x%llx, avail caps 0x%llx",
         serverCaps, m_prefAuthMethods, m_failedAuthMethods, availCaps));
-  PR_LOG(IMAP, PR_LOG_DEBUG, ("(GSSAPI = 0x%llx, CRAM = 0x%llx, NTLM = 0x%llx, "
+  MOZ_LOG(IMAP, LogLevel::Debug, ("(GSSAPI = 0x%llx, CRAM = 0x%llx, NTLM = 0x%llx, "
         "MSN = 0x%llx, PLAIN = 0x%llx,\n  LOGIN = 0x%llx, old-style IMAP login = 0x%llx"
         ", auth external IMAP login = 0x%llx, OAUTH2 = 0x%llx)",
         kHasAuthGssApiCapability, kHasCRAMCapability, kHasAuthNTLMCapability,
         kHasAuthMSNCapability, kHasAuthPlainCapability, kHasAuthLoginCapability,
         kHasAuthOldLoginCapability, kHasAuthExternalCapability, kHasXOAuth2Capability));
 
   if (kHasAuthExternalCapability & availCaps)
     m_currentAuthMethod = kHasAuthExternalCapability;
@@ -5598,49 +5600,49 @@ nsresult nsImapProtocol::ChooseAuthMetho
   else if (kHasAuthPlainCapability & availCaps)
     m_currentAuthMethod = kHasAuthPlainCapability;
   else if (kHasAuthLoginCapability & availCaps)
     m_currentAuthMethod = kHasAuthLoginCapability;
   else if (kHasAuthOldLoginCapability & availCaps)
     m_currentAuthMethod = kHasAuthOldLoginCapability;
   else
   {
-    PR_LOG(IMAP, PR_LOG_DEBUG, ("no remaining auth method"));
+    MOZ_LOG(IMAP, LogLevel::Debug, ("no remaining auth method"));
     m_currentAuthMethod = kCapabilityUndefined;
     return NS_ERROR_FAILURE;
   }
-  PR_LOG(IMAP, PR_LOG_DEBUG, ("trying auth method 0x%llx", m_currentAuthMethod));
+  MOZ_LOG(IMAP, LogLevel::Debug, ("trying auth method 0x%llx", m_currentAuthMethod));
   return NS_OK;
 }
 
 void nsImapProtocol::MarkAuthMethodAsFailed(eIMAPCapabilityFlags failedAuthMethod)
 {
-  PR_LOG(IMAP, PR_LOG_DEBUG, ("marking auth method 0x%llx failed", failedAuthMethod));
+  MOZ_LOG(IMAP, LogLevel::Debug, ("marking auth method 0x%llx failed", failedAuthMethod));
   m_failedAuthMethods |= failedAuthMethod;
 }
 
 /**
  * Start over, trying all auth methods again
  */
 void nsImapProtocol::ResetAuthMethods()
 {
-  PR_LOG(IMAP, PR_LOG_DEBUG, ("resetting (failed) auth methods"));
+  MOZ_LOG(IMAP, LogLevel::Debug, ("resetting (failed) auth methods"));
   m_currentAuthMethod = kCapabilityUndefined;
   m_failedAuthMethods = 0;
 }
 
 nsresult nsImapProtocol::AuthLogin(const char *userName, const nsCString &password, eIMAPCapabilityFlag flag)
 {
   ProgressEventFunctionUsingName("imapStatusSendingAuthLogin");
   IncrementCommandTagNumber();
 
   char * currentCommand=nullptr;
   nsresult rv;
 
-  PR_LOG(IMAP, PR_LOG_DEBUG, ("IMAP: trying auth method 0x%llx", m_currentAuthMethod));
+  MOZ_LOG(IMAP, LogLevel::Debug, ("IMAP: trying auth method 0x%llx", m_currentAuthMethod));
 
   if (flag & kHasAuthExternalCapability)
   {
       char *base64UserName = PL_Base64Encode(userName, strlen(userName), nullptr);
       nsAutoCString command (GetServerCommandTag());
       command.Append(" authenticate EXTERNAL " );
       command.Append(base64UserName);
       command.Append(CRLF);
@@ -5650,17 +5652,17 @@ nsresult nsImapProtocol::AuthLogin(const
       nsImapServerResponseParser &parser = GetServerStateParser();
       if (parser.LastCommandSuccessful())
         return NS_OK;
       parser.SetCapabilityFlag(parser.GetCapabilityFlag() & ~kHasAuthExternalCapability);
   }
   else if (flag & kHasCRAMCapability)
   {
     NS_ENSURE_TRUE(m_imapServerSink, NS_ERROR_NULL_POINTER);
-    PR_LOG(IMAP, PR_LOG_DEBUG, ("MD5 auth"));
+    MOZ_LOG(IMAP, LogLevel::Debug, ("MD5 auth"));
     // inform the server that we want to begin a CRAM authentication procedure...
     nsAutoCString command (GetServerCommandTag());
     command.Append(" authenticate CRAM-MD5" CRLF);
     rv = SendData(command.get());
     NS_ENSURE_SUCCESS(rv, rv);
     ParseIMAPandCheckForNewMail();
     if (GetServerStateParser().LastCommandSuccessful())
     {
@@ -5688,17 +5690,17 @@ nsresult nsImapProtocol::AuthLogin(const
       PR_Free(digest);
       rv = SendData(m_dataOutputBuf);
       NS_ENSURE_SUCCESS(rv, rv);
       ParseIMAPandCheckForNewMail(command.get());
     }
   } // if CRAM response was received
   else if (flag & kHasAuthGssApiCapability)
   {
-    PR_LOG(IMAP, PR_LOG_DEBUG, ("MD5 auth"));
+    MOZ_LOG(IMAP, LogLevel::Debug, ("MD5 auth"));
 
     // Only try GSSAPI once - if it fails, its going to be because we don't
     // have valid credentials
     //MarkAuthMethodAsFailed(kHasAuthGssApiCapability);
 
     // We do step1 first, so we don't try GSSAPI against a server which
     // we can't get credentials for.
     nsAutoCString response;
@@ -5738,17 +5740,17 @@ nsresult nsImapProtocol::AuthLogin(const
         NS_ENSURE_SUCCESS(rv, rv);
         ParseIMAPandCheckForNewMail(command.get());
       }
       // TODO: whether it worked or not is shown by LastCommandSuccessful(), not gssrv, right?
     }
   }
   else if (flag & (kHasAuthNTLMCapability | kHasAuthMSNCapability))
   {
-    PR_LOG(IMAP, PR_LOG_DEBUG, ("NTLM auth"));
+    MOZ_LOG(IMAP, LogLevel::Debug, ("NTLM auth"));
     nsAutoCString command (GetServerCommandTag());
     command.Append((flag & kHasAuthNTLMCapability) ? " authenticate NTLM" CRLF
                                                    : " authenticate MSN" CRLF);
     rv = SendData(command.get());
     ParseIMAPandCheckForNewMail("AUTH NTLM"); // this just waits for ntlm step 1
     if (GetServerStateParser().LastCommandSuccessful())
     {
       nsAutoCString cmd;
@@ -5767,17 +5769,17 @@ nsresult nsImapProtocol::AuthLogin(const
         response += CRLF;
         rv = SendData(response.get());
         ParseIMAPandCheckForNewMail(command.get());
       }
     }
   }
   else if (flag & kHasAuthPlainCapability)
   {
-    PR_LOG(IMAP, PR_LOG_DEBUG, ("PLAIN auth"));
+    MOZ_LOG(IMAP, LogLevel::Debug, ("PLAIN auth"));
     PR_snprintf(m_dataOutputBuf, OUTPUT_BUFFER_SIZE, "%s authenticate plain" CRLF, GetServerCommandTag());
     rv = SendData(m_dataOutputBuf);
     NS_ENSURE_SUCCESS(rv, rv);
     currentCommand = PL_strdup(m_dataOutputBuf); /* StrAllocCopy(currentCommand, GetOutputBuffer()); */
     ParseIMAPandCheckForNewMail();
     if (GetServerStateParser().LastCommandSuccessful())
     {
       // RFC 4616
@@ -5794,17 +5796,17 @@ nsresult nsImapProtocol::AuthLogin(const
       PR_Free(base64Str);
       rv = SendData(m_dataOutputBuf, true /* suppress logging */);
       if (NS_SUCCEEDED(rv))
         ParseIMAPandCheckForNewMail(currentCommand);
     } // if the last command succeeded
   } // if auth plain capability
   else if (flag & kHasAuthLoginCapability)
   {
-    PR_LOG(IMAP, PR_LOG_DEBUG, ("LOGIN auth"));
+    MOZ_LOG(IMAP, LogLevel::Debug, ("LOGIN auth"));
     PR_snprintf(m_dataOutputBuf, OUTPUT_BUFFER_SIZE, "%s authenticate login" CRLF, GetServerCommandTag());
     rv = SendData(m_dataOutputBuf);
     NS_ENSURE_SUCCESS(rv, rv);
     currentCommand = PL_strdup(m_dataOutputBuf);
     ParseIMAPandCheckForNewMail();
 
     if (GetServerStateParser().LastCommandSuccessful())
     {
@@ -5824,17 +5826,17 @@ nsresult nsImapProtocol::AuthLogin(const
           if (NS_SUCCEEDED(rv))
             ParseIMAPandCheckForNewMail(currentCommand);
         } // if last command successful
       } // if last command successful
     } // if last command successful
   } // if has auth login capability
   else if (flag & kHasAuthOldLoginCapability)
   {
-    PR_LOG(IMAP, PR_LOG_DEBUG, ("old-style auth"));
+    MOZ_LOG(IMAP, LogLevel::Debug, ("old-style auth"));
     ProgressEventFunctionUsingName("imapStatusSendingLogin");
     IncrementCommandTagNumber();
     nsCString command (GetServerCommandTag());
     nsAutoCString escapedUserName;
     command.Append(" login \"");
     EscapeUserNamePasswordString(userName, &escapedUserName);
     command.Append(escapedUserName);
     command.Append("\" \"");
@@ -5846,29 +5848,29 @@ nsresult nsImapProtocol::AuthLogin(const
     command.Append(correctedPassword);
     command.Append("\"" CRLF);
     rv = SendData(command.get(), true /* suppress logging */);
     NS_ENSURE_SUCCESS(rv, rv);
     ParseIMAPandCheckForNewMail();
   }
   else if (flag & kHasXOAuth2Capability)
   {
-    PR_LOG(IMAP, PR_LOG_DEBUG, ("XOAUTH2 auth"));
+    MOZ_LOG(IMAP, LogLevel::Debug, ("XOAUTH2 auth"));
 
     // Get the XOAuth2 base64 string.
     NS_ASSERTION(mOAuth2Support,
       "What are we doing here without OAuth2 helper?");
     if (!mOAuth2Support)
       return NS_ERROR_UNEXPECTED;
     nsAutoCString base64Str;
     mOAuth2Support->GetXOAuth2String(base64Str);
     mOAuth2Support = nullptr; // Its purpose has been served.
     if (base64Str.IsEmpty())
     {
-      PR_LOG(IMAP, PR_LOG_DEBUG, ("OAuth2 failed"));
+      MOZ_LOG(IMAP, LogLevel::Debug, ("OAuth2 failed"));
       return NS_ERROR_FAILURE;
     }
 
     // Send the data on the network.
     nsAutoCString command (GetServerCommandTag());
     command += " AUTHENTICATE XOAUTH2 ";
     command += base64Str;
     command += CRLF;
@@ -5878,17 +5880,17 @@ nsresult nsImapProtocol::AuthLogin(const
   }
   else if (flag & kHasAuthNoneCapability)
   {
     // TODO What to do? "login <username>" like POP?
     return NS_ERROR_NOT_IMPLEMENTED;
   }
   else
   {
-    PR_LOG(IMAP, PR_LOG_ERROR, ("flags param has no auth scheme selected"));
+    MOZ_LOG(IMAP, LogLevel::Error, ("flags param has no auth scheme selected"));
     return NS_ERROR_ILLEGAL_VALUE;
   }
 
   PR_Free(currentCommand);
   NS_ENSURE_SUCCESS(rv, rv);
   return GetServerStateParser().LastCommandSuccessful() ?
         NS_OK : NS_ERROR_FAILURE;
 }
@@ -8321,17 +8323,17 @@ nsImapProtocol::OnPromptCanceled()
   m_passwordStatus = NS_MSG_PASSWORD_PROMPT_CANCELLED;
   ReentrantMonitorAutoEnter passwordMon(m_passwordReadyMonitor);
   passwordMon.Notify();
   return NS_OK;
 }
 
 bool nsImapProtocol::TryToLogon()
 {
-  PR_LOG(IMAP, PR_LOG_DEBUG, ("try to log in"));
+  MOZ_LOG(IMAP, LogLevel::Debug, ("try to log in"));
   NS_ENSURE_TRUE(m_imapServerSink, false);
   bool loginSucceeded = false;
   bool skipLoop = false;
   nsAutoCString password;
   nsAutoCString userName;
 
   nsresult rv = ChooseAuthMethod();
   if (NS_FAILED(rv)) // all methods failed
@@ -8370,17 +8372,17 @@ bool nsImapProtocol::TryToLogon()
     }
     else
     {
       // try to reset failed methods and try them again
       ResetAuthMethods();
       rv = ChooseAuthMethod();
       if (NS_FAILED(rv)) // all methods failed
       {
-        PR_LOG(IMAP, PR_LOG_ERROR, ("huch? there are auth methods, and we resetted failed ones, but ChooseAuthMethod still fails."));
+        MOZ_LOG(IMAP, LogLevel::Error, ("huch? there are auth methods, and we resetted failed ones, but ChooseAuthMethod still fails."));
         return false;
       }
     }
   }
 
   // Get username, either the stored one or from user
   rv = m_imapServerSink->GetLoginUsername(userName);
   if (NS_FAILED(rv) || userName.IsEmpty())
@@ -8424,33 +8426,33 @@ bool nsImapProtocol::TryToLogon()
           m_currentAuthMethod != kHasAuthExternalCapability &&
           m_currentAuthMethod != kHasXOAuth2Capability &&
           m_currentAuthMethod != kHasAuthNoneCapability)
       {
           rv = GetPassword(password, newPasswordRequested);
           newPasswordRequested = false;
           if (rv == NS_MSG_PASSWORD_PROMPT_CANCELLED || NS_FAILED(rv))
           {
-            PR_LOG(IMAP, PR_LOG_ERROR, ("IMAP: password prompt failed or user canceled it"));
+            MOZ_LOG(IMAP, LogLevel::Error, ("IMAP: password prompt failed or user canceled it"));
             break;
           }
-          PR_LOG(IMAP, PR_LOG_DEBUG, ("got new password"));
+          MOZ_LOG(IMAP, LogLevel::Debug, ("got new password"));
       }
 
       bool lastReportingErrors = GetServerStateParser().GetReportingErrors();
       GetServerStateParser().SetReportingErrors(false); // turn off errors - we'll put up our own.
 
       rv = AuthLogin(userName.get(), password, m_currentAuthMethod);
 
       GetServerStateParser().SetReportingErrors(lastReportingErrors); // restore error reports
       loginSucceeded = NS_SUCCEEDED(rv);
 
       if (!loginSucceeded)
       {
-        PR_LOG(IMAP, PR_LOG_DEBUG, ("authlogin failed"));
+        MOZ_LOG(IMAP, LogLevel::Debug, ("authlogin failed"));
         MarkAuthMethodAsFailed(m_currentAuthMethod);
         rv = ChooseAuthMethod(); // change m_currentAuthMethod to try other one next round
 
         if (NS_FAILED(rv)) // all methods failed
         {
           if (m_prefAuthMethods == kHasAuthGssApiCapability)
           {
             // GSSAPI failed, and it's the only available method,
@@ -8465,64 +8467,64 @@ bool nsImapProtocol::TryToLogon()
             // in a string freeze, so use a generic error message. Entering
             // a password does not help.
             AlertUserEventUsingName("imapUnknownHostError");
             break;
           }
 
           // The reason that we failed might be a wrong password, so
           // ask user what to do
-          PR_LOG(IMAP, PR_LOG_WARN, ("IMAP: ask user what to do (after login failed): new passwort, retry, cancel"));
+          MOZ_LOG(IMAP, LogLevel::Warning, ("IMAP: ask user what to do (after login failed): new passwort, retry, cancel"));
           if (!m_imapServerSink)
             break;
           // if there's no msg window, don't forget the password
           if (!msgWindow)
             break;
           int32_t buttonPressed = 1;
           rv = m_imapServerSink->PromptLoginFailed(msgWindow,
                                                     &buttonPressed);
           if (NS_FAILED(rv))
             break;
           if (buttonPressed == 2) // 'New password' button
           {
-            PR_LOG(IMAP, PR_LOG_WARN, ("new password button pressed."));
+            MOZ_LOG(IMAP, LogLevel::Warning, ("new password button pressed."));
             // Forget the current password
             password.Truncate();
             m_hostSessionList->SetPasswordForHost(GetImapServerKey(), nullptr);
             m_imapServerSink->ForgetPassword();
             m_password.Truncate();
-            PR_LOG(IMAP, PR_LOG_WARN, ("password resetted (nulled)"));
+            MOZ_LOG(IMAP, LogLevel::Warning, ("password resetted (nulled)"));
             newPasswordRequested = true;
             // Will call GetPassword() in beginning of next loop
 
             // Try all possible auth methods again with the new password.
             ResetAuthMethods();
           }
           else if (buttonPressed == 0) // Retry button
           {
-            PR_LOG(IMAP, PR_LOG_WARN, ("retry button pressed"));
+            MOZ_LOG(IMAP, LogLevel::Warning, ("retry button pressed"));
             // Try all possible auth methods again
             ResetAuthMethods();
           }
           else if (buttonPressed == 1) // Cancel button
           {
-            PR_LOG(IMAP, PR_LOG_WARN, ("cancel button pressed"));
+            MOZ_LOG(IMAP, LogLevel::Warning, ("cancel button pressed"));
             break; // Abort quickly
           }
 
           // TODO what is this for? When does it get set to != unknown again?
           m_currentBiffState = nsIMsgFolder::nsMsgBiffState_Unknown;
           SendSetBiffIndicatorEvent(m_currentBiffState);
         } // all methods failed
       } // login failed
   } // while
 
   if (loginSucceeded)
   {
-    PR_LOG(IMAP, PR_LOG_DEBUG, ("login succeeded"));
+    MOZ_LOG(IMAP, LogLevel::Debug, ("login succeeded"));
     bool passwordAlreadyVerified;
     m_hostSessionList->SetPasswordForHost(GetImapServerKey(), password.get());
     rv = m_hostSessionList->GetPasswordVerifiedOnline(GetImapServerKey(), passwordAlreadyVerified);
     if (NS_SUCCEEDED(rv) && !passwordAlreadyVerified)
       m_hostSessionList->SetPasswordVerifiedOnline(GetImapServerKey());
     bool imapPasswordIsNew = !passwordAlreadyVerified;
     if (imapPasswordIsNew)
     {
@@ -8539,17 +8541,17 @@ bool nsImapProtocol::TryToLogon()
     // We don't want to do any more processing if we're just
     // verifying the ability to logon because it can leave us in
     // a half-constructed state.
     if (imapAction != nsIImapUrl::nsImapVerifylogon)
       ProcessAfterAuthenticated();
   }
   else // login failed
   {
-    PR_LOG(IMAP, PR_LOG_ERROR, ("login failed entirely"));
+    MOZ_LOG(IMAP, LogLevel::Error, ("login failed entirely"));
     m_currentBiffState = nsIMsgFolder::nsMsgBiffState_Unknown;
     SendSetBiffIndicatorEvent(m_currentBiffState);
     HandleCurrentUrlError();
     SetConnectionStatus(NS_ERROR_FAILURE); // stop netlib
   }
 
   return loginSucceeded;
 }
@@ -9160,17 +9162,17 @@ nsresult nsImapMockChannel::ReadFromMemC
         // A failure to get a message header isn't an error
         msgUrl->GetMessageHeader(getter_AddRefs(msgHdr));
         if (msgHdr)
         {
           uint32_t messageSize;
           if (NS_SUCCEEDED(msgHdr->GetMessageSize(&messageSize)) &&
               messageSize != entrySize)
           {
-            PR_LOG(IMAP, PR_LOG_WARN,
+            MOZ_LOG(IMAP, LogLevel::Warning,
                 ("ReadFromMemCache size mismatch for %s: message %d, cache %d\n",
                  entryKey.get(), messageSize, entrySize));
             shouldUseCacheEntry = false;
           }
         }
       }
     }
   }
--- a/mailnews/imap/src/nsImapServerResponseParser.cpp
+++ b/mailnews/imap/src/nsImapServerResponseParser.cpp
@@ -10,16 +10,17 @@
 #include "nsImapServerResponseParser.h"
 #include "nsIMAPBodyShell.h"
 #include "nsImapFlagAndUidState.h"
 #include "nsIMAPNamespace.h"
 #include "nsImapStringBundle.h"
 #include "nsImapUtils.h"
 #include "nsCRT.h"
 #include "nsMsgUtils.h"
+#include "mozilla/Logging.h"
 
 ////////////////// nsImapServerResponseParser /////////////////////////
 
 extern PRLogModuleInfo* IMAP;
 
 nsImapServerResponseParser::nsImapServerResponseParser(nsImapProtocol &imapProtocolConnection)
                             : nsIMAPGenericParser(),
     fReportingErrors(true),
@@ -433,17 +434,17 @@ void nsImapServerResponseParser::Process
           m_shell = nullptr;
         navCon->PseudoInterrupt(false);
       }
       else if (m_shell->GetIsValid())
       {
         // If we have a valid shell that has not already been cached, then cache it.
         if (!m_shell->IsShellCached() && fHostSessionList)	// cache is responsible for destroying it
         {
-          PR_LOG(IMAP, PR_LOG_ALWAYS,
+          MOZ_LOG(IMAP, mozilla::LogLevel::Info,
             ("BODYSHELL:  Adding shell to cache."));
           const char *serverKey = fServerConnection.GetImapServerKey();
           fHostSessionList->AddShellToCacheForHost(
             serverKey, m_shell);
         }
       }
       m_shell = nullptr;
     }
@@ -3066,23 +3067,23 @@ bool nsImapServerResponseParser::GetFill
 bool nsImapServerResponseParser::GetDownloadingHeaders()
 {
   return fDownloadingHeaders;
 }
 
 // Tells the server state parser to use a previously cached shell.
 void	nsImapServerResponseParser::UseCachedShell(nsIMAPBodyShell *cachedShell)
 {
-	// We shouldn't already have another shell we're dealing with.
-	if (m_shell && cachedShell)
-	{
-		PR_LOG(IMAP, PR_LOG_ALWAYS, ("PARSER: Shell Collision"));
-		NS_ASSERTION(false, "shell collision");
-	}
-	m_shell = cachedShell;
+  // We shouldn't already have another shell we're dealing with.
+  if (m_shell && cachedShell)
+  {
+    MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("PARSER: Shell Collision"));
+    NS_ASSERTION(false, "shell collision");
+  }
+  m_shell = cachedShell;
 }
 
 
 void nsImapServerResponseParser::ResetCapabilityFlag()
 {
 }
 
 /*
@@ -3095,19 +3096,20 @@ bool nsImapServerResponseParser::msg_fet
   numberOfCharsInThisChunk = atoi(fNextToken + 1);
   // If we didn't request a specific size, or the server isn't returning exactly
   // as many octets as we requested, this must be the last or only chunk
   bool lastChunk = (!chunk ||
                     (numberOfCharsInThisChunk != fServerConnection.GetCurFetchSize()));
 
 #ifdef DEBUG
   if (lastChunk)
-    PR_LOG(IMAP, PR_LOG_DEBUG, ("PARSER: fetch_literal chunk = %d, requested %d, receiving %d",
-                                chunk, fServerConnection.GetCurFetchSize(),
-                                numberOfCharsInThisChunk));
+    MOZ_LOG(IMAP, mozilla::LogLevel::Debug,
+                  ("PARSER: fetch_literal chunk = %d, requested %d, receiving %d",
+                    chunk, fServerConnection.GetCurFetchSize(),
+                    numberOfCharsInThisChunk));
 #endif
 
   charsReadSoFar = 0;
   static bool lastCRLFwasCRCRLF = false;
 
   while (ContinueParse() && !fServerConnection.DeathSignalReceived() && (charsReadSoFar < numberOfCharsInThisChunk))
   {
     AdvanceToNextLine();
@@ -3153,17 +3155,17 @@ bool nsImapServerResponseParser::msg_fet
             specialLineEnding || (!lastChunk && (charsReadSoFar == numberOfCharsInThisChunk)),
             fCurrentLine);
       }
     }
   }
 
   // This would be a good thing to log.
   if (lastCRLFwasCRCRLF)
-    PR_LOG(IMAP, PR_LOG_ALWAYS, ("PARSER: CR/LF fell on chunk boundary."));
+    MOZ_LOG(IMAP, mozilla::LogLevel::Info, ("PARSER: CR/LF fell on chunk boundary."));
 
   if (ContinueParse())
   {
     if (charsReadSoFar > numberOfCharsInThisChunk)
     {
       // move the lexical analyzer state to the end of this message because this message
       // fetch ends in the middle of this line.
       AdvanceTokenizerStartingPoint(strlen(fCurrentLine) - (charsReadSoFar - numberOfCharsInThisChunk));
--- a/mailnews/import/applemail/src/nsAppleMailImport.h
+++ b/mailnews/import/applemail/src/nsAppleMailImport.h
@@ -1,29 +1,29 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #ifndef nsAppleMailImport_h___
 #define nsAppleMailImport_h___
 
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "nsIImportModule.h"
 #include "nsCOMPtr.h"
 #include "nsIStringBundle.h"
 #include "nsIImportMail.h"
 
 // logging facilities
 extern PRLogModuleInfo *APPLEMAILLOGMODULE;
 
-#define IMPORT_LOG0(x)          PR_LOG(APPLEMAILLOGMODULE, PR_LOG_DEBUG, (x))
-#define IMPORT_LOG1(x, y)       PR_LOG(APPLEMAILLOGMODULE, PR_LOG_DEBUG, (x, y))
-#define IMPORT_LOG2(x, y, z)    PR_LOG(APPLEMAILLOGMODULE, PR_LOG_DEBUG, (x, y, z))
-#define IMPORT_LOG3(a, b, c, d) PR_LOG(APPLEMAILLOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
+#define IMPORT_LOG0(x)          MOZ_LOG(APPLEMAILLOGMODULE, mozilla::LogLevel::Debug, (x))
+#define IMPORT_LOG1(x, y)       MOZ_LOG(APPLEMAILLOGMODULE, mozilla::LogLevel::Debug, (x, y))
+#define IMPORT_LOG2(x, y, z)    MOZ_LOG(APPLEMAILLOGMODULE, mozilla::LogLevel::Debug, (x, y, z))
+#define IMPORT_LOG3(a, b, c, d) MOZ_LOG(APPLEMAILLOGMODULE, mozilla::LogLevel::Debug, (a, b, c, d))
 
 #define NS_APPLEMAILIMPL_CID \
 { 0x9117a1ea, 0xe012, 0x43b5, { 0xa0, 0x20, 0xcb, 0x8a, 0x66, 0xcc, 0x09, 0xe1 } }
 
 #define NS_APPLEMAILIMPORT_CID \
 { 0x6d3f101c, 0x70ec, 0x4e04, { 0xb6, 0x8d, 0x99, 0x08, 0xd1, 0xae, 0xdd, 0xf3 } }
 
 #define NS_APPLEMAILIMPL_CONTRACTID "@mozilla.org/import/import-appleMailImpl;1" 
--- a/mailnews/import/eudora/src/EudoraDebugLog.h
+++ b/mailnews/import/eudora/src/EudoraDebugLog.h
@@ -7,19 +7,19 @@
 #ifndef EudoraDebugLog_h___
 #define EudoraDebugLog_h___
 
 #ifdef NS_DEBUG
 #define IMPORT_DEBUG  1
 #endif
 
 // Use PR_LOG for logging.
-#include "prlog.h"
+#include "mozilla/Logging.h"
 extern PRLogModuleInfo *EUDORALOGMODULE;  // Logging module
 
-#define IMPORT_LOG0(x)          PR_LOG(EUDORALOGMODULE, PR_LOG_DEBUG, (x))
-#define IMPORT_LOG1(x, y)       PR_LOG(EUDORALOGMODULE, PR_LOG_DEBUG, (x, y))
-#define IMPORT_LOG2(x, y, z)    PR_LOG(EUDORALOGMODULE, PR_LOG_DEBUG, (x, y, z))
-#define IMPORT_LOG3(a, b, c, d) PR_LOG(EUDORALOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
+#define IMPORT_LOG0(x)          MOZ_LOG(EUDORALOGMODULE, mozilla::LogLevel::Debug, (x))
+#define IMPORT_LOG1(x, y)       MOZ_LOG(EUDORALOGMODULE, mozilla::LogLevel::Debug, (x, y))
+#define IMPORT_LOG2(x, y, z)    MOZ_LOG(EUDORALOGMODULE, mozilla::LogLevel::Debug, (x, y, z))
+#define IMPORT_LOG3(a, b, c, d) MOZ_LOG(EUDORALOGMODULE, mozilla::LogLevel::Debug, (a, b, c, d))
 
 
 
 #endif /* EudoraDebugLog_h___ */
--- a/mailnews/import/oexpress/OEDebugLog.h
+++ b/mailnews/import/oexpress/OEDebugLog.h
@@ -1,20 +1,20 @@
 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 
 #ifndef OEDebugLog_h___
 #define OEDebugLog_h___
 
-// Use PR_LOG for logging.
-#include "prlog.h"
+// Use MOZ_LOG for logging.
+#include "mozilla/Logging.h"
 extern PRLogModuleInfo *OELOGMODULE;  // Logging module
 
-#define IMPORT_LOG0(x)          PR_LOG(OELOGMODULE, PR_LOG_DEBUG, (x))
-#define IMPORT_LOG1(x, y)       PR_LOG(OELOGMODULE, PR_LOG_DEBUG, (x, y))
-#define IMPORT_LOG2(x, y, z)    PR_LOG(OELOGMODULE, PR_LOG_DEBUG, (x, y, z))
-#define IMPORT_LOG3(a, b, c, d) PR_LOG(OELOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
+#define IMPORT_LOG0(x)          MOZ_LOG(OELOGMODULE, mozilla::LogLevel::Debug, (x))
+#define IMPORT_LOG1(x, y)       MOZ_LOG(OELOGMODULE, mozilla::LogLevel::Debug, (x, y))
+#define IMPORT_LOG2(x, y, z)    MOZ_LOG(OELOGMODULE, mozilla::LogLevel::Debug, (x, y, z))
+#define IMPORT_LOG3(a, b, c, d) MOZ_LOG(OELOGMODULE, mozilla::LogLevel::Debug, (a, b, c, d))
 
 
 
 #endif /* OEDebugLog_h___ */
--- a/mailnews/import/outlook/src/OutlookDebugLog.h
+++ b/mailnews/import/outlook/src/OutlookDebugLog.h
@@ -6,19 +6,19 @@
 #ifndef OutlookDebugLog_h___
 #define OutlookDebugLog_h___
 
 #ifdef NS_DEBUG
 #define IMPORT_DEBUG  1
 #endif
 
 // Use PR_LOG for logging.
-#include "prlog.h"
+#include "mozilla/Logging.h"
 extern PRLogModuleInfo *OUTLOOKLOGMODULE;  // Logging module
 
-#define IMPORT_LOG0(x)          PR_LOG(OUTLOOKLOGMODULE, PR_LOG_DEBUG, (x))
-#define IMPORT_LOG1(x, y)       PR_LOG(OUTLOOKLOGMODULE, PR_LOG_DEBUG, (x, y))
-#define IMPORT_LOG2(x, y, z)    PR_LOG(OUTLOOKLOGMODULE, PR_LOG_DEBUG, (x, y, z))
-#define IMPORT_LOG3(a, b, c, d) PR_LOG(OUTLOOKLOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
+#define IMPORT_LOG0(x)          MOZ_LOG(OUTLOOKLOGMODULE, mozilla::LogLevel::Debug, (x))
+#define IMPORT_LOG1(x, y)       MOZ_LOG(OUTLOOKLOGMODULE, mozilla::LogLevel::Debug, (x, y))
+#define IMPORT_LOG2(x, y, z)    MOZ_LOG(OUTLOOKLOGMODULE, mozilla::LogLevel::Debug, (x, y, z))
+#define IMPORT_LOG3(a, b, c, d) MOZ_LOG(OUTLOOKLOGMODULE, mozilla::LogLevel::Debug, (a, b, c, d))
 
 
 
 #endif /* OutlookDebugLog_h___ */
--- a/mailnews/import/src/ImportDebug.h
+++ b/mailnews/import/src/ImportDebug.h
@@ -5,18 +5,18 @@
 
 #ifndef ImportDebug_h___
 #define ImportDebug_h___
 
 #ifdef NS_DEBUG
 #define IMPORT_DEBUG  1
 #endif
 
-// Use PR_LOG for logging.
-#include "prlog.h"
+// Use MOZ_LOG for logging.
+#include "mozilla/Logging.h"
 extern PRLogModuleInfo *IMPORTLOGMODULE;  // Logging module
 
-#define IMPORT_LOG0(x)          PR_LOG(IMPORTLOGMODULE, PR_LOG_DEBUG, (x))
-#define IMPORT_LOG1(x, y)       PR_LOG(IMPORTLOGMODULE, PR_LOG_DEBUG, (x, y))
-#define IMPORT_LOG2(x, y, z)    PR_LOG(IMPORTLOGMODULE, PR_LOG_DEBUG, (x, y, z))
-#define IMPORT_LOG3(a, b, c, d) PR_LOG(IMPORTLOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
+#define IMPORT_LOG0(x)          MOZ_LOG(IMPORTLOGMODULE, mozilla::LogLevel::Debug, (x))
+#define IMPORT_LOG1(x, y)       MOZ_LOG(IMPORTLOGMODULE, mozilla::LogLevel::Debug, (x, y))
+#define IMPORT_LOG2(x, y, z)    MOZ_LOG(IMPORTLOGMODULE, mozilla::LogLevel::Debug, (x, y, z))
+#define IMPORT_LOG3(a, b, c, d) MOZ_LOG(IMPORTLOGMODULE, mozilla::LogLevel::Debug, (a, b, c, d))
 
 #endif
--- a/mailnews/import/text/src/TextDebugLog.h
+++ b/mailnews/import/text/src/TextDebugLog.h
@@ -3,19 +3,19 @@
  * 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/. */
 
 #ifndef TextDebugLog_h___
 #define TextDebugLog_h___
 
 // Use PR_LOG for logging.
-#include "prlog.h"
+#include "mozilla/Logging.h"
 extern PRLogModuleInfo *TEXTIMPORTLOGMODULE;  // Logging module
 
-#define IMPORT_LOG0(x)          PR_LOG(TEXTIMPORTLOGMODULE, PR_LOG_DEBUG, (x))
-#define IMPORT_LOG1(x, y)       PR_LOG(TEXTIMPORTLOGMODULE, PR_LOG_DEBUG, (x, y))
-#define IMPORT_LOG2(x, y, z)    PR_LOG(TEXTIMPORTLOGMODULE, PR_LOG_DEBUG, (x, y, z))
-#define IMPORT_LOG3(a, b, c, d) PR_LOG(TEXTIMPORTLOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
+#define IMPORT_LOG0(x)          MOZ_LOG(TEXTIMPORTLOGMODULE, mozilla::LogLevel::Debug, (x))
+#define IMPORT_LOG1(x, y)       MOZ_LOG(TEXTIMPORTLOGMODULE, mozilla::LogLevel::Debug, (x, y))
+#define IMPORT_LOG2(x, y, z)    MOZ_LOG(TEXTIMPORTLOGMODULE, mozilla::LogLevel::Debug, (x, y, z))
+#define IMPORT_LOG3(a, b, c, d) MOZ_LOG(TEXTIMPORTLOGMODULE, mozilla::LogLevel::Debug, (a, b, c, d))
 
 
 
 #endif /* TextDebugLog_h___ */
--- a/mailnews/import/vcard/src/nsVCardAddress.h
+++ b/mailnews/import/vcard/src/nsVCardAddress.h
@@ -1,23 +1,23 @@
 /* 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/. */
 
 #ifndef nsVCardAddress_h__
 #define nsVCardAddress_h__
 
-#include "prlog.h"
+#include "mozilla/Logging.h"
 
 extern PRLogModuleInfo *VCARDLOGMODULE;  // Logging module
 
-#define IMPORT_LOG0(x)          PR_LOG(VCARDLOGMODULE, PR_LOG_DEBUG, (x))
-#define IMPORT_LOG1(x, y)       PR_LOG(VCARDLOGMODULE, PR_LOG_DEBUG, (x, y))
-#define IMPORT_LOG2(x, y, z)    PR_LOG(VCARDLOGMODULE, PR_LOG_DEBUG, (x, y, z))
-#define IMPORT_LOG3(a, b, c, d) PR_LOG(VCARDLOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
+#define IMPORT_LOG0(x)          MOZ_LOG(VCARDLOGMODULE, mozilla::LogLevel::Debug, (x))
+#define IMPORT_LOG1(x, y)       MOZ_LOG(VCARDLOGMODULE, mozilla::LogLevel::Debug, (x, y))
+#define IMPORT_LOG2(x, y, z)    MOZ_LOG(VCARDLOGMODULE, mozilla::LogLevel::Debug, (x, y, z))
+#define IMPORT_LOG3(a, b, c, d) MOZ_LOG(VCARDLOGMODULE, mozilla::LogLevel::Debug, (a, b, c, d))
 
 class nsIAddrDatabase;
 class nsIFile;
 class nsILineInputStream;
 
 class nsVCardAddress {
 public:
   nsVCardAddress();
--- a/mailnews/import/winlivemail/WMDebugLog.h
+++ b/mailnews/import/winlivemail/WMDebugLog.h
@@ -2,19 +2,19 @@
 /* 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/. */
 
 #ifndef WMDebugLog_h___
 #define WMDebugLog_h___
 
 // Use PR_LOG for logging.
-#include "prlog.h"
+#include "mozilla/Logging.h"
 extern PRLogModuleInfo *WMLOGMODULE;  // Logging module
 
-#define IMPORT_LOG0(x)          PR_LOG(WMLOGMODULE, PR_LOG_DEBUG, (x))
-#define IMPORT_LOG1(x, y)       PR_LOG(WMLOGMODULE, PR_LOG_DEBUG, (x, y))
-#define IMPORT_LOG2(x, y, z)    PR_LOG(WMLOGMODULE, PR_LOG_DEBUG, (x, y, z))
-#define IMPORT_LOG3(a, b, c, d) PR_LOG(WMLOGMODULE, PR_LOG_DEBUG, (a, b, c, d))
+#define IMPORT_LOG0(x)          MOZ_LOG(WMLOGMODULE, mozilla::LogLevel::Debug, (x))
+#define IMPORT_LOG1(x, y)       MOZ_LOG(WMLOGMODULE, mozilla::LogLevel::Debug, (x, y))
+#define IMPORT_LOG2(x, y, z)    MOZ_LOG(WMLOGMODULE, mozilla::LogLevel::Debug, (x, y, z))
+#define IMPORT_LOG3(a, b, c, d) MOZ_LOG(WMLOGMODULE, mozilla::LogLevel::Debug, (a, b, c, d))
 
 
 
 #endif /* WMDebugLog_h___ */
--- a/mailnews/local/src/nsMailboxProtocol.cpp
+++ b/mailnews/local/src/nsMailboxProtocol.cpp
@@ -11,17 +11,17 @@
 #include "nsIMsgDatabase.h"
 #include "nsIMsgHdr.h"
 #include "nsMsgLineBuffer.h"
 #include "nsMsgDBCID.h"
 #include "nsIMsgMailNewsUrl.h"
 #include "nsICopyMsgStreamListener.h"
 #include "nsMsgMessageFlags.h"
 #include "prtime.h"
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "prerror.h"
 #include "prprf.h"
 #include "nspr.h"
 
 PRLogModuleInfo *MAILBOX;
 #include "nsIFileStreams.h"
 #include "nsIStreamTransportService.h"
 #include "nsIStreamConverterService.h"
@@ -367,17 +367,17 @@ NS_IMETHODIMP nsMailboxProtocol::OnStopR
   // protocol connection....
   m_nextState = MAILBOX_DONE;
   
   // the following is for smoke test purposes. QA is looking at this "Mailbox Done" string which
   // is printed out to the console and determining if the mail app loaded up correctly...obviously
   // this solution is not very good so we should look at something better, but don't remove this
   // line before talking to me (mscott) and mailnews QA....
   
-  PR_LOG(MAILBOX, PR_LOG_ALWAYS, ("Mailbox Done\n"));
+  MOZ_LOG(MAILBOX, mozilla::LogLevel::Info, ("Mailbox Done\n"));
   
   // when on stop binding is called, we as the protocol are done...let's close down the connection
   // releasing all of our interfaces. It's important to remember that this on stop binding call
   // is coming from netlib so they are never going to ping us again with on data available. This means
   // we'll never be going through the Process loop...
   
   if (m_multipleMsgMoveCopyStream)
   {
--- a/mailnews/local/src/nsMovemailService.cpp
+++ b/mailnews/local/src/nsMovemailService.cpp
@@ -30,23 +30,23 @@
 #include "nsILineInputStream.h"
 #include "nsISeekableStream.h"
 #include "nsNetUtil.h"
 #include "nsAutoPtr.h"
 #include "nsIStringBundle.h"
 #include "nsIMsgPluggableStore.h"
 #include "mozilla/Services.h"
 
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #if defined(PR_LOGGING)
 //
 // export NSPR_LOG_MODULES=Movemail:5
 //
 static PRLogModuleInfo *gMovemailLog = nullptr;
-#define LOG(args) PR_LOG(gMovemailLog, PR_LOG_DEBUG, args)
+#define LOG(args) MOZ_LOG(gMovemailLog, mozilla::LogLevel::Debug, args)
 #else
 #define LOG(args)
 #endif
 
 #define PREF_MAIL_ROOT_MOVEMAIL "mail.root.movemail"            // old - for backward compatibility only
 #define PREF_MAIL_ROOT_MOVEMAIL_REL "mail.root.movemail-rel"
 
 #define LOCK_SUFFIX ".lock"
--- a/mailnews/local/src/nsMsgMaildirStore.cpp
+++ b/mailnews/local/src/nsMsgMaildirStore.cpp
@@ -3,17 +3,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/. */
 
 /**
    Class for handling Maildir stores.
 */
 
 #include "prprf.h"
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "msgCore.h"
 #include "nsMsgMaildirStore.h"
 #include "nsIMsgFolder.h"
 #include "nsISimpleEnumerator.h"
 #include "nsMsgFolderFlags.h"
 #include "nsILocalMailIncomingServer.h"
 #include "nsCOMArray.h"
 #include "nsIFile.h"
@@ -237,17 +237,17 @@ NS_IMETHODIMP nsMsgMaildirStore::CreateF
         folderInfo->SetMailboxName(safeFolderName);
 
       unusedDB->SetSummaryValid(true);
       unusedDB->Close(true);
       aParent->UpdateSummaryTotals(true);
     }
     else
     {
-      PR_LOG(MailDirLog, PR_LOG_ALWAYS,
+      MOZ_LOG(MailDirLog, mozilla::LogLevel::Info,
             ("CreateFolder - failed creating db for new folder\n"));
       path->Remove(true); // recursive
       rv = NS_MSG_CANT_CREATE_FOLDER;
     }
   }
   child.swap(*aResult);
   return rv;
 }
@@ -611,17 +611,17 @@ nsMsgMaildirStore::GetNewMsgOutputStream
   rv = aFolder->GetFilePath(getter_AddRefs(newFile));
   NS_ENSURE_SUCCESS(rv, rv);
   newFile->Append(NS_LITERAL_STRING("tmp"));
 
   // let's check if the folder exists
   bool exists;
   newFile->Exists(&exists);
   if (!exists) {
-    PR_LOG(MailDirLog, PR_LOG_ALWAYS,
+    MOZ_LOG(MailDirLog, mozilla::LogLevel::Info,
            ("GetNewMsgOutputStream - tmp subfolder does not exist!!\n"));
     rv = newFile->Create(nsIFile::DIRECTORY_TYPE, 0755);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   // generate new file name
   nsAutoCString newName;
   newName.AppendInt(static_cast<int64_t>(PR_Now()));
@@ -884,28 +884,28 @@ nsMsgMaildirStore::GetMsgInputStream(nsI
 
   // construct path to file
   nsCOMPtr<nsIFile> path;
   nsresult rv = aMsgFolder->GetFilePath(getter_AddRefs(path));
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (aMsgToken.IsEmpty())
   {
-    PR_LOG(MailDirLog, PR_LOG_ALWAYS,
+    MOZ_LOG(MailDirLog, mozilla::LogLevel::Info,
            ("GetMsgInputStream - empty storeToken!!\n"));
     return NS_ERROR_FAILURE;
   }
 
   path->Append(NS_LITERAL_STRING("cur"));
 
   // let's check if the folder exists
   bool exists;
   path->Exists(&exists);
   if (!exists) {
-    PR_LOG(MailDirLog, PR_LOG_ALWAYS,
+    MOZ_LOG(MailDirLog, mozilla::LogLevel::Info,
            ("GetMsgInputStream - oops! cur subfolder does not exist!\n"));
     rv = path->Create(nsIFile::DIRECTORY_TYPE, 0755);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   path->AppendNative(aMsgToken);
   return NS_NewLocalFileInputStream(aResult, path);
 }
@@ -926,31 +926,31 @@ NS_IMETHODIMP nsMsgMaildirStore::DeleteM
     nsCOMPtr<nsIFile> path;
     rv = folder->GetFilePath(getter_AddRefs(path));
     NS_ENSURE_SUCCESS(rv, rv);
     nsAutoCString fileName;
     msgHdr->GetStringProperty("storeToken", getter_Copies(fileName));
 
     if (fileName.IsEmpty())
     {
-      PR_LOG(MailDirLog, PR_LOG_ALWAYS,
+      MOZ_LOG(MailDirLog, mozilla::LogLevel::Info,
              ("DeleteMessages - empty storeToken!!\n"));
       // Perhaps an offline store has not downloaded this particular message.
       continue;
     }
 
     path->Append(NS_LITERAL_STRING("cur"));
     path->AppendNative(fileName);
 
     // Let's check if the message exists.
     bool exists;
     path->Exists(&exists);
     if (!exists)
     {
-      PR_LOG(MailDirLog, PR_LOG_ALWAYS,
+      MOZ_LOG(MailDirLog, mozilla::LogLevel::Info,
              ("DeleteMessages - file does not exist !!\n"));
       // Perhaps an offline store has not downloaded this particular message.
       continue;
     }
     path->Remove(false);
   }
   return NS_OK;
 }
@@ -1036,28 +1036,28 @@ nsMsgMaildirStore::CopyMessages(bool aIs
   rv = aHdrArray->GetLength(&messageCount);
   NS_ENSURE_SUCCESS(rv, rv);
 
   for (uint32_t i = 0; i < messageCount; i++)
   {
     nsCOMPtr<nsIMsgDBHdr> srcHdr = do_QueryElementAt(aHdrArray, i, &rv);
     if (NS_FAILED(rv))
     {
-      PR_LOG(MailDirLog, PR_LOG_ALWAYS,
+      MOZ_LOG(MailDirLog, mozilla::LogLevel::Info,
              ("srcHdr null\n"));
       continue;
     }
     nsMsgKey srcKey;
     srcHdr->GetMessageKey(&srcKey);
     msgTxn->AddSrcKey(srcKey);
     nsAutoCString fileName;
     msgHdr->GetStringProperty("storeToken", getter_Copies(fileName));
     if (fileName.IsEmpty())
     {
-      PR_LOG(MailDirLog, PR_LOG_ALWAYS,
+      MOZ_LOG(MailDirLog, mozilla::LogLevel::Info,
              ("GetMsgInputStream - empty storeToken!!\n"));
       return NS_ERROR_FAILURE;
     }
 
     nsCOMPtr<nsIFile> srcFile;
     rv = srcFolderPath->Clone(getter_AddRefs(srcFile));
     NS_ENSURE_SUCCESS(rv, rv);
     srcFile->AppendNative(fileName);
--- a/mailnews/local/src/nsPop3Protocol.cpp
+++ b/mailnews/local/src/nsPop3Protocol.cpp
@@ -36,16 +36,19 @@
 #include "nsMsgUtils.h"
 #include "nsISocketTransport.h"
 #include "nsISSLSocketControl.h"
 #include "nsILineInputStream.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsMsgMessageFlags.h"
 #include "nsMsgBaseCID.h"
 #include "mozilla/Services.h"
+#include "mozilla/Logging.h"
+
+using namespace mozilla;
 
 PRLogModuleInfo *POP3LOGMODULE = nullptr;
 
 
 static int
 net_pop3_remove_messages_marked_delete(PLHashEntry* he,
                                        int msgindex,
                                        void *arg)
@@ -560,17 +563,17 @@ nsresult nsPop3Protocol::Initialize(nsIU
     mozilla::services::GetStringBundleService();
   NS_ENSURE_TRUE(bundleService, NS_ERROR_UNEXPECTED);
   return bundleService->CreateBundle("chrome://messenger/locale/localMsgs.properties", getter_AddRefs(mLocalBundle));
 }
 
 nsPop3Protocol::~nsPop3Protocol()
 {
   Cleanup();
-  PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("~nsPop3Protocol()"));
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("~nsPop3Protocol()"));
 }
 
 void nsPop3Protocol::Cleanup()
 {
   if (m_pop3ConData->newuidl)
   {
     PL_HashTableDestroy(m_pop3ConData->newuidl);
     m_pop3ConData->newuidl = nullptr;
@@ -732,17 +735,17 @@ nsresult nsPop3Protocol::StartGetAsyncPa
   // Explict NS_ENSURE_SUCCESS for debug purposes as errors tend to get
   // hidden.
   NS_ENSURE_SUCCESS(rv, rv);
   return rv;
 }
 
 NS_IMETHODIMP nsPop3Protocol::OnPromptStart(bool *aResult)
 {
-  PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("OnPromptStart()"));
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("OnPromptStart()"));
 
   *aResult = false;
 
   nsresult rv;
   nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server, &rv);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsAutoCString passwordResult;
@@ -773,26 +776,26 @@ NS_IMETHODIMP nsPop3Protocol::OnPromptSt
 
   // if the last prompt got us a bad password then show a special dialog
   if (TestFlag(POP3_PASSWORD_FAILED))
   {
     // Biff case (no msgWindow) shouldn't cause prompts or passwords to get forgotten at all
     // TODO shouldn't we skip the new password prompt below as well for biff? Just exit here?
     if (msgWindow)
     {
-      PR_LOG(POP3LOGMODULE, PR_LOG_WARN,
+      MOZ_LOG(POP3LOGMODULE, LogLevel::Warning,
           ("POP: ask user what to do (after password failed): new password, retry or cancel"));
 
       int32_t buttonPressed = 0;
       if (NS_SUCCEEDED(MsgPromptLoginFailed(msgWindow, hostName,
                                             &buttonPressed)))
       {
         if (buttonPressed == 1) // Cancel button
         {
-          PR_LOG(POP3LOGMODULE, PR_LOG_WARN, ("cancel button pressed"));
+          MOZ_LOG(POP3LOGMODULE, LogLevel::Warning, ("cancel button pressed"));
           // Abort quickly and stop trying for now.
 
           // If we haven't actually connected yet (i.e. we're doing an early
           // attempt to get the username/password but we've previously failed
           // for some reason), then skip straight to POP3_FREE as it isn't an
           // error in this connection, and just ends up with us closing the
           // socket and saying we've aborted the bind. Otherwise, pretend this
           // is an error and move on.
@@ -810,32 +813,32 @@ NS_IMETHODIMP nsPop3Protocol::OnPromptSt
 
           // As we're async, calling ProcessProtocolState gets things going
           // again.
           ProcessProtocolState(nullptr, nullptr, 0, 0);
           return NS_OK;
         }
         else if (buttonPressed == 2) // "New password" button
         {
-          PR_LOG(POP3LOGMODULE, PR_LOG_WARN, ("new password button pressed"));
+          MOZ_LOG(POP3LOGMODULE, LogLevel::Warning, ("new password button pressed"));
           // Forget the stored password
           // and we'll prompt for a new one next time around.
           rv = server->ForgetPassword();
           NS_ENSURE_SUCCESS(rv, rv);
 
           // try all methods again with new password
           ResetAuthMethods();
           // ... apart from GSSAPI, which doesn't care about passwords
           MarkAuthMethodAsFailed(POP3_HAS_AUTH_GSSAPI);
           if (m_needToRerunUrl)
             return RerunUrl();
         }
         else if (buttonPressed == 0) // "Retry" button
         {
-          PR_LOG(POP3LOGMODULE, PR_LOG_WARN, ("retry button pressed"));
+          MOZ_LOG(POP3LOGMODULE, LogLevel::Warning, ("retry button pressed"));
           // try all methods again, including GSSAPI
           ResetAuthMethods();
           ClearFlag(POP3_PASSWORD_FAILED|POP3_AUTH_FAILURE);
 
           if (m_needToRerunUrl)
             return RerunUrl();
 
           // It is a bit strange that we're going onto the next state that 
@@ -926,17 +929,17 @@ NS_IMETHODIMP nsPop3Protocol::OnStopRequ
   {
     // Check if the connection was dropped before getting back an auth error.
     // If we got the auth error, the next state would be
     // POP3_OBTAIN_PASSWORD_EARLY.
     if ((m_pop3ConData->next_state_after_response == POP3_NEXT_AUTH_STEP ||
          m_pop3ConData->next_state_after_response == POP3_AUTH_LOGIN_RESPONSE) &&
         m_pop3ConData->next_state != POP3_OBTAIN_PASSWORD_EARLY)
     {
-      PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("dropped connection before auth error"));
+      MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("dropped connection before auth error"));
       SetFlag(POP3_AUTH_FAILURE);
       m_pop3ConData->command_succeeded = false;
       m_needToRerunUrl = true;
       m_pop3ConData->next_state = POP3_NEXT_AUTH_STEP;
       ProcessProtocolState(nullptr, nullptr, 0, 0);
     }
     // We can't call nsMsgProtocol::OnStopRequest because it calls SetUrlState,
     // which notifies the URLListeners, but we need to do a bit of cleanup
@@ -949,17 +952,17 @@ NS_IMETHODIMP nsPop3Protocol::OnStopRequ
     return NS_OK;
   }
   nsresult rv = nsMsgProtocol::OnStopRequest(aRequest, aContext, aStatus);
 
   // turn off the server busy flag on stop request - we know we're done, right?
   nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
   if (server)
   {
-    PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("Clearing server busy in OnStopRequest"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("Clearing server busy in OnStopRequest"));
     server->SetServerBusy(false); // the server is not busy
   }
   if(m_pop3ConData->list_done)
     CommitState(true);
   if (NS_FAILED(aStatus) && aStatus != NS_BINDING_ABORTED)
     Abort();
   return rv;
 }
@@ -968,17 +971,17 @@ void nsPop3Protocol::Abort()
 {
   if(m_pop3ConData->msg_closure)
   {
       m_nsIPop3Sink->IncorporateAbort(m_pop3ConData->only_uidl != nullptr);
       m_pop3ConData->msg_closure = nullptr;
   }
   // need this to close the stream on the inbox.
   m_nsIPop3Sink->AbortMailDelivery(this);
-  PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("Clearing running protocol in nsPop3Protocol::Abort"));
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("Clearing running protocol in nsPop3Protocol::Abort"));
   m_pop3Server->SetRunningProtocol(nullptr);
 }
 
 NS_IMETHODIMP nsPop3Protocol::Cancel(nsresult status)  // handle stop button
 {
   Abort();
   return nsMsgProtocol::Cancel(NS_BINDING_ABORTED);
 }
@@ -1051,17 +1054,17 @@ nsresult nsPop3Protocol::LoadUrl(nsIURI*
   nsCString hostName;
   nsCString userName;
 
   nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
   if (server)
   {
     rv = server->GetLocalPath(getter_AddRefs(mailDirectory));
     NS_ENSURE_SUCCESS(rv, rv);
-    PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("Setting server busy in nsPop3Protocol::LoadUrl"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("Setting server busy in nsPop3Protocol::LoadUrl"));
     server->SetServerBusy(true); // the server is now busy
     server->GetHostName(hostName);
     server->GetUsername(userName);
   }
 
   if (!m_pop3ConData->verify_logon)
     m_pop3ConData->uidlinfo = net_pop3_load_state(hostName.get(), userName.get(), mailDirectory);
 
@@ -1120,17 +1123,17 @@ nsPop3Protocol::WaitForStartOfConnection
                                                  uint32_t length)
 {
   char * line = nullptr;
   uint32_t line_length = 0;
   bool pauseForMoreData = false;
   nsresult rv;
   line = m_lineStreamBuffer->ReadNextLine(aInputStream, line_length, pauseForMoreData, &rv);
 
-  PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS,("RECV: %s", line));
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Info,("RECV: %s", line));
   if (NS_FAILED(rv))
     return -1;
 
   if(pauseForMoreData || !line)
   {
     m_pop3ConData->pause_for_read = true; /* pause */
     PR_Free(line);
     return(line_length);
@@ -1176,17 +1179,17 @@ nsPop3Protocol::WaitForResponse(nsIInput
   if(pauseForMoreData || !line)
   {
     m_pop3ConData->pause_for_read = true; /* pause */
 
     PR_Free(line);
     return(ln);
   }
 
-  PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS,("RECV: %s", line));
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Info,("RECV: %s", line));
 
   if(*line == '+')
   {
     m_pop3ConData->command_succeeded = true;
     if(PL_strlen(line) > 4)
     {
       if(!PL_strncasecmp(line, "+OK", 3))
         m_commandResponse = line + 4;
@@ -1205,17 +1208,17 @@ nsPop3Protocol::WaitForResponse(nsIInput
       m_commandResponse  = line;
 
     // search for the response codes (RFC 2449, chapter 8 and RFC 3206)
     if(TestCapFlag(POP3_HAS_RESP_CODES | POP3_HAS_AUTH_RESP_CODE))
     {
         // code for authentication failure due to the user's credentials
         if(m_commandResponse.Find("[AUTH", true) >= 0)
         {
-          PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("setting auth failure"));
+          MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("setting auth failure"));
           SetFlag(POP3_AUTH_FAILURE);
         }
 
         // codes for failures due to other reasons
         if(m_commandResponse.Find("[LOGIN-DELAY", true) >= 0 ||
            m_commandResponse.Find("[IN-USE", true) >= 0 ||
            m_commandResponse.Find("[SYS", true) >= 0)
       SetFlag(POP3_STOPLOGIN);
@@ -1235,17 +1238,17 @@ nsPop3Protocol::WaitForResponse(nsIInput
 }
 
 int32_t
 nsPop3Protocol::Error(const char* err_code,
                       const char16_t **params,
                       uint32_t length)
 {
     
-    PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS, ("ERROR: %s", err_code));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Info, ("ERROR: %s", err_code));
 
     // the error code is just the resource name for the error string...
     // so print out that error message!
     nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
     nsString accountName;
     nsresult rv = server->GetPrettyName(accountName);
     NS_ENSURE_SUCCESS(rv, -1);
     const char16_t *titleParams[] = { accountName.get() };
@@ -1313,29 +1316,29 @@ int32_t nsPop3Protocol::Pop3SendData(con
   // remove any leftover bytes in the line buffer
   // this can happen if the last message line doesn't end with a (CR)LF
   // or a server sent two reply lines
   m_lineStreamBuffer->ClearBuffer();
 
   nsresult result = nsMsgProtocol::SendData(dataBuffer);
 
   if (!aSuppressLogging)
-      PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS, ("SEND: %s", dataBuffer));
+      MOZ_LOG(POP3LOGMODULE, LogLevel::Info, ("SEND: %s", dataBuffer));
   else
-      PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS, ("Logging suppressed for this command (it probably contained authentication information)"));
+      MOZ_LOG(POP3LOGMODULE, LogLevel::Info, ("Logging suppressed for this command (it probably contained authentication information)"));
 
   if (NS_SUCCEEDED(result))
   {
     m_pop3ConData->pause_for_read = true;
     m_pop3ConData->next_state = POP3_WAIT_FOR_RESPONSE;
     return 0;
   }
 
   m_pop3ConData->next_state = POP3_ERROR_DONE;
-  PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS, ("Pop3SendData failed: %lx", result));
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Info, ("Pop3SendData failed: %lx", result));
   return -1;
 }
 
 /*
  * POP3 AUTH extension
  */
 
 int32_t nsPop3Protocol::SendAuth()
@@ -1380,17 +1383,17 @@ int32_t nsPop3Protocol::AuthResponse(nsI
 
     if(pauseForMoreData || !line)
     {
         m_pop3ConData->pause_for_read = true; /* pause */
         PR_Free(line);
         return(0);
     }
 
-    PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS,("RECV: %s", line));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Info,("RECV: %s", line));
 
     if (!PL_strcmp(line, "."))
     {
         m_pop3Server->SetPop3CapabilityFlags(m_pop3ConData->capability_flags);
 
         // now that we've read all the AUTH responses, go for it
         m_pop3ConData->next_state = POP3_SEND_CAPA;
         m_pop3ConData->pause_for_read = false; /* don't pause */
@@ -1413,17 +1416,17 @@ int32_t nsPop3Protocol::AuthResponse(nsI
 }
 
 /*
  * POP3 CAPA extension, see RFC 2449, chapter 5
  */
 
 int32_t nsPop3Protocol::SendCapa()
 {
-    PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("SendCapa()"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("SendCapa()"));
     if(!m_pop3ConData->command_succeeded)
         return Error("pop3ServerError");
 
     nsAutoCString command("CAPA" CRLF);
 
     m_pop3ConData->next_state_after_response = POP3_CAPA_RESPONSE;
     return Pop3SendData(command.get());
 }
@@ -1451,17 +1454,17 @@ int32_t nsPop3Protocol::CapaResponse(nsI
 
     if(pauseForMoreData || !line)
     {
         m_pop3ConData->pause_for_read = true; /* pause */
         PR_Free(line);
         return(0);
     }
 
-    PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS,("RECV: %s", line));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Info,("RECV: %s", line));
 
     if (!PL_strcmp(line, "."))
     {
         // now that we've read all the CAPA responses, go for it
         m_pop3ConData->next_state = POP3_PROCESS_AUTH;
         m_pop3ConData->pause_for_read = false; /* don't pause */
     }
     else
@@ -1515,17 +1518,17 @@ int32_t nsPop3Protocol::CapaResponse(nsI
 
         if (responseLine.Find("MSN", CaseInsensitiveCompare) >= 0)
           SetCapFlag(POP3_HAS_AUTH_NTLM|POP3_HAS_AUTH_MSN);
 
         m_pop3Server->SetPop3CapabilityFlags(m_pop3ConData->capability_flags);
     }
 
     PR_Free(line);
-    PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("capa processed"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("capa processed"));
     return 0;
 }
 
 int32_t nsPop3Protocol::SendTLSResponse()
 {
   // only tear down our existing connection and open a new one if we received
   // a +OK response from the pop server after we issued the STLS command
   nsresult rv = NS_OK;
@@ -1601,17 +1604,17 @@ void nsPop3Protocol::InitPrefAuthMethods
     case nsMsgAuthMethod::secure:
       m_prefAuthMethods = POP3_HAS_AUTH_APOP |
           POP3_HAS_AUTH_CRAM_MD5 | POP3_HAS_AUTH_GSSAPI |
           POP3_HAS_AUTH_NTLM | POP3_HAS_AUTH_MSN;
       break;
     default:
       NS_ASSERTION(false, "POP: authMethod pref invalid");
       // TODO log to error console
-      PR_LOG(POP3LOGMODULE, PR_LOG_ERROR,
+      MOZ_LOG(POP3LOGMODULE, LogLevel::Error,
           ("POP: bad pref authMethod = %d\n", authMethodPrefValue));
       // fall to any
     case nsMsgAuthMethod::anything:
       m_prefAuthMethods = POP3_HAS_AUTH_USER |
           POP3_HAS_AUTH_LOGIN | POP3_HAS_AUTH_PLAIN |
           POP3_HAS_AUTH_CRAM_MD5 | POP3_HAS_AUTH_APOP |
           POP3_HAS_AUTH_GSSAPI |
           POP3_HAS_AUTH_NTLM | POP3_HAS_AUTH_MSN;
@@ -1626,20 +1629,20 @@ void nsPop3Protocol::InitPrefAuthMethods
  * Changes m_currentAuthMethod to pick the best one
  * which is allowed by server and prefs and not marked failed.
  * The order of preference and trying of auth methods is encoded here.
  */
 nsresult nsPop3Protocol::ChooseAuthMethod()
 {
   int32_t availCaps = GetCapFlags() & m_prefAuthMethods & ~m_failedAuthMethods;
 
-  PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG,
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Debug,
         ("POP auth: server caps 0x%X, pref 0x%X, failed 0x%X, avail caps 0x%X",
         GetCapFlags(), m_prefAuthMethods, m_failedAuthMethods, availCaps));
-  PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG,
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Debug,
         ("(GSSAPI = 0x%X, CRAM = 0x%X, APOP = 0x%X, NTLM = 0x%X, "
         "MSN =  0x%X, PLAIN = 0x%X, LOGIN = 0x%X, USER/PASS = 0x%X)",
         POP3_HAS_AUTH_GSSAPI, POP3_HAS_AUTH_CRAM_MD5, POP3_HAS_AUTH_APOP,
         POP3_HAS_AUTH_NTLM, POP3_HAS_AUTH_MSN, POP3_HAS_AUTH_PLAIN,
         POP3_HAS_AUTH_LOGIN, POP3_HAS_AUTH_USER));
 
   if (POP3_HAS_AUTH_GSSAPI & availCaps)
     m_currentAuthMethod = POP3_HAS_AUTH_GSSAPI;
@@ -1656,49 +1659,49 @@ nsresult nsPop3Protocol::ChooseAuthMetho
   else if (POP3_HAS_AUTH_LOGIN & availCaps)
     m_currentAuthMethod = POP3_HAS_AUTH_LOGIN;
   else if (POP3_HAS_AUTH_USER & availCaps)
     m_currentAuthMethod = POP3_HAS_AUTH_USER;
   else
   {
     // there are no matching login schemes at all, per server and prefs
     m_currentAuthMethod = POP3_AUTH_MECH_UNDEFINED;
-    PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("no auth method remaining"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("no auth method remaining"));
     return NS_ERROR_FAILURE;
   }
-  PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("trying auth method 0x%X", m_currentAuthMethod));
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("trying auth method 0x%X", m_currentAuthMethod));
   return NS_OK;
 }
 
 void nsPop3Protocol::MarkAuthMethodAsFailed(int32_t failedAuthMethod)
 {
-  PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG,
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Debug,
       ("marking auth method 0x%X failed", failedAuthMethod));
   m_failedAuthMethods |= failedAuthMethod;
 }
 
 /**
  * Start over, trying all auth methods again
  */
 void nsPop3Protocol::ResetAuthMethods()
 {
-  PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("resetting (failed) auth methods"));
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("resetting (failed) auth methods"));
   m_currentAuthMethod = POP3_AUTH_MECH_UNDEFINED;
   m_failedAuthMethods = 0;
 }
 
 /**
  * state POP3_PROCESS_AUTH
  * Called when we should try to authenticate to the server.
  * Also called when one auth method fails and we want to try and start
  * the next best auth method.
  */
 int32_t nsPop3Protocol::ProcessAuth()
 {
-    PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("ProcessAuth()"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("ProcessAuth()"));
 
     // Try to upgrade to STARTTLS -- TODO move into its own function
     if (!m_tlsEnabled)
     {
       if(TestCapFlag(POP3_HAS_STLS))
       {
         if (m_socketType == nsMsgSocketType::trySTARTTLS ||
             m_socketType == nsMsgSocketType::alwaysSTARTTLS)
@@ -1717,17 +1720,17 @@ int32_t nsPop3Protocol::ProcessAuth()
     }
 
     m_password_already_sent = false;
 
     nsresult rv = ChooseAuthMethod();
     if (NS_FAILED(rv))
     {
       // Pref doesn't match server. Now, find an appropriate error msg.
-      PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG,
+      MOZ_LOG(POP3LOGMODULE, LogLevel::Debug,
            ("ProcessAuth() early exit because no auth methods"));
 
       // AuthGSSAPI* falls in here in case of an auth failure.
       // If Kerberos was the only method, assume that
       // the user is just not logged in yet, and show an appropriate error.
       if (m_prefAuthMethods == POP3_HAS_AUTH_GSSAPI &&
           m_failedAuthMethods == POP3_HAS_AUTH_GSSAPI)
         return Error("pop3GssapiFailure");
@@ -1756,45 +1759,45 @@ int32_t nsPop3Protocol::ProcessAuth()
       else
         // just "change auth method"
         return Error("pop3AuthMechNotSupported");
     }
 
     switch (m_currentAuthMethod)
     {
       case POP3_HAS_AUTH_GSSAPI:
-        PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("POP GSSAPI"));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("POP GSSAPI"));
         m_pop3ConData->next_state = POP3_AUTH_GSSAPI;
         break;
       case POP3_HAS_AUTH_APOP:
-        PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("POP APOP"));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("POP APOP"));
         m_pop3ConData->next_state = POP3_SEND_PASSWORD;
         break;
       case POP3_HAS_AUTH_CRAM_MD5:
-        PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("POP CRAM"));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("POP CRAM"));
       case POP3_HAS_AUTH_PLAIN:
       case POP3_HAS_AUTH_USER:
-        PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("POP username"));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("POP username"));
         m_pop3ConData->next_state = POP3_SEND_USERNAME;
         break;
       case POP3_HAS_AUTH_LOGIN:
-        PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("POP AUTH=LOGIN"));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("POP AUTH=LOGIN"));
         m_pop3ConData->next_state = POP3_AUTH_LOGIN;
         break;
       case POP3_HAS_AUTH_NTLM:
-        PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("POP NTLM"));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("POP NTLM"));
         m_pop3ConData->next_state = POP3_AUTH_NTLM;
         break;
       case POP3_HAS_AUTH_NONE:
-        PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("POP no auth"));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("POP no auth"));
         m_pop3ConData->command_succeeded = true;
         m_pop3ConData->next_state = POP3_NEXT_AUTH_STEP;
         break;
       default:
-        PR_LOG(POP3LOGMODULE, PR_LOG_ERROR,
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Error,
              ("POP: m_currentAuthMethod has unknown value"));
         return Error("pop3AuthMechNotSupported");
     }
 
     m_pop3ConData->pause_for_read = false;
 
     return 0;
 }
@@ -1802,37 +1805,37 @@ int32_t nsPop3Protocol::ProcessAuth()
 /**
  * state POP3_NEXT_AUTH_STEP
  * This is called when we finished one auth step (e.g. sending username
  * or password are separate steps, similarly for AUTH LOGIN, NTLM etc.)
  * and want to proceed to the next one.
  */
 int32_t nsPop3Protocol::NextAuthStep()
 {
-    PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("NextAuthStep()"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("NextAuthStep()"));
     if (m_pop3ConData->command_succeeded)
     {
         if (m_password_already_sent || // (also true for GSSAPI)
             m_currentAuthMethod == POP3_HAS_AUTH_NONE)
         {
-            PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("login succeeded"));
+            MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("login succeeded"));
             m_nsIPop3Sink->SetUserAuthenticated(true);
             ClearFlag(POP3_PASSWORD_FAILED);
             if (m_pop3ConData->verify_logon)
               m_pop3ConData->next_state = POP3_SEND_QUIT;
             else
               m_pop3ConData->next_state = (m_pop3ConData->get_url)
                                           ? POP3_SEND_GURL : POP3_SEND_STAT;
         }
         else
             m_pop3ConData->next_state = POP3_SEND_PASSWORD;
     }
     else
     {
-        PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("command did not succeed"));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("command did not succeed"));
         // response code received shows that login failed not because of
         // wrong credential -> stop login without retry or pw dialog, only alert
         // parameter list -> user
         nsCString userName;
         nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
         nsresult rv = server->GetRealUsername(userName);
         NS_ENSURE_SUCCESS(rv, -1);
         NS_ConvertUTF8toUTF16 userNameUTF16(userName);
@@ -1843,17 +1846,17 @@ int32_t nsPop3Protocol::NextAuthStep()
             return Error("pop3PasswordFailed", params, 1);
 
           return Error("pop3UsernameFailure");
         }
         // response code received shows that server is certain about the
         // credential was wrong -> no fallback, show alert and pw dialog
         if (TestFlag(POP3_AUTH_FAILURE))
         {
-            PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG,
+            MOZ_LOG(POP3LOGMODULE, LogLevel::Debug,
                ("auth failure, setting password failed"));
             if (m_password_already_sent)
               Error("pop3PasswordFailed", params, 1);
             else
               Error("pop3UsernameFailure");
             SetFlag(POP3_PASSWORD_FAILED);
             ClearFlag(POP3_AUTH_FAILURE);
             return 0;
@@ -1861,42 +1864,42 @@ int32_t nsPop3Protocol::NextAuthStep()
 
         // We have no certain response code -> fallback and try again.
         // Mark the auth method failed, to use a different method next round.
         MarkAuthMethodAsFailed(m_currentAuthMethod);
 
         if (m_currentAuthMethod == POP3_HAS_AUTH_USER &&
             !m_password_already_sent)
         {
-            PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("USER username failed"));
+            MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("USER username failed"));
             // if USER auth method failed before sending the password,
             // the username was wrong.
             // no fallback but return error
             return Error("pop3UsernameFailure");
         }
 
         // If we have no auth method left, ask user to try with new password
         rv = ChooseAuthMethod();
         if (NS_FAILED(rv))
         {
-            PR_LOG(POP3LOGMODULE, PR_LOG_ERROR,
+            MOZ_LOG(POP3LOGMODULE, LogLevel::Error,
                 ("POP: no auth methods remaining, setting password failure"));
             /* Sever the connection and go back to the `read password' state,
                which, upon success, will re-open the connection.  Set a flag
                which causes the prompt to be different that time (to indicate
                that the old password was bogus.)
 
                But if we're just checking for new mail (biff) then don't bother
                prompting the user for a password: just fail silently.
             */
             SetFlag(POP3_PASSWORD_FAILED);
             Error("pop3PasswordFailed", params, 1);
             return 0;
         }
-        PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG,
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Debug,
            ("still have some auth methods to try"));
 
         // TODO needed?
         //m_pop3Server->SetPop3CapabilityFlags(m_pop3ConData->capability_flags);
 
         m_pop3ConData->command_succeeded = true;
 
         m_pop3ConData->next_state = POP3_PROCESS_AUTH;
@@ -1973,17 +1976,17 @@ int32_t nsPop3Protocol::AuthNtlmResponse
 
     m_pop3ConData->pause_for_read = false;
 
     return 0;
 }
 
 int32_t nsPop3Protocol::AuthGSSAPI()
 {
-    PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("AuthGSSAPI()"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("AuthGSSAPI()"));
     nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
     if (server) {
         nsAutoCString cmd;
         nsAutoCString service("pop@");
         nsCString hostName;
         nsresult rv;
         server->GetRealHostName(hostName);
         service.Append(hostName);
@@ -2021,34 +2024,34 @@ int32_t nsPop3Protocol::AuthGSSAPIRespon
 
     if (first) {
         m_GSSAPICache += CRLF;
         result = Pop3SendData(m_GSSAPICache.get());
         m_GSSAPICache.Truncate();
     }
     else {
         nsAutoCString cmd;
-        PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("GSSAPI step 2"));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("GSSAPI step 2"));
         nsresult rv = DoGSSAPIStep2(m_commandResponse, cmd);
         if (NS_FAILED(rv))
             cmd = "*";
         if (rv == NS_SUCCESS_AUTH_FINISHED) {
             m_pop3ConData->next_state_after_response = POP3_NEXT_AUTH_STEP;
             m_password_already_sent = true;
         }
         cmd += CRLF;
         result = Pop3SendData(cmd.get());
     }
 
     return result;
 }
 
 int32_t nsPop3Protocol::SendUsername()
 {
-    PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("SendUsername()"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("SendUsername()"));
     if(m_username.IsEmpty())
       return Error("pop3UsernameUndefined");
 
     // <copied from="SendPassword()">
     // Needed for NTLM
 
     // The POP3_SEND_PASSWORD/POP3_WAIT_SEND_PASSWORD states have already
     // got the password - they will have cancelled if necessary.
@@ -2071,40 +2074,40 @@ int32_t nsPop3Protocol::SendUsername()
     else if (m_currentAuthMethod == POP3_HAS_AUTH_LOGIN)
     {
         char *base64Str = PL_Base64Encode(m_username.get(), m_username.Length(), nullptr);
         cmd = base64Str;
         PR_Free(base64Str);
     }
     else if (m_currentAuthMethod == POP3_HAS_AUTH_USER)
     {
-        PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("USER login"));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("USER login"));
         cmd = "USER ";
         cmd += m_username;
     }
     else
     {
-      PR_LOG(POP3LOGMODULE, PR_LOG_ERROR,
+      MOZ_LOG(POP3LOGMODULE, LogLevel::Error,
           ("In nsPop3Protocol::SendUsername(), m_currentAuthMethod is 0x%X, "
           "but that is unexpected", m_currentAuthMethod));
       return Error("pop3AuthInternalError");
     }
 
     cmd += CRLF;
 
     m_pop3ConData->next_state_after_response = POP3_NEXT_AUTH_STEP;
 
     m_pop3ConData->pause_for_read = true;
 
     return Pop3SendData(cmd.get());
 }
 
 int32_t nsPop3Protocol::SendPassword()
 {
-  PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("SendPassword()"));
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("SendPassword()"));
   if (m_username.IsEmpty())
     return Error("pop3UsernameUndefined");
 
   // <copied to="SendUsername()">
   // Needed here, too, because APOP skips SendUsername()
   // The POP3_SEND_PASSWORD/POP3_WAIT_SEND_PASSWORD states have already
   // got the password - they will have cancelled if necessary.
   // If the password is still empty here, don't try to go on.
@@ -2117,17 +2120,17 @@ int32_t nsPop3Protocol::SendPassword()
 
   nsAutoCString cmd;
   nsresult rv;
 
   if (m_currentAuthMethod == POP3_HAS_AUTH_NTLM)
     rv = DoNtlmStep2(m_commandResponse, cmd);
   else if (m_currentAuthMethod == POP3_HAS_AUTH_CRAM_MD5)
   {
-    PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("CRAM login"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("CRAM login"));
     char buffer[512]; // TODO nsAutoCString
     unsigned char digest[DIGEST_LENGTH];
 
     char *decodedChallenge = PL_Base64Decode(m_commandResponse.get(),
     m_commandResponse.Length(), nullptr);
 
     if (decodedChallenge)
       rv = MSGCramMD5(decodedChallenge, strlen(decodedChallenge),
@@ -2153,17 +2156,17 @@ int32_t nsPop3Protocol::SendPassword()
       PR_Free(base64Str);
     }
 
     if (NS_FAILED(rv))
       cmd = "*";
   }
   else if (m_currentAuthMethod == POP3_HAS_AUTH_APOP)
   {
-    PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("APOP login"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("APOP login"));
     char buffer[512];
     unsigned char digest[DIGEST_LENGTH];
 
     rv = MSGApopMD5(m_ApopTimestamp.get(), m_ApopTimestamp.Length(),
                     m_passwordResult.get(), m_passwordResult.Length(), digest);
 
     if (NS_SUCCEEDED(rv))
     {
@@ -2181,17 +2184,17 @@ int32_t nsPop3Protocol::SendPassword()
       cmd = buffer;
     }
 
     if (NS_FAILED(rv))
       cmd = "*";
   }
   else if (m_currentAuthMethod == POP3_HAS_AUTH_PLAIN)
   {
-    PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("PLAIN login"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("PLAIN login"));
     // workaround for IPswitch's IMail server software
     // this server goes into LOGIN mode even if we send "AUTH PLAIN"
     // "VXNlc" is the beginning of the base64 encoded prompt ("Username:") for LOGIN
     if (StringBeginsWith(m_commandResponse, NS_LITERAL_CSTRING("VXNlc")))
     {
       // disable PLAIN and enable LOGIN (in case it's not already enabled)
       ClearCapFlag(POP3_HAS_AUTH_PLAIN);
       SetCapFlag(POP3_HAS_AUTH_LOGIN);
@@ -2213,32 +2216,32 @@ int32_t nsPop3Protocol::SendPassword()
     len += m_passwordResult.Length();
 
     char *base64Str = PL_Base64Encode(plain_string, len, nullptr);
     cmd = base64Str;
     PR_Free(base64Str);
   }
   else if (m_currentAuthMethod == POP3_HAS_AUTH_LOGIN)
   {
-    PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("LOGIN password"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("LOGIN password"));
     char * base64Str =
         PL_Base64Encode(m_passwordResult.get(), m_passwordResult.Length(),
                         nullptr);
     cmd = base64Str;
     PR_Free(base64Str);
   }
   else if (m_currentAuthMethod == POP3_HAS_AUTH_USER)
   {
-    PR_LOG(POP3LOGMODULE, PR_LOG_DEBUG, ("PASS password"));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("PASS password"));
     cmd = "PASS ";
     cmd += m_passwordResult;
   }
   else
   {
-    PR_LOG(POP3LOGMODULE, PR_LOG_ERROR,
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Error,
         ("In nsPop3Protocol::SendPassword(), m_currentAuthMethod is %X, "
         "but that is unexpected", m_currentAuthMethod));
     return Error("pop3AuthInternalError");
   }
 
   cmd += CRLF;
 
   // TODO needed?
@@ -2454,17 +2457,17 @@ nsPop3Protocol::GetList(nsIInputStream* 
 
   if (pauseForMoreData || !line)
   {
     m_pop3ConData->pause_for_read = true;
     PR_Free(line);
     return(ln);
   }
 
-  PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS,("RECV: %s", line));
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Info,("RECV: %s", line));
 
   /* parse the line returned from the list command
   * it looks like
   * #msg_number #bytes
   *
   * list data is terminated by a ".CRLF" line
   */
   if (!PL_strcmp(line, "."))
@@ -2624,17 +2627,17 @@ nsPop3Protocol::GetXtndXlstMsgid(nsIInpu
 
   if (pauseForMoreData || !line)
   {
     m_pop3ConData->pause_for_read = true;
     PR_Free(line);
     return ln;
   }
 
-  PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS,("RECV: %s", line));
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Info,("RECV: %s", line));
 
   /* parse the line returned from the list command
   * it looks like
   * 1 Message-ID: <3117E4DC.2699@example.com>
   *
   * list data is terminated by a ".CRLF" line
   */
   if (!PL_strcmp(line, "."))
@@ -2740,17 +2743,17 @@ int32_t nsPop3Protocol::GetUidlList(nsII
 
     if (pauseForMoreData || !line)
     {
       PR_Free(line);
       m_pop3ConData->pause_for_read = true;
       return ln;
     }
 
-    PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS,("RECV: %s", line));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Info,("RECV: %s", line));
 
     /* parse the line returned from the list command
      * it looks like
      * #msg_number uidl
      *
      * list data is terminated by a ".CRLF" line
      */
     if (!PL_strcmp(line, "."))
@@ -3235,38 +3238,38 @@ nsPop3Protocol::RetrResponse(nsIInputStr
             uidl = m_pop3ConData->msg_info[m_pop3ConData->last_accessed_msg].uidl;
 
         m_pop3ConData->parsed_bytes = 0;
         m_pop3ConData->pop3_size = m_pop3ConData->cur_msg_size;
         m_pop3ConData->assumed_end = false;
 
         m_pop3Server->GetDotFix(&m_pop3ConData->dot_fix);
 
-        PR_LOG(POP3LOGMODULE,PR_LOG_ALWAYS,
+        MOZ_LOG(POP3LOGMODULE,LogLevel::Info,
                ("Opening message stream: MSG_IncorporateBegin"));
 
         /* open the message stream so we have someplace
          * to put the data
          */
         m_pop3ConData->real_new_counter++;
         /* (rb) count only real messages being downloaded */
         rv = m_nsIPop3Sink->IncorporateBegin(uidl, m_url, flags,
                                         &m_pop3ConData->msg_closure);
 
-        PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS, ("Done opening message stream!"));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Info, ("Done opening message stream!"));
 
         if(!m_pop3ConData->msg_closure || NS_FAILED(rv))
             return Error("pop3MessageWriteError");
     }
 
     m_pop3ConData->pause_for_read = true;
 
     bool pauseForMoreData = false;
     char *line = m_lineStreamBuffer->ReadNextLine(inputStream, status, pauseForMoreData, &rv, true);
-    PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS,("RECV: %s", line));
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Info,("RECV: %s", line));
     if (NS_FAILED(rv))
       return -1;
 
     buffer_size = status;
 
     if (status == 0 && !line)  // no bytes read in...
       return (0);
 
@@ -3291,17 +3294,17 @@ nsPop3Protocol::RetrResponse(nsIInputStr
 
         // now read in the next line
         PR_Free(line);
         line = m_lineStreamBuffer->ReadNextLine(inputStream, buffer_size,
                                                 pauseForMoreData, &rv, true);
         if (NS_FAILED(rv))
           return -1;
 
-        PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS,("RECV: %s", line));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Info,("RECV: %s", line));
         // buffer_size already includes MSG_LINEBREAK_LEN so
         // subtract and add CRLF
         // but not really sure we always had CRLF in input since
         // we also treat a single LF as line ending!
         status += buffer_size - MSG_LINEBREAK_LEN + 2;
       } while (line);
     }
 
@@ -3658,31 +3661,31 @@ nsPop3Protocol::CommitState(bool remove_
  */
 nsresult nsPop3Protocol::ProcessProtocolState(nsIURI * url, nsIInputStream * aInputStream,
                                               uint64_t sourceOffset, uint32_t aLength)
 {
   int32_t status = 0;
   bool urlStatusSet = false;
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_url);
 
-  PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS, ("Entering NET_ProcessPop3 %d",
+  MOZ_LOG(POP3LOGMODULE, LogLevel::Info, ("Entering NET_ProcessPop3 %d",
     aLength));
 
   m_pop3ConData->pause_for_read = false; /* already paused; reset */
 
   if(m_username.IsEmpty())
   {
     // net_pop3_block = false;
     Error("pop3UsernameUndefined");
     return NS_MSG_SERVER_USERNAME_MISSING;
   }
 
   while(!m_pop3ConData->pause_for_read)
   {
-    PR_LOG(POP3LOGMODULE, PR_LOG_ALWAYS,
+    MOZ_LOG(POP3LOGMODULE, LogLevel::Info,
       ("POP3: Entering state: %d", m_pop3ConData->next_state));
 
     switch(m_pop3ConData->next_state)
     {
     case POP3_READ_PASSWORD:
       // This is a separate state so that we're waiting for the user to type
       // in a password while we don't actually have a connection to the pop
       // server open; this saves us from having to worry about the server
@@ -4020,17 +4023,17 @@ nsresult nsPop3Protocol::ProcessProtocol
         // no msgWindow means no re-prompt, so treat as error.
         if (TestFlag(POP3_PASSWORD_FAILED) && msgWindow)
         {
           // We get here because the password was wrong.
           if (!m_socketIsOpen && mailnewsurl)
           {
             // The server dropped the connection, so we're going
             // to re-run the url.
-            PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("need to rerun url because connection dropped during auth"));
+            MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("need to rerun url because connection dropped during auth"));
             m_needToRerunUrl = true;
             return NS_OK;
           }
           m_pop3ConData->next_state = POP3_READ_PASSWORD;
           m_pop3ConData->command_succeeded = true;
           status = 0;
           break;
         }
@@ -4044,20 +4047,20 @@ nsresult nsPop3Protocol::ProcessProtocol
       break;
 
     case POP3_FREE:
       {
         UpdateProgressPercent(0,0); // clear out the progress meter
         nsCOMPtr<nsIMsgIncomingServer> server = do_QueryInterface(m_pop3Server);
         if (server)
         {
-          PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("Clearing server busy in POP3_FREE"));
+          MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("Clearing server busy in POP3_FREE"));
           server->SetServerBusy(false); // the server is now not busy
         }
-        PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("Clearing running protocol in POP3_FREE"));
+        MOZ_LOG(POP3LOGMODULE, LogLevel::Debug, ("Clearing running protocol in POP3_FREE"));
         CloseSocket();
         m_pop3Server->SetRunningProtocol(nullptr);
         if (mailnewsurl && urlStatusSet)
           mailnewsurl->SetUrlState(false, m_pop3ConData->urlStatus);
 
         m_url = nullptr;
         return NS_OK;
       }
--- a/mailnews/local/src/nsPop3Sink.cpp
+++ b/mailnews/local/src/nsPop3Sink.cpp
@@ -55,17 +55,17 @@ nsPop3Sink::nsPop3Sink()
     m_uidlDownload = false;
     m_buildMessageUri = false;
     if (!POP3LOGMODULE)
       POP3LOGMODULE = PR_NewLogModule("POP3");
 }
 
 nsPop3Sink::~nsPop3Sink()
 {
-    PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("Calling ReleaseFolderLock from ~nsPop3Sink"));
+    MOZ_LOG(POP3LOGMODULE, mozilla::LogLevel::Debug, ("Calling ReleaseFolderLock from ~nsPop3Sink"));
     ReleaseFolderLock();
 }
 
 nsresult
 nsPop3Sink::SetUserAuthenticated(bool authed)
 {
   m_authed = authed;
   m_popServer->SetAuthenticated(authed);
@@ -223,22 +223,22 @@ nsPop3Sink::BeginMailDelivery(bool uidlD
   if (account)
     account->GetKey(m_accountKey);
 
   bool isLocked;
   nsCOMPtr <nsISupports> supports = do_QueryInterface(static_cast<nsIPop3Sink*>(this));
   m_folder->GetLocked(&isLocked);
   if(!isLocked)
   {
-    PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("BeginMailDelivery acquiring semaphore"));
+    MOZ_LOG(POP3LOGMODULE, mozilla::LogLevel::Debug, ("BeginMailDelivery acquiring semaphore"));
     m_folder->AcquireSemaphore(supports);
   }
   else
   {
-    PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("BeginMailDelivery folder locked"));
+    MOZ_LOG(POP3LOGMODULE, mozilla::LogLevel::Debug, ("BeginMailDelivery folder locked"));
     return NS_MSG_FOLDER_BUSY;
   }
   m_uidlDownload = uidlDownload;
   if (!uidlDownload)
     FindPartialMessages();
 
   m_folder->GetNumNewMessages(false, &m_numNewMessagesInFolder);
 
@@ -273,17 +273,17 @@ nsPop3Sink::EndMailDelivery(nsIPop3Proto
 
   if (m_downloadingToTempFile)
     m_tmpDownloadFile->Remove(false);
 
   // tell the parser to mark the db valid *after* closing the mailbox.
   if (m_newMailParser)
     m_newMailParser->UpdateDBFolderInfo();
 
-  PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("Calling ReleaseFolderLock from EndMailDelivery"));
+  MOZ_LOG(POP3LOGMODULE, mozilla::LogLevel::Debug, ("Calling ReleaseFolderLock from EndMailDelivery"));
   nsresult rv = ReleaseFolderLock();
   NS_ASSERTION(NS_SUCCEEDED(rv),"folder lock not released successfully");
 
   bool filtersRun;
   m_folder->CallFilterPlugins(nullptr, &filtersRun); // ??? do we need msgWindow?
   int32_t numNewMessagesInFolder;
   // if filters have marked msgs read or deleted, the num new messages count
   // will go negative by the number of messages marked read or deleted,
@@ -372,17 +372,17 @@ nsresult
 nsPop3Sink::ReleaseFolderLock()
 {
   nsresult result = NS_OK;
   if (!m_folder)
     return result;
   bool haveSemaphore;
   nsCOMPtr <nsISupports> supports = do_QueryInterface(static_cast<nsIPop3Sink*>(this));
   result = m_folder->TestSemaphore(supports, &haveSemaphore);
-  PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("ReleaseFolderLock haveSemaphore = %s", haveSemaphore ? "TRUE" : "FALSE"));
+  MOZ_LOG(POP3LOGMODULE, mozilla::LogLevel::Debug, ("ReleaseFolderLock haveSemaphore = %s", haveSemaphore ? "TRUE" : "FALSE"));
 
   if(NS_SUCCEEDED(result) && haveSemaphore)
     result = m_folder->ReleaseSemaphore(supports);
   return result;
 }
 
 nsresult
 nsPop3Sink::AbortMailDelivery(nsIPop3Protocol *protocol)
@@ -399,17 +399,17 @@ nsPop3Sink::AbortMailDelivery(nsIPop3Pro
 
   if (m_downloadingToTempFile && m_tmpDownloadFile)
     m_tmpDownloadFile->Remove(false);
 
   /* tell the parser to mark the db valid *after* closing the mailbox.
   we have truncated the inbox, so berkeley mailbox and msf file are in sync*/
   if (m_newMailParser)
     m_newMailParser->UpdateDBFolderInfo();
-  PR_LOG(POP3LOGMODULE, PR_LOG_MAX, ("Calling ReleaseFolderLock from AbortMailDelivery"));
+  MOZ_LOG(POP3LOGMODULE, mozilla::LogLevel::Debug, ("Calling ReleaseFolderLock from AbortMailDelivery"));
 
   nsresult rv = ReleaseFolderLock();
   NS_ASSERTION(NS_SUCCEEDED(rv),"folder lock not released successfully");
 
 #ifdef DEBUG
     printf("Abort mail message delivery.\n");
 #endif
   nsCOMPtr<nsIPop3Service> pop3Service(do_GetService(NS_POP3SERVICE_CONTRACTID1, &rv));
--- a/mailnews/mapi/mapihook/src/msgMapiHook.cpp
+++ b/mailnews/mapi/mapihook/src/msgMapiHook.cpp
@@ -40,16 +40,17 @@
 #include "msgMapiMain.h"
 #include "nsThreadUtils.h"
 #include "nsMsgUtils.h"
 #include "nsNetUtil.h"
 #include "mozilla/Services.h"
 #include "nsIArray.h"
 #include "nsArrayUtils.h"
 #include "nsEmbedCID.h"
+#include "mozilla/Logging.h"
 
 extern PRLogModuleInfo *MAPI;
 
 class nsMAPISendListener : public nsIMsgSendListener
 {
 public:
 
     virtual ~nsMAPISendListener() { }
@@ -407,17 +408,17 @@ nsresult nsMapiHook::PopulateCompFields(
             Bcc += Comma;
           Bcc.Append(NS_ConvertASCIItoUTF16(addressWithoutType));
           break;
         }
       }
     }
   }
 
-  PR_LOG(MAPI, PR_LOG_DEBUG, ("to: %s cc: %s bcc: %s \n", NS_ConvertUTF16toUTF8(To).get(), NS_ConvertUTF16toUTF8(Cc).get(), NS_ConvertUTF16toUTF8(Bcc).get()));
+  MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("to: %s cc: %s bcc: %s \n", NS_ConvertUTF16toUTF8(To).get(), NS_ConvertUTF16toUTF8(Cc).get(), NS_ConvertUTF16toUTF8(Bcc).get()));
   // set To, Cc, Bcc
   aCompFields->SetTo (To) ;
   aCompFields->SetCc (Cc) ;
   aCompFields->SetBcc (Bcc) ;
 
   // set subject
   if (aMessage->lpszSubject)
     aCompFields->SetSubject(NS_ConvertASCIItoUTF16(aMessage->lpszSubject));
@@ -463,17 +464,17 @@ nsresult nsMapiHook::HandleAttachments (
             // check if attachment exists
             if (aIsUnicode)
                 pFile->InitWithPath (nsDependentString(aFiles[i].lpszPathName));
             else
                 pFile->InitWithNativePath (nsDependentCString((const char*)aFiles[i].lpszPathName));
 
             bool bExist ;
             rv = pFile->Exists(&bExist) ;
-            PR_LOG(MAPI, PR_LOG_DEBUG, ("nsMapiHook::HandleAttachments: filename: %s path: %s exists = %s \n", (const char*)aFiles[i].lpszFileName, (const char*)aFiles[i].lpszPathName, bExist ? "true" : "false"));
+            MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("nsMapiHook::HandleAttachments: filename: %s path: %s exists = %s \n", (const char*)aFiles[i].lpszFileName, (const char*)aFiles[i].lpszPathName, bExist ? "true" : "false"));
             if (NS_FAILED(rv) || (!bExist) ) return NS_ERROR_FILE_TARGET_DOES_NOT_EXIST ;
 
             //Temp Directory
             nsCOMPtr <nsIFile> pTempDir;
             NS_GetSpecialDirectory(NS_OS_TEMP_DIR, getter_AddRefs(pTempDir));
 
             // create a new sub directory called moz_mapi underneath the temp directory
             pTempDir->AppendRelativePath(NS_LITERAL_STRING("moz_mapi"));
@@ -542,17 +543,17 @@ nsresult nsMapiHook::HandleAttachments (
             // set the file size
             int64_t fileSize;
             pFile->GetFileSize(&fileSize);
             attachment->SetSize(fileSize);
 
             // add the attachment
             rv = aCompFields->AddAttachment (attachment);
             if (NS_FAILED(rv))
-              PR_LOG(MAPI, PR_LOG_DEBUG, ("nsMapiHook::HandleAttachments: AddAttachment rv =  %lx\n", rv));
+              MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("nsMapiHook::HandleAttachments: AddAttachment rv =  %lx\n", rv));
         }
     }
     return rv ;
 }
 
 
 // this is used to convert non Unicode data and then populate comp fields
 nsresult nsMapiHook::PopulateCompFieldsWithConversion(lpnsMapiMessage aMessage,
@@ -606,17 +607,17 @@ nsresult nsMapiHook::PopulateCompFieldsW
     }
   }
 
   // set To, Cc, Bcc
   aCompFields->SetTo (To) ;
   aCompFields->SetCc (Cc) ;
   aCompFields->SetBcc (Bcc) ;
 
-  PR_LOG(MAPI, PR_LOG_DEBUG, ("to: %s cc: %s bcc: %s \n", NS_ConvertUTF16toUTF8(To).get(), NS_ConvertUTF16toUTF8(Cc).get(), NS_ConvertUTF16toUTF8(Bcc).get()));
+  MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("to: %s cc: %s bcc: %s \n", NS_ConvertUTF16toUTF8(To).get(), NS_ConvertUTF16toUTF8(Cc).get(), NS_ConvertUTF16toUTF8(Bcc).get()));
 
   nsAutoCString platformCharSet;
   // set subject
   if (aMessage->lpszSubject)
   {
     nsAutoString Subject ;
     if (platformCharSet.IsEmpty())
       platformCharSet.Assign(nsMsgI18NFileSystemCharset());
--- a/mailnews/mapi/mapihook/src/msgMapiImp.cpp
+++ b/mailnews/mapi/mapihook/src/msgMapiImp.cpp
@@ -27,16 +27,17 @@
 #include "nsIInputStream.h"
 #include "nsILineInputStream.h"
 #include "nsISeekableStream.h"
 #include "nsIFile.h"
 #include "nsIFileStreams.h"
 #include "nsNetCID.h"
 #include "nsMsgMessageFlags.h"
 #include "mozilla/mailnews/MimeHeaderParser.h"
+#include "mozilla/Logging.h"
 
 using namespace mozilla::mailnews;
 
 PRLogModuleInfo *MAPI;
 
 CMapiImp::CMapiImp()
 : m_cRef(1)
 {
@@ -124,27 +125,27 @@ STDMETHODIMP CMapiImp::Initialize()
 
 STDMETHODIMP CMapiImp::Login(unsigned long aUIArg, LOGIN_PW_TYPE aLogin, LOGIN_PW_TYPE aPassWord,
                 unsigned long aFlags, unsigned long *aSessionId)
 {
     HRESULT hr = E_FAIL;
      bool bNewSession = false;
     nsCString id_key;
 
-    PR_LOG(MAPI, PR_LOG_DEBUG, ("CMapiImp::Login using flags %d\n", aFlags));
+    MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("CMapiImp::Login using flags %d\n", aFlags));
     if (aFlags & MAPI_NEW_SESSION)
         bNewSession = true;
 
     // Check For Profile Name
     if (aLogin != nullptr && aLogin[0] != '\0')
     {
         if (!nsMapiHook::VerifyUserName(nsString(aLogin), id_key))
         {
             *aSessionId = MAPI_E_LOGIN_FAILURE;
-            PR_LOG(MAPI, PR_LOG_DEBUG, ("CMapiImp::Login failed for username %s\n", aLogin));
+            MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("CMapiImp::Login failed for username %s\n", aLogin));
             NS_ASSERTION(false, "failed verifying user name");
             return hr;
         }
     }
     else
     {
       // get default account
       nsresult rv;
@@ -180,37 +181,37 @@ STDMETHODIMP CMapiImp::Login(unsigned lo
         case 0 :
         {
             *aSessionId = MAPI_E_INSUFFICIENT_MEMORY;
             return hr;
         }
         default :
         {
             *aSessionId = nSession_Id;
-            PR_LOG(MAPI, PR_LOG_DEBUG, ("CMapiImp::Login succeeded\n"));
+            MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("CMapiImp::Login succeeded\n"));
             break;
         }
     }
 
     return S_OK;
 }
 
 STDMETHODIMP CMapiImp::SendMail( unsigned long aSession, lpnsMapiMessage aMessage,
      short aRecipCount, lpnsMapiRecipDesc aRecips , short aFileCount, lpnsMapiFileDesc aFiles , 
      unsigned long aFlags, unsigned long aReserved)
 {
     nsresult rv = NS_OK ;
 
-    PR_LOG(MAPI, PR_LOG_DEBUG, ("CMapiImp::SendMail using flags %d\n", aFlags));
+    MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("CMapiImp::SendMail using flags %d\n", aFlags));
     // Assign the pointers in the aMessage struct to the array of Recips and Files
     // received here from MS COM. These are used in BlindSendMail and ShowCompWin fns 
     aMessage->lpRecips = aRecips ;
     aMessage->lpFiles = aFiles ;
 
-    PR_LOG(MAPI, PR_LOG_DEBUG, ("CMapiImp::SendMail flags=%x subject: %s sender: %s\n", 
+    MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("CMapiImp::SendMail flags=%x subject: %s sender: %s\n", 
       aFlags, (char *) aMessage->lpszSubject, (aMessage->lpOriginator) ? aMessage->lpOriginator->lpszAddress : ""));
 
     /** create nsIMsgCompFields obj and populate it **/
     nsCOMPtr<nsIMsgCompFields> pCompFields = do_CreateInstance(NS_MSGCOMPFIELDS_CONTRACTID, &rv) ;
     if (NS_FAILED(rv) || (!pCompFields) ) return MAPI_E_INSUFFICIENT_MEMORY ;
 
     if (aFlags & MAPI_UNICODE)
         rv = nsMapiHook::PopulateCompFields(aMessage, pCompFields) ;
@@ -234,30 +235,30 @@ STDMETHODIMP CMapiImp::SendMail( unsigne
 }
 
 
 STDMETHODIMP CMapiImp::SendDocuments( unsigned long aSession, LPTSTR aDelimChar,
                             LPTSTR aFilePaths, LPTSTR aFileNames, ULONG aFlags)
 {
     nsresult rv = NS_OK ;
 
-    PR_LOG(MAPI, PR_LOG_DEBUG, ("CMapiImp::SendDocument using flags %d\n", aFlags));
+    MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("CMapiImp::SendDocument using flags %d\n", aFlags));
     /** create nsIMsgCompFields obj and populate it **/
     nsCOMPtr<nsIMsgCompFields> pCompFields = do_CreateInstance(NS_MSGCOMPFIELDS_CONTRACTID, &rv) ;
     if (NS_FAILED(rv) || (!pCompFields) ) return MAPI_E_INSUFFICIENT_MEMORY ;
 
     if (aFilePaths)
     {
         rv = nsMapiHook::PopulateCompFieldsForSendDocs(pCompFields, aFlags, aDelimChar, aFilePaths) ;
     }
 
     if (NS_SUCCEEDED (rv)) 
         rv = nsMapiHook::ShowComposerWindow(aSession, pCompFields);
     else
-      PR_LOG(MAPI, PR_LOG_DEBUG, ("CMapiImp::SendDocument error rv = %lx, paths = %s names = %s\n", rv, aFilePaths, aFileNames));
+      MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("CMapiImp::SendDocument error rv = %lx, paths = %s names = %s\n", rv, aFilePaths, aFileNames));
 
     return nsMAPIConfiguration::GetMAPIErrorFromNSError (rv) ;
 }
 
 nsresult CMapiImp::GetDefaultInbox(nsIMsgFolder **inboxFolder)
 {
   // get default account
   nsresult rv;
@@ -400,26 +401,26 @@ STDMETHODIMP CMapiImp::FindNext(unsigned
       return(MAPI_E_NO_MESSAGES);
     }
 
 //    TRACE("MAPI: ProcessMAPIFindNext() Found message id = %d\n", nextKey);
 
     sprintf((char *) lpszMessageID, "%d", nextKey);
   }
 
-  PR_LOG(MAPI, PR_LOG_DEBUG, ("CMapiImp::FindNext returning key %s\n", (char *) lpszMessageID));
+  MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("CMapiImp::FindNext returning key %s\n", (char *) lpszMessageID));
   return(SUCCESS_SUCCESS);
 }
 
 STDMETHODIMP CMapiImp::ReadMail(unsigned long aSession, unsigned long ulUIParam, LPTSTR lpszMessageID,
                               unsigned long flFlags, unsigned long ulReserved, lpnsMapiMessage *lppMessage)
 {
   nsresult irv;
   nsAutoCString keyString((char *) lpszMessageID);
-  PR_LOG(MAPI, PR_LOG_DEBUG, ("CMapiImp::ReadMail asking for key %s\n", (char *) lpszMessageID));
+  MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("CMapiImp::ReadMail asking for key %s\n", (char *) lpszMessageID));
   nsMsgKey msgKey = keyString.ToInteger(&irv);
   if (NS_FAILED(irv))
   {
     NS_ASSERTION(false, "invalid lpszMessageID");
     return MAPI_E_INVALID_MESSAGE;
   }
   MsgMapiListContext *listContext;
   LONG ret = InitContext(aSession, &listContext);
@@ -617,17 +618,17 @@ lpnsMapiMessage MsgMapiListContext::GetM
       if (message->lpRecips)
       {
         ConvertRecipientsToMapiFormat(parsedToRecips, message->lpRecips,
           MAPI_TO);
         ConvertRecipientsToMapiFormat(parsedCCRecips,
           &message->lpRecips[numToRecips], MAPI_CC);
       }
   
-      PR_LOG(MAPI, PR_LOG_DEBUG, ("MsgMapiListContext::GetMessage flags=%x subject %s date %s sender %s\n", 
+      MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("MsgMapiListContext::GetMessage flags=%x subject %s date %s sender %s\n", 
         flFlags, (char *) message->lpszSubject,(char *) message->lpszDateReceived, author.get()) );
 
       // Convert any body text that we have locally
       if (!(flFlags & MAPI_ENVELOPE_ONLY))
         message->lpszNoteText = (char *) ConvertBodyToMapiFormat (msgHdr);
       
     }
     if (! (flFlags & (MAPI_PEEK | MAPI_ENVELOPE_ONLY)))
@@ -743,17 +744,17 @@ char *MsgMapiListContext::ConvertBodyToM
       curLine.Append(CRLF);
       // make sure we have room left
       if (bytesCopied + curLine.Length() < msgSize)
       {
         strcpy(body + bytesCopied, curLine.get());
         bytesCopied += curLine.Length();
       }
     }
-    PR_LOG(MAPI, PR_LOG_DEBUG, ("ConvertBodyToMapiFormat size=%x allocated size %x body = %100.100s\n", 
+    MOZ_LOG(MAPI, mozilla::LogLevel::Debug, ("ConvertBodyToMapiFormat size=%x allocated size %x body = %100.100s\n", 
         bytesCopied, msgSize + 1, (char *) body) );
     body[bytesCopied] = '\0';   // rhp - fix last line garbage...
     return body;
   }
   return nullptr;
 }
 
 
--- a/mailnews/mime/emitters/nsMimeBaseEmitter.cpp
+++ b/mailnews/mime/emitters/nsMimeBaseEmitter.cpp
@@ -15,17 +15,17 @@
 #include "nsEmitterUtils.h"
 #include "nsMimeStringResources.h"
 #include "msgCore.h"
 #include "nsIComponentManager.h"
 #include "nsEmitterUtils.h"
 #include "nsIMimeStreamConverter.h"
 #include "nsIMimeConverter.h"
 #include "nsMsgMimeCID.h"
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "prprf.h"
 #include "nsIMimeHeaders.h"
 #include "nsIMsgWindow.h"
 #include "nsIMsgMailNewsUrl.h"
 #include "nsDateTimeFormatCID.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsMsgUtils.h"
@@ -424,17 +424,17 @@ nsMimeBaseEmitter::Write(const nsACStrin
   nsresult rv = NS_OK;
   uint32_t            needToWrite;
 
 #ifdef DEBUG_BenB
   // If you want to see libmime output...
   printf("%s", buf);
 #endif
 
-  PR_LOG(gMimeEmitterLogModule, PR_LOG_ALWAYS, ("%s", PromiseFlatCString(buf).get()));
+  MOZ_LOG(gMimeEmitterLogModule, mozilla::LogLevel::Info, ("%s", PromiseFlatCString(buf).get()));
   //
   // Make sure that the buffer we are "pushing" into has enough room
   // for the write operation. If not, we have to buffer, return, and get
   // it on the next time through
   //
   *amountWritten = 0;
 
   needToWrite = mBufferMgr->GetSize();
--- a/mailnews/mime/src/nsCMS.cpp
+++ b/mailnews/mime/src/nsCMS.cpp
@@ -19,28 +19,26 @@
 #include "nsNSSComponent.h"
 #include "nsNSSHelper.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/RefPtr.h"
 #include "pkix/pkixtypes.h"
 #include "ScopedNSSTypes.h"
 #include "smime.h"
 
-#include "prlog.h"
+#include "mozilla/Logging.h"
 
 using namespace mozilla;
 using namespace mozilla::psm;
 using namespace mozilla::pkix;
 
 #ifdef PR_LOGGING
 extern PRLogModuleInfo* gPIPNSSLog;
 #endif
 
-using namespace mozilla;
-
 NS_IMPL_ISUPPORTS(nsCMSMessage, nsICMSMessage, nsICMSMessage2)
 
 nsCMSMessage::nsCMSMessage()
 {
   m_cmsMsg = nullptr;
 }
 nsCMSMessage::nsCMSMessage(NSSCMSMessage *aCMSMsg)
 {
@@ -106,68 +104,68 @@ NSSCMSSignerInfo* nsCMSMessage::GetTopLe
 }
 
 NS_IMETHODIMP nsCMSMessage::GetSignerEmailAddress(char * * aEmail)
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::GetSignerEmailAddress\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::GetSignerEmailAddress\n"));
   NS_ENSURE_ARG(aEmail);
 
   NSSCMSSignerInfo *si = GetTopLevelSignerInfo();
   if (!si)
     return NS_ERROR_FAILURE;
 
   *aEmail = NSS_CMSSignerInfo_GetSignerEmailAddress(si);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsCMSMessage::GetSignerCommonName(char ** aName)
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::GetSignerCommonName\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::GetSignerCommonName\n"));
   NS_ENSURE_ARG(aName);
 
   NSSCMSSignerInfo *si = GetTopLevelSignerInfo();
   if (!si)
     return NS_ERROR_FAILURE;
 
   *aName = NSS_CMSSignerInfo_GetSignerCommonName(si);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsCMSMessage::ContentIsEncrypted(bool *isEncrypted)
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::ContentIsEncrypted\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::ContentIsEncrypted\n"));
   NS_ENSURE_ARG(isEncrypted);
 
   if (!m_cmsMsg)
     return NS_ERROR_FAILURE;
 
   *isEncrypted = NSS_CMSMessage_IsEncrypted(m_cmsMsg);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP nsCMSMessage::ContentIsSigned(bool *isSigned)
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::ContentIsSigned\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::ContentIsSigned\n"));
   NS_ENSURE_ARG(isSigned);
 
   if (!m_cmsMsg)
     return NS_ERROR_FAILURE;
 
   *isSigned = NSS_CMSMessage_IsSigned(m_cmsMsg);
 
   return NS_OK;
@@ -180,25 +178,25 @@ NS_IMETHODIMP nsCMSMessage::GetSignerCer
     return NS_ERROR_NOT_AVAILABLE;
 
   NSSCMSSignerInfo *si = GetTopLevelSignerInfo();
   if (!si)
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIX509Cert> cert;
   if (si->cert) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::GetSignerCert got signer cert\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::GetSignerCert got signer cert\n"));
 
     nsCOMPtr<nsIX509CertDB> certdb = do_GetService(NS_X509CERTDB_CONTRACTID);
     certdb->ConstructX509(reinterpret_cast<const char *>(si->cert->derCert.data),
                           si->cert->derCert.len,
                           getter_AddRefs(cert));
   }
   else {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::GetSignerCert no signer cert, do we have a cert list? %s\n",
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::GetSignerCert no signer cert, do we have a cert list? %s\n",
       (si->certList ? "yes" : "no") ));
 
     *scert = nullptr;
   }
 
   cert.forget(scert);
 
   return NS_OK;
@@ -222,57 +220,57 @@ NS_IMETHODIMP nsCMSMessage::VerifyDetach
 }
 
 nsresult nsCMSMessage::CommonVerifySignature(unsigned char* aDigestData, uint32_t aDigestDataLen)
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature, content level count %d\n", NSS_CMSMessage_ContentLevelCount(m_cmsMsg)));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature, content level count %d\n", NSS_CMSMessage_ContentLevelCount(m_cmsMsg)));
   NSSCMSContentInfo *cinfo = nullptr;
   NSSCMSSignedData *sigd = nullptr;
   NSSCMSSignerInfo *si;
   int32_t nsigners;
   RefPtr<SharedCertVerifier> certVerifier;
   nsresult rv = NS_ERROR_FAILURE;
 
   if (!NSS_CMSMessage_IsSigned(m_cmsMsg)) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - not signed\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - not signed\n"));
     return NS_ERROR_CMS_VERIFY_NOT_SIGNED;
   } 
 
   cinfo = NSS_CMSMessage_ContentLevel(m_cmsMsg, 0);
   if (cinfo) {
     // I don't like this hard cast. We should check in some way, that we really have this type.
     sigd = (NSSCMSSignedData*)NSS_CMSContentInfo_GetContent(cinfo);
   }
   
   if (!sigd) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - no content info\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - no content info\n"));
     rv = NS_ERROR_CMS_VERIFY_NO_CONTENT_INFO;
     goto loser;
   }
 
   if (aDigestData && aDigestDataLen)
   {
     SECItem digest;
     digest.data = aDigestData;
     digest.len = aDigestDataLen;
 
     if (NSS_CMSSignedData_SetDigestValue(sigd, SEC_OID_SHA1, &digest)) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - bad digest\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - bad digest\n"));
       rv = NS_ERROR_CMS_VERIFY_BAD_DIGEST;
       goto loser;
     }
   }
 
   // Import certs. Note that import failure is not a signature verification failure. //
   if (NSS_CMSSignedData_ImportCerts(sigd, CERT_GetDefaultCertDB(), certUsageEmailRecipient, true) != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - can not import certs\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - can not import certs\n"));
   }
 
   nsigners = NSS_CMSSignedData_SignerInfoCount(sigd);
   PR_ASSERT(nsigners > 0);
   NS_ENSURE_TRUE(nsigners > 0, NS_ERROR_UNEXPECTED);
   si = NSS_CMSSignedData_GetSignerInfo(sigd, 0);
 
   // See bug 324474. We want to make sure the signing cert is 
@@ -282,75 +280,75 @@ nsresult nsCMSMessage::CommonVerifySigna
   NS_ENSURE_TRUE(certVerifier, NS_ERROR_UNEXPECTED);
 
   {
     SECStatus srv = certVerifier->VerifyCert(si->cert,
                                              certificateUsageEmailSigner,
                                              Now(), nullptr /*XXX pinarg*/,
                                              nullptr /*hostname*/);
     if (srv != SECSuccess) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG,
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug,
              ("nsCMSMessage::CommonVerifySignature - signing cert not trusted now\n"));
       rv = NS_ERROR_CMS_VERIFY_UNTRUSTED;
       goto loser;
     }
   }
 
   // We verify the first signer info,  only //
   // XXX: NSS_CMSSignedData_VerifySignerInfo calls CERT_VerifyCert, which
   // requires NSS's certificate verification configuration to be done in
   // order to work well (e.g. honoring OCSP preferences and proxy settings
   // for OCSP requests), but Gecko stopped doing that configuration. Something
   // similar to what was done for Gecko bug 1028643 needs to be done here too.
   if (NSS_CMSSignedData_VerifySignerInfo(sigd, 0, CERT_GetDefaultCertDB(), certUsageEmailSigner) != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - unable to verify signature\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - unable to verify signature\n"));
 
     if (NSSCMSVS_SigningCertNotFound == si->verificationStatus) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - signing cert not found\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - signing cert not found\n"));
       rv = NS_ERROR_CMS_VERIFY_NOCERT;
     }
     else if(NSSCMSVS_SigningCertNotTrusted == si->verificationStatus) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - signing cert not trusted at signing time\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - signing cert not trusted at signing time\n"));
       rv = NS_ERROR_CMS_VERIFY_UNTRUSTED;
     }
     else if(NSSCMSVS_Unverified == si->verificationStatus) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - can not verify\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - can not verify\n"));
       rv = NS_ERROR_CMS_VERIFY_ERROR_UNVERIFIED;
     }
     else if(NSSCMSVS_ProcessingError == si->verificationStatus) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - processing error\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - processing error\n"));
       rv = NS_ERROR_CMS_VERIFY_ERROR_PROCESSING;
     }
     else if(NSSCMSVS_BadSignature == si->verificationStatus) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - bad signature\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - bad signature\n"));
       rv = NS_ERROR_CMS_VERIFY_BAD_SIGNATURE;
     }
     else if(NSSCMSVS_DigestMismatch == si->verificationStatus) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - digest mismatch\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - digest mismatch\n"));
       rv = NS_ERROR_CMS_VERIFY_DIGEST_MISMATCH;
     }
     else if(NSSCMSVS_SignatureAlgorithmUnknown == si->verificationStatus) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - algo unknown\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - algo unknown\n"));
       rv = NS_ERROR_CMS_VERIFY_UNKNOWN_ALGO;
     }
     else if(NSSCMSVS_SignatureAlgorithmUnsupported == si->verificationStatus) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - algo not supported\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - algo not supported\n"));
       rv = NS_ERROR_CMS_VERIFY_UNSUPPORTED_ALGO;
     }
     else if(NSSCMSVS_MalformedSignature == si->verificationStatus) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - malformed signature\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - malformed signature\n"));
       rv = NS_ERROR_CMS_VERIFY_MALFORMED_SIGNATURE;
     }
 
     goto loser;
   }
 
   // Save the profile. Note that save import failure is not a signature verification failure. //
   if (NSS_SMIMESignerInfo_SaveSMIMEProfile(si) != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CommonVerifySignature - unable to save smime profile\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CommonVerifySignature - unable to save smime profile\n"));
   }
 
   rv = NS_OK;
 loser:
   return rv;
 }
 
 NS_IMETHODIMP nsCMSMessage::AsyncVerifySignature(
@@ -530,17 +528,17 @@ private:
 };
 
 NS_IMETHODIMP nsCMSMessage::CreateEncrypted(nsIArray * aRecipientCerts)
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateEncrypted\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateEncrypted\n"));
   NSSCMSContentInfo *cinfo;
   NSSCMSEnvelopedData *envd;
   NSSCMSRecipientInfo *recipientInfo;
   nsZeroTerminatedCertArray recipientCerts;
   SECOidTag bulkAlgTag;
   int keySize;
   uint32_t i;
   nsresult rv = NS_ERROR_FAILURE;
@@ -562,54 +560,54 @@ NS_IMETHODIMP nsCMSMessage::CreateEncryp
 
     mozilla::ScopedCERTCertificate c(x509cert->GetCert());
     recipientCerts.set(i, c.get());
   }
   
   // Find a bulk key algorithm //
   if (NSS_SMIMEUtil_FindBulkAlgForRecipients(recipientCerts.getRawArray(), &bulkAlgTag,
                                             &keySize) != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateEncrypted - can't find bulk alg for recipients\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateEncrypted - can't find bulk alg for recipients\n"));
     rv = NS_ERROR_CMS_ENCRYPT_NO_BULK_ALG;
     goto loser;
   }
 
   m_cmsMsg = NSS_CMSMessage_Create(nullptr);
   if (!m_cmsMsg) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateEncrypted - can't create new cms message\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateEncrypted - can't create new cms message\n"));
     rv = NS_ERROR_OUT_OF_MEMORY;
     goto loser;
   }
 
   if ((envd = NSS_CMSEnvelopedData_Create(m_cmsMsg, bulkAlgTag, keySize)) == nullptr) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateEncrypted - can't create enveloped data\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateEncrypted - can't create enveloped data\n"));
     goto loser;
   }
 
   cinfo = NSS_CMSMessage_GetContentInfo(m_cmsMsg);
   if (NSS_CMSContentInfo_SetContent_EnvelopedData(m_cmsMsg, cinfo, envd) != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateEncrypted - can't create content enveloped data\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateEncrypted - can't create content enveloped data\n"));
     goto loser;
   }
 
   cinfo = NSS_CMSEnvelopedData_GetContentInfo(envd);
   if (NSS_CMSContentInfo_SetContent_Data(m_cmsMsg, cinfo, nullptr, false) != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateEncrypted - can't set content data\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateEncrypted - can't set content data\n"));
     goto loser;
   }
 
   // Create and attach recipient information //
   for (i=0; i < recipientCertCount; i++) {
     mozilla::ScopedCERTCertificate rc(recipientCerts.get(i));
     if ((recipientInfo = NSS_CMSRecipientInfo_Create(m_cmsMsg, rc.get())) == nullptr) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateEncrypted - can't create recipient info\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateEncrypted - can't create recipient info\n"));
       goto loser;
     }
     if (NSS_CMSEnvelopedData_AddRecipient(envd, recipientInfo) != SECSuccess) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateEncrypted - can't add recipient info\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateEncrypted - can't add recipient info\n"));
       goto loser;
     }
   }
 
   return NS_OK;
 loser:
   if (m_cmsMsg) {
     NSS_CMSMessage_Destroy(m_cmsMsg);
@@ -624,17 +622,17 @@ nsCMSMessage::CreateSigned(nsIX509Cert* 
                            unsigned char* aDigestData, uint32_t aDigestDataLen,
                            int16_t aDigestType)
 {
   NS_ENSURE_ARG(aSigningCert);
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned\n"));
   NSSCMSContentInfo *cinfo;
   NSSCMSSignedData *sigd;
   NSSCMSSignerInfo *signerinfo;
   mozilla::ScopedCERTCertificate scert(aSigningCert->GetCert());
   mozilla::ScopedCERTCertificate ecert;
   nsresult rv = NS_ERROR_FAILURE;
 
   if (!scert) {
@@ -663,112 +661,112 @@ nsCMSMessage::CreateSigned(nsIX509Cert* 
       return NS_ERROR_INVALID_ARG;
   }
 
   /*
    * create the message object
    */
   m_cmsMsg = NSS_CMSMessage_Create(nullptr); /* create a message on its own pool */
   if (!m_cmsMsg) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't create new message\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't create new message\n"));
     rv = NS_ERROR_OUT_OF_MEMORY;
     goto loser;
   }
 
   /*
    * build chain of objects: message->signedData->data
    */
   if ((sigd = NSS_CMSSignedData_Create(m_cmsMsg)) == nullptr) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't create signed data\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't create signed data\n"));
     goto loser;
   }
   cinfo = NSS_CMSMessage_GetContentInfo(m_cmsMsg);
   if (NSS_CMSContentInfo_SetContent_SignedData(m_cmsMsg, cinfo, sigd) 
           != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't set content signed data\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't set content signed data\n"));
     goto loser;
   }
 
   cinfo = NSS_CMSSignedData_GetContentInfo(sigd);
 
   /* we're always passing data in and detaching optionally */
   if (NSS_CMSContentInfo_SetContent_Data(m_cmsMsg, cinfo, nullptr, true) 
           != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't set content data\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't set content data\n"));
     goto loser;
   }
 
   /* 
    * create & attach signer information
    */
   signerinfo = NSS_CMSSignerInfo_Create(m_cmsMsg, scert.get(), digestType);
   if (!signerinfo) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't create signer info\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't create signer info\n"));
     goto loser;
   }
 
   /* we want the cert chain included for this one */
   if (NSS_CMSSignerInfo_IncludeCerts(signerinfo, NSSCMSCM_CertChain, 
                                        certUsageEmailSigner) 
           != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't include signer cert chain\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't include signer cert chain\n"));
     goto loser;
   }
 
   if (NSS_CMSSignerInfo_AddSigningTime(signerinfo, PR_Now()) 
 	      != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't add signing time\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't add signing time\n"));
     goto loser;
   }
 
   if (NSS_CMSSignerInfo_AddSMIMECaps(signerinfo) != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't add smime caps\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't add smime caps\n"));
     goto loser;
   }
 
   if (ecert) {
     if (NSS_CMSSignerInfo_AddSMIMEEncKeyPrefs(signerinfo, ecert.get(),
 	                                      CERT_GetDefaultCertDB())
 	  != SECSuccess) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't add smime enc key prefs\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't add smime enc key prefs\n"));
       goto loser;
     }
 
     if (NSS_CMSSignerInfo_AddMSSMIMEEncKeyPrefs(signerinfo, ecert.get(),
 	                                        CERT_GetDefaultCertDB())
 	  != SECSuccess) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't add MS smime enc key prefs\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't add MS smime enc key prefs\n"));
       goto loser;
     }
 
     // If signing and encryption cert are identical, don't add it twice.
     bool addEncryptionCert =
       (ecert && (!scert || !CERT_CompareCerts(ecert.get(), scert.get())));
 
     if (addEncryptionCert &&
         NSS_CMSSignedData_AddCertificate(sigd, ecert.get()) != SECSuccess) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't add own encryption certificate\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't add own encryption certificate\n"));
       goto loser;
     }
   }
 
   if (NSS_CMSSignedData_AddSignerInfo(sigd, signerinfo) != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't add signer info\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't add signer info\n"));
     goto loser;
   }
 
   // Finally, add the pre-computed digest if passed in
   if (aDigestData) {
     SECItem digest;
 
     digest.data = aDigestData;
     digest.len = aDigestDataLen;
 
     if (NSS_CMSSignedData_SetDigestValue(sigd, digestType, &digest) != SECSuccess) {
-      PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSMessage::CreateSigned - can't set digest value\n"));
+      MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSMessage::CreateSigned - can't set digest value\n"));
       goto loser;
     }
   }
 
   return NS_OK;
 loser:
   if (m_cmsMsg) {
     NSS_CMSMessage_Destroy(m_cmsMsg);
@@ -816,47 +814,47 @@ void nsCMSDecoder::destructorSafeDestroy
 
 /* void start (in NSSCMSContentCallback cb, in voidPtr arg); */
 NS_IMETHODIMP nsCMSDecoder::Start(NSSCMSContentCallback cb, void * arg)
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSDecoder::Start\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSDecoder::Start\n"));
   m_ctx = new PipUIContext();
 
   m_dcx = NSS_CMSDecoder_Start(0, cb, arg, 0, m_ctx, 0, 0);
   if (!m_dcx) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSDecoder::Start - can't start decoder\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSDecoder::Start - can't start decoder\n"));
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 /* void update (in string bug, in long len); */
 NS_IMETHODIMP nsCMSDecoder::Update(const char *buf, int32_t len)
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSDecoder::Update\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSDecoder::Update\n"));
   NSS_CMSDecoder_Update(m_dcx, (char *)buf, len);
   return NS_OK;
 }
 
 /* void finish (); */
 NS_IMETHODIMP nsCMSDecoder::Finish(nsICMSMessage ** aCMSMsg)
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSDecoder::Finish\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSDecoder::Finish\n"));
   NSSCMSMessage *cmsMsg;
   cmsMsg = NSS_CMSDecoder_Finish(m_dcx);
   m_dcx = nullptr;
   if (cmsMsg) {
     nsCMSMessage *obj = new nsCMSMessage(cmsMsg);
     // The NSS object cmsMsg still carries a reference to the context
     // we gave it on construction.
     // Make sure the context will live long enough.
@@ -904,62 +902,62 @@ void nsCMSEncoder::destructorSafeDestroy
 
 /* void start (); */
 NS_IMETHODIMP nsCMSEncoder::Start(nsICMSMessage *aMsg, NSSCMSContentCallback cb, void * arg)
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSEncoder::Start\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSEncoder::Start\n"));
   nsCMSMessage *cmsMsg = static_cast<nsCMSMessage*>(aMsg);
   m_ctx = new PipUIContext();
 
   m_ecx = NSS_CMSEncoder_Start(cmsMsg->getCMS(), cb, arg, 0, 0, 0, m_ctx, 0, 0, 0, 0);
   if (!m_ecx) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSEncoder::Start - can't start encoder\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSEncoder::Start - can't start encoder\n"));
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 /* void update (in string aBuf, in long aLen); */
 NS_IMETHODIMP nsCMSEncoder::Update(const char *aBuf, int32_t aLen)
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSEncoder::Update\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSEncoder::Update\n"));
   if (!m_ecx || NSS_CMSEncoder_Update(m_ecx, aBuf, aLen) != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSEncoder::Update - can't update encoder\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSEncoder::Update - can't update encoder\n"));
     return NS_ERROR_FAILURE;
   }
   return NS_OK;
 }
 
 /* void finish (); */
 NS_IMETHODIMP nsCMSEncoder::Finish()
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
   nsresult rv = NS_OK;
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSEncoder::Finish\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSEncoder::Finish\n"));
   if (!m_ecx || NSS_CMSEncoder_Finish(m_ecx) != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSEncoder::Finish - can't finish encoder\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSEncoder::Finish - can't finish encoder\n"));
     rv = NS_ERROR_FAILURE;
   }
   m_ecx = nullptr;
   return rv;
 }
 
 /* void encode (in nsICMSMessage aMsg); */
 NS_IMETHODIMP nsCMSEncoder::Encode(nsICMSMessage *aMsg)
 {
   nsNSSShutDownPreventionLock locker;
   if (isAlreadyShutDown())
     return NS_ERROR_NOT_AVAILABLE;
 
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSEncoder::Encode\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSEncoder::Encode\n"));
   return NS_ERROR_NOT_IMPLEMENTED;
 }
--- a/mailnews/mime/src/nsCMSSecureMessage.cpp
+++ b/mailnews/mime/src/nsCMSSecureMessage.cpp
@@ -22,21 +22,23 @@
 #include "plbase64.h"
 #include "cert.h"
 #include "cms.h"
 
 #include "nsIServiceManager.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #ifdef PR_LOGGING
 extern PRLogModuleInfo* gPIPNSSLog;
 #endif
 
+using namespace mozilla;
+
 // Standard ISupports implementation
 // NOTE: Should these be the thread-safe versions?
 
 /*****
  * nsCMSSecureMessage
  *****/
 
 // Standard ISupports implementation
@@ -60,17 +62,17 @@ nsresult nsCMSSecureMessage::Init()
   return rv;
 }
 
 /* string getCertByPrefID (in string certID); */
 NS_IMETHODIMP nsCMSSecureMessage::
 GetCertByPrefID(const char *certID, char **_retval)
 {
   nsNSSShutDownPreventionLock locker;
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::GetCertByPrefID\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::GetCertByPrefID\n"));
   nsresult rv = NS_OK;
   CERTCertificate *cert = 0;
   nsXPIDLCString nickname;
   nsCOMPtr<nsIInterfaceRequestor> ctx = new PipUIContext();
 
   *_retval = 0;
 
   nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID, &rv);
@@ -83,17 +85,17 @@ GetCertByPrefID(const char *certID, char
   if (NS_FAILED(rv)) goto done;
 
   /* Find a good cert in the user's database */
   cert = CERT_FindUserCertByUsage(CERT_GetDefaultCertDB(), const_cast<char*>(nickname.get()), 
            certUsageEmailRecipient, true, ctx);
 
   if (!cert) { 
     /* Success, but no value */
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::GetCertByPrefID - can't find user cert\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::GetCertByPrefID - can't find user cert\n"));
     goto done;
   } 
 
   /* Convert the DER to a BASE64 String */
   encode(cert->derCert.data, cert->derCert.len, _retval);
 
 done:
   if (cert) CERT_DestroyCertificate(cert);
@@ -101,28 +103,28 @@ done:
 }
 
 
 // nsCMSSecureMessage::DecodeCert
 nsresult nsCMSSecureMessage::
 DecodeCert(const char *value, nsIX509Cert ** _retval)
 {
   nsNSSShutDownPreventionLock locker;
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::DecodeCert\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::DecodeCert\n"));
   nsresult rv = NS_OK;
   int32_t length;
   unsigned char *data = 0;
 
   *_retval = 0;
 
   if (!value) { return NS_ERROR_FAILURE; }
 
   rv = decode(value, &data, &length);
   if (NS_FAILED(rv)) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::DecodeCert - can't decode cert\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::DecodeCert - can't decode cert\n"));
     return rv;
   }
 
   nsCOMPtr<nsIX509CertDB> certdb = do_GetService(NS_X509CERTDB_CONTRACTID);
   if (!certdb) {
     return NS_ERROR_FAILURE;
   }
 
@@ -141,117 +143,117 @@ DecodeCert(const char *value, nsIX509Cer
   return rv;
 }
 
 // nsCMSSecureMessage::SendMessage
 nsresult nsCMSSecureMessage::
 SendMessage(const char *msg, const char *base64Cert, char ** _retval)
 {
   nsNSSShutDownPreventionLock locker;
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::SendMessage\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::SendMessage\n"));
   nsresult rv = NS_OK;
   CERTCertificate *cert = 0;
   NSSCMSMessage *cmsMsg = 0;
   unsigned char *certDER = 0;
   int32_t derLen;
   NSSCMSEnvelopedData *env;
   NSSCMSContentInfo *cinfo;
   NSSCMSRecipientInfo *rcpt;
   SECItem output;
   PLArenaPool *arena = PORT_NewArena(1024);
   SECStatus s;
   nsCOMPtr<nsIInterfaceRequestor> ctx = new PipUIContext();
 
   /* Step 0. Create a CMS Message */
   cmsMsg = NSS_CMSMessage_Create(nullptr);
   if (!cmsMsg) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::SendMessage - can't create NSSCMSMessage\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::SendMessage - can't create NSSCMSMessage\n"));
     rv = NS_ERROR_FAILURE;
     goto done;
   }
 
   /* Step 1.  Import the certificate into NSS */
   rv = decode(base64Cert, &certDER, &derLen);
   if (NS_FAILED(rv)) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::SendMessage - can't decode / import cert into NSS\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::SendMessage - can't decode / import cert into NSS\n"));
     goto done;
   }
 
   cert = CERT_DecodeCertFromPackage((char *)certDER, derLen);
   if (!cert) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::SendMessage - can't decode cert from package\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::SendMessage - can't decode cert from package\n"));
     rv = NS_ERROR_FAILURE;
     goto done;
   }
 
   /* Step 2.  Get a signature cert */
 
   /* Step 3. Build inner (signature) content */
 
   /* Step 4. Build outer (enveloped) content */
   env = NSS_CMSEnvelopedData_Create(cmsMsg, SEC_OID_DES_EDE3_CBC, 0);
   if (!env) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::SendMessage - can't create envelope data\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::SendMessage - can't create envelope data\n"));
     rv = NS_ERROR_FAILURE;
     goto done;
   }
 
   cinfo = NSS_CMSEnvelopedData_GetContentInfo(env);
   s = NSS_CMSContentInfo_SetContent_Data(cmsMsg, cinfo, 0, false);
   if (s != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::SendMessage - can't set content data\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::SendMessage - can't set content data\n"));
     rv = NS_ERROR_FAILURE;
     goto done;
   }
 
   rcpt = NSS_CMSRecipientInfo_Create(cmsMsg, cert);
   if (!rcpt) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::SendMessage - can't create recipient info\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::SendMessage - can't create recipient info\n"));
     rv = NS_ERROR_FAILURE;
     goto done;
   }
 
   s = NSS_CMSEnvelopedData_AddRecipient(env, rcpt);
   if (s != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::SendMessage - can't add recipient\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::SendMessage - can't add recipient\n"));
     rv = NS_ERROR_FAILURE;
     goto done;
   }
 
   /* Step 5. Add content to message */
   cinfo = NSS_CMSMessage_GetContentInfo(cmsMsg);
   s = NSS_CMSContentInfo_SetContent_EnvelopedData(cmsMsg, cinfo, env);
   if (s != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::SendMessage - can't set content enveloped data\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::SendMessage - can't set content enveloped data\n"));
     rv = NS_ERROR_FAILURE;
     goto done;
   }
   
   /* Step 6. Encode */
   NSSCMSEncoderContext *ecx;
 
   output.data = 0; output.len = 0;
   ecx = NSS_CMSEncoder_Start(cmsMsg, 0, 0, &output, arena,
             0, ctx, 0, 0, 0, 0);
   if (!ecx) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::SendMessage - can't start cms encoder\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::SendMessage - can't start cms encoder\n"));
     rv = NS_ERROR_FAILURE;
     goto done;
   }
 
   s = NSS_CMSEncoder_Update(ecx, msg, strlen(msg));
   if (s != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::SendMessage - can't update encoder\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::SendMessage - can't update encoder\n"));
     rv = NS_ERROR_FAILURE;
     goto done;
   }
 
   s = NSS_CMSEncoder_Finish(ecx);
   if (s != SECSuccess) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::SendMessage - can't finish encoder\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::SendMessage - can't finish encoder\n"));
     rv = NS_ERROR_FAILURE;
     goto done;
   }
 
   /* Step 7. Base64 encode and return the result */
   rv = encode(output.data, output.len, _retval);
 
 done:
@@ -265,51 +267,51 @@ done:
 
 /*
  * nsCMSSecureMessage::ReceiveMessage
  */
 nsresult nsCMSSecureMessage::
 ReceiveMessage(const char *msg, char **_retval)
 {
   nsNSSShutDownPreventionLock locker;
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::ReceiveMessage\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::ReceiveMessage\n"));
   nsresult rv = NS_OK;
   NSSCMSDecoderContext *dcx;
   unsigned char *der = 0;
   int32_t derLen;
   NSSCMSMessage *cmsMsg = 0;
   SECItem *content;
   nsCOMPtr<nsIInterfaceRequestor> ctx = new PipUIContext();
 
   /* Step 1. Decode the base64 wrapper */
   rv = decode(msg, &der, &derLen);
   if (NS_FAILED(rv)) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::ReceiveMessage - can't base64 decode\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::ReceiveMessage - can't base64 decode\n"));
     goto done;
   }
 
   dcx = NSS_CMSDecoder_Start(0, 0, 0, /* pw */ 0, ctx, /* key */ 0, 0);
   if (!dcx) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::ReceiveMessage - can't start decoder\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::ReceiveMessage - can't start decoder\n"));
     rv = NS_ERROR_FAILURE;
     goto done;
   }
 
   (void)NSS_CMSDecoder_Update(dcx, (char *)der, derLen);
   cmsMsg = NSS_CMSDecoder_Finish(dcx);
   if (!cmsMsg) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::ReceiveMessage - can't finish decoder\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::ReceiveMessage - can't finish decoder\n"));
     rv = NS_ERROR_FAILURE;
     /* Memory leak on dcx?? */
     goto done;
   }
 
   content = NSS_CMSMessage_GetContent(cmsMsg);
   if (!content) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::ReceiveMessage - can't get content\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::ReceiveMessage - can't get content\n"));
     rv = NS_ERROR_FAILURE;
     goto done;
   }
 
   /* Copy the data */
   *_retval = (char*)malloc(content->len+1);
   memcpy(*_retval, content->data, content->len);
   (*_retval)[content->len] = 0;
@@ -331,30 +333,30 @@ encode(const unsigned char *data, int32_
 
 loser:
   return rv;
 }
 
 nsresult nsCMSSecureMessage::
 decode(const char *data, unsigned char **result, int32_t * _retval)
 {
-  PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::decode\n"));
+  MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::decode\n"));
   nsresult rv = NS_OK;
   uint32_t len = strlen(data);
   int adjust = 0;
 
   /* Compute length adjustment */
   if (data[len-1] == '=') {
     adjust++;
     if (data[len-2] == '=') adjust++;
   }
 
   *result = (unsigned char *)PL_Base64Decode(data, len, nullptr);
   if (!*result) {
-    PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsCMSSecureMessage::decode - error decoding base64\n"));
+    MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsCMSSecureMessage::decode - error decoding base64\n"));
     rv = NS_ERROR_ILLEGAL_VALUE;
     goto loser;
   }
 
   *_retval = (len*3)/4 - adjust;
 
 loser:
   return rv;
--- a/mailnews/news/src/nsNNTPProtocol.cpp
+++ b/mailnews/news/src/nsNNTPProtocol.cpp
@@ -18,17 +18,17 @@
 #include "nsMsgI18N.h"
 #include "nsINNTPNewsgroupPost.h"
 #include "nsMsgBaseCID.h"
 #include "nsMsgNewsCID.h"
 
 #include "nsINntpUrl.h"
 #include "prmem.h"
 #include "prtime.h"
-#include "prlog.h"
+#include "mozilla/Logging.h"
 #include "prerror.h"
 #include "nsStringGlue.h"
 #include "mozilla/Services.h"
 #include "mozilla/mailnews/MimeHeaderParser.h"
 
 #include "prprf.h"
 #include <algorithm>
 
@@ -84,46 +84,47 @@
 #define PREF_NEWS_CANCEL_CONFIRM  "news.cancel.confirm"
 #define PREF_NEWS_CANCEL_ALERT_ON_SUCCESS "news.cancel.alert_on_success"
 #define READ_NEWS_LIST_COUNT_MAX 500 /* number of groups to process at a time when reading the list from the server */
 #define READ_NEWS_LIST_TIMEOUT 50  /* uSec to wait until doing more */
 #define RATE_STR_BUF_LEN 32
 #define UPDATE_THRESHHOLD 25600 /* only update every 25 KB */
 
 using namespace mozilla::mailnews;
+using namespace mozilla;
 
 // NNTP extensions are supported yet
 // until the extension code is ported,
 // we'll skip right to the first nntp command
 // after doing "mode reader"
 // and "pushed" authentication (if necessary),
 //#define HAVE_NNTP_EXTENSIONS
 
 // quiet compiler warnings by defining these function prototypes
 char *MSG_UnEscapeSearchUrl (const char *commandSpecificData);
 
 /* Logging stuff */
 
 PRLogModuleInfo* NNTP = NULL;
-#define out     PR_LOG_ALWAYS
+#define out     LogLevel::Info
 
 #define NNTP_LOG_READ(buf) \
 if (NNTP==NULL) \
     NNTP = PR_NewLogModule("NNTP"); \
-PR_LOG(NNTP, out, ("(%p) Receiving: %s", this, buf)) ;
+MOZ_LOG(NNTP, out, ("(%p) Receiving: %s", this, buf)) ;
 
 #define NNTP_LOG_WRITE(buf) \
 if (NNTP==NULL) \
     NNTP = PR_NewLogModule("NNTP"); \
-PR_LOG(NNTP, out, ("(%p) Sending: %s", this, buf)) ;
+MOZ_LOG(NNTP, out, ("(%p) Sending: %s", this, buf)) ;
 
 #define NNTP_LOG_NOTE(buf) \
 if (NNTP==NULL) \
     NNTP = PR_NewLogModule("NNTP"); \
-PR_LOG(NNTP, out, ("(%p) %s",this, buf)) ;
+MOZ_LOG(NNTP, out, ("(%p) %s",this, buf)) ;
 
 const char *const stateLabels[] = {
 "NNTP_RESPONSE",
 #ifdef BLOCK_UNTIL_AVAILABLE_CONNECTION
 "NNTP_BLOCK_UNTIL_CONNECTIONS_ARE_AVAILABLE",
 "NNTP_CONNECTIONS_ARE_AVAILABLE",
 #endif
 "NNTP_CONNECT",
@@ -281,25 +282,25 @@ nsNNTPProtocol::nsNNTPProtocol(nsINntpIn
   m_startTime = PR_Now();
 
   if (aMsgWindow) {
     m_msgWindow = aMsgWindow;
   }
 
   m_runningURL = nullptr;
   m_fromCache = false;
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) creating",this));
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) initializing, so unset m_currentGroup",this));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) creating",this));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) initializing, so unset m_currentGroup",this));
   m_currentGroup.Truncate();
   m_lastActiveTimeStamp = 0;
 }
 
 nsNNTPProtocol::~nsNNTPProtocol()
 {
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) destroying",this));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) destroying",this));
   if (m_nntpServer) {
     m_nntpServer->WriteNewsrcFile();
     m_nntpServer->RemoveConnection(this);
   }
   if (m_lineStreamBuffer) {
      delete m_lineStreamBuffer;
   }
   if (mUpdateTimer) {
@@ -423,17 +424,17 @@ NS_IMETHODIMP nsNNTPProtocol::Initialize
 
     int32_t port = 0;
     nsCString hostName;
     m_url->GetPort(&port);
 
     rv = server->GetRealHostName(hostName);
     NS_ENSURE_SUCCESS(rv, rv);
 
-    PR_LOG(NNTP, PR_LOG_ALWAYS, ("(%p) opening connection to %s on port %d",
+    MOZ_LOG(NNTP,  LogLevel::Info, ("(%p) opening connection to %s on port %d",
       this, hostName.get(), port));
 
     nsCOMPtr<nsIProxyInfo> proxyInfo;
     rv = MsgExamineForProxy(this, getter_AddRefs(proxyInfo));
     if (NS_FAILED(rv)) proxyInfo = nullptr;
 
     rv = OpenNetworkSocketWithInfo(hostName.get(), port,
            (socketType == nsMsgSocketType::SSL) ? "ssl" : nullptr,
@@ -478,17 +479,17 @@ NS_IMETHODIMP nsNNTPProtocol::GetIsBusy(
 {
   NS_ENSURE_ARG_POINTER(aIsBusy);
   *aIsBusy = m_connectionBusy;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsNNTPProtocol::SetIsBusy(bool aIsBusy)
 {
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) setting busy to %d",this, aIsBusy));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) setting busy to %d",this, aIsBusy));
   m_connectionBusy = aIsBusy;
   
   // Maybe we could load another URI.
   if (!aIsBusy && m_nntpServer)
     m_nntpServer->PrepareForNextUrl(this);
 
   return NS_OK;
 }
@@ -830,21 +831,21 @@ nsNNTPProtocol::OnCacheEntryAvailable(ns
     // gets written to both
     if (access & nsICache::ACCESS_WRITE && !canRead)
     {
       // use a stream listener Tee to force data into the cache and to our current channel listener...
       nsCOMPtr<nsIStreamListener> newListener;
       nsCOMPtr<nsIStreamListenerTee> tee = do_CreateInstance(NS_STREAMLISTENERTEE_CONTRACTID, &rv);
       NS_ENSURE_SUCCESS(rv, rv);
 
-      nsCOMPtr<nsIOutputStream> out;
-      rv = entry->OpenOutputStream(0, getter_AddRefs(out));
+      nsCOMPtr<nsIOutputStream> outStream;
+      rv = entry->OpenOutputStream(0, getter_AddRefs(outStream));
       NS_ENSURE_SUCCESS(rv, rv);
 
-      rv = tee->Init(m_channelListener, out, nullptr);
+      rv = tee->Init(m_channelListener, outStream, nullptr);
       m_channelListener = do_QueryInterface(tee);
       NS_ENSURE_SUCCESS(rv, rv);
     }
     else if (canRead)
     {
       rv = ReadFromMemCache(entry);
       if (access & nsICache::ACCESS_WRITE)
         entry->MarkValid();
@@ -949,19 +950,19 @@ nsresult nsNNTPProtocol::LoadUrl(nsIURI 
 
   rv = ParseURL(aURL, group, m_messageID);
   NS_ASSERTION(NS_SUCCEEDED(rv),"failed to parse news url");
   //if (NS_FAILED(rv)) return rv;
   // XXX group returned from ParseURL is assumed to be in UTF-8
   NS_ASSERTION(MsgIsUTF8(group), "newsgroup name is not in UTF-8");
   NS_ASSERTION(m_nntpServer, "Parsing must result in an m_nntpServer");
 
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) m_messageID = %s", this, m_messageID.get()));
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) group = %s", this, group.get()));
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) m_key = %d",this,m_key));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) m_messageID = %s", this, m_messageID.get()));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) group = %s", this, group.get()));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) m_key = %d",this,m_key));
 
   if (m_newsAction == nsINntpUrl::ActionFetchArticle ||
       m_newsAction == nsINntpUrl::ActionFetchPart ||
       m_newsAction == nsINntpUrl::ActionSaveMessageToDisk)
     m_typeWanted = ARTICLE_WANTED;
   else if (m_newsAction == nsINntpUrl::ActionCancelArticle)
     m_typeWanted = CANCEL_WANTED;
   else if (m_newsAction == nsINntpUrl::ActionPostArticle)
@@ -1176,17 +1177,17 @@ NS_IMETHODIMP nsNNTPProtocol::Cancel(nsr
     return nsMsgProtocol::Cancel(NS_BINDING_ABORTED);
 }
 
 nsresult
 nsNNTPProtocol::ParseURL(nsIURI *aURL, nsCString &aGroup, nsCString &aMessageID)
 {
     NS_ENSURE_ARG_POINTER(aURL);
 
-    PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) ParseURL",this));
+    MOZ_LOG(NNTP, LogLevel::Info,("(%p) ParseURL",this));
 
     nsresult rv;
     nsCOMPtr <nsIMsgFolder> folder;
     nsCOMPtr <nsINntpService> nntpService = do_GetService(NS_NNTPSERVICE_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv,rv);
 
     nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(m_runningURL, &rv);
     NS_ENSURE_SUCCESS(rv,rv);
@@ -1195,17 +1196,17 @@ nsNNTPProtocol::ParseURL(nsIURI *aURL, n
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCString spec;
     rv = msgUrl->GetOriginalSpec(getter_Copies(spec));
     NS_ENSURE_SUCCESS(rv,rv);
 
     // if the original spec is non empty, use it to determine m_newsFolder and m_key
     if (!spec.IsEmpty()) {
-        PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) original message spec = %s",this,spec.get()));
+        MOZ_LOG(NNTP, LogLevel::Info,("(%p) original message spec = %s",this,spec.get()));
 
         rv = nntpService->DecomposeNewsURI(spec.get(), getter_AddRefs(folder), &m_key);
         NS_ENSURE_SUCCESS(rv,rv);
 
         // since we are reading a message in this folder, we can set m_newsFolder
         m_newsFolder = do_QueryInterface(folder, &rv);
         NS_ENSURE_SUCCESS(rv,rv);
 
@@ -1268,17 +1269,17 @@ nsNNTPProtocol::ParseURL(nsIURI *aURL, n
  */
 
 nsresult nsNNTPProtocol::SendData(const char * dataBuffer, bool aSuppressLogging)
 {
     if (!aSuppressLogging) {
         NNTP_LOG_WRITE(dataBuffer);
     }
     else {
-        PR_LOG(NNTP, out, ("(%p) Logging suppressed for this command (it probably contained authentication information)", this));
+        MOZ_LOG(NNTP, out, ("(%p) Logging suppressed for this command (it probably contained authentication information)", this));
     }
 
   return nsMsgProtocol::SendData(dataBuffer); // base class actually transmits the data
 }
 
 /* gets the response code from the nntp server and the
  * response line
  *
@@ -1700,17 +1701,17 @@ nsresult nsNNTPProtocol::SendFirstNNTPCo
     if (m_typeWanted == ARTICLE_WANTED) {
         if (m_key != nsMsgKey_None) {
             nsresult rv;
             nsCString newsgroupName;
             if (m_newsFolder) {
                 rv = m_newsFolder->GetRawName(newsgroupName);
                 NS_ENSURE_SUCCESS(rv,rv);
             }
-            PR_LOG(NNTP,PR_LOG_ALWAYS,
+            MOZ_LOG(NNTP, LogLevel::Info,
                    ("(%p) current group = %s, desired group = %s", this,
                    m_currentGroup.get(), newsgroupName.get()));
             // if the current group is the desired group, we can just issue the ARTICLE command
             // if not, we have to do a GROUP first
             if (newsgroupName.Equals(m_currentGroup))
               m_nextState = NNTP_SEND_ARTICLE_NUMBER;
             else
               m_nextState = NNTP_SEND_GROUP_FOR_ARTICLE;
@@ -1792,17 +1793,17 @@ nsresult nsNNTPProtocol::SendFirstNNTPCo
         m_lastArticle = 0;
 
         NS_MsgSACopy(&command, "GROUP ");
         NS_MsgSACat(&command, group_name.get());
       }
   else if (m_typeWanted == SEARCH_WANTED)
   {
     nsresult rv;
-    PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) doing GROUP for XPAT", this));
+    MOZ_LOG(NNTP, LogLevel::Info,("(%p) doing GROUP for XPAT", this));
     nsCString group_name;
 
     /* for XPAT, we have to GROUP into the group before searching */
     if (!m_newsFolder) {
         NNTP_LOG_NOTE("m_newsFolder is null, panic!");
         return NS_ERROR_FAILURE;
     }
     rv = m_newsFolder->GetRawName(group_name);
@@ -1879,17 +1880,17 @@ nsresult nsNNTPProtocol::SendFirstNNTPCo
 
     nsString group_name;
     NS_ASSERTION(m_newsFolder, "no newsFolder");
     if (m_newsFolder)
       rv = m_newsFolder->GetUnicodeName(group_name);
 
     if (m_responseCode == MK_NNTP_RESPONSE_GROUP_NO_GROUP &&
       m_typeWanted == GROUP_WANTED) {
-      PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) group (%s) not found, so unset"
+      MOZ_LOG(NNTP, LogLevel::Info,("(%p) group (%s) not found, so unset"
                                  " m_currentGroup", this,
                                  NS_ConvertUTF16toUTF8(group_name).get()));
       m_currentGroup.Truncate();
 
       m_nntpServer->GroupNotFound(m_msgWindow, group_name, true /* opening */);
     }
 
     /* if the server returned a 400 error then it is an expected
@@ -2015,17 +2016,17 @@ nsNNTPProtocol::SetCurrentGroup()
   NS_ASSERTION(m_newsFolder, "no news folder");
   if (!m_newsFolder) {
     m_currentGroup.Truncate();
     return NS_ERROR_UNEXPECTED;
   }
 
   rv = m_newsFolder->GetRawName(groupname);
   NS_ASSERTION(NS_SUCCEEDED(rv) && !groupname.IsEmpty(), "no group name");
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) SetCurrentGroup to %s",this, groupname.get()));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) SetCurrentGroup to %s",this, groupname.get()));
   m_currentGroup = groupname;
   return NS_OK;
 }
 
 nsresult nsNNTPProtocol::SendGroupForArticleResponse()
 {
   /* ignore the response code and continue
    */
@@ -2325,17 +2326,17 @@ nsresult nsNNTPProtocol::BeginAuthorizat
 
     m_nextState = NNTP_SUSPENDED;
     if (m_request)
       m_request->Suspend();
     return NS_OK;
   }
 
   NS_MsgSACopy(&command, "AUTHINFO user ");
-  PR_LOG(NNTP, PR_LOG_ALWAYS,("(%p) use %s as the username", this, username.get()));
+  MOZ_LOG(NNTP,  LogLevel::Info,("(%p) use %s as the username", this, username.get()));
   NS_MsgSACat(&command, username.get());
   NS_MsgSACat(&command, CRLF);
 
   rv = SendData(command);
 
   PR_Free(command);
 
   m_nextState = NNTP_RESPONSE;
@@ -2510,17 +2511,17 @@ NS_IMETHODIMP nsNNTPProtocol::OnPromptCa
   return ProcessProtocolState(nullptr, nullptr, 0, 0);
 }
 
 nsresult nsNNTPProtocol::DisplayNewsgroups()
 {
   m_nextState = NEWS_DONE;
   ClearFlag(NNTP_PAUSE_FOR_READ);
 
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) DisplayNewsgroups()",this));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) DisplayNewsgroups()",this));
 
   return NS_OK;
 }
 
 nsresult nsNNTPProtocol::BeginNewsgroups()
 {
   m_nextState = NNTP_NEWGROUPS;
   mBytesReceived = 0;
@@ -2557,17 +2558,17 @@ nsresult nsNNTPProtocol::ProcessNewsgrou
     if (NS_SUCCEEDED(rv) && xactive)
     {
       nsAutoCString groupName;
       rv = m_nntpServer->GetFirstGroupNeedingExtraInfo(groupName);
       if (NS_SUCCEEDED(rv)) {
         rv = m_nntpServer->FindGroup(groupName, getter_AddRefs(m_newsFolder));
         NS_ASSERTION(NS_SUCCEEDED(rv), "FindGroup failed");
         m_nextState = NNTP_LIST_XACTIVE;
-        PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) listing xactive for %s", this,
+        MOZ_LOG(NNTP, LogLevel::Info,("(%p) listing xactive for %s", this,
                                    groupName.get()));
         PR_Free(lineToFree);
         return NS_OK;
       }
     }
     m_nextState = NEWS_DONE;
 
     PR_Free(lineToFree);
@@ -2842,17 +2843,17 @@ nsNNTPProtocol::Notify(nsITimer *timer)
   NS_ASSERTION(timer == mUpdateTimer.get(), "Hey, this ain't my timer!");
   mUpdateTimer = nullptr;    // release my hold
   TimerCallback();
   return NS_OK;
 }
 
 void nsNNTPProtocol::TimerCallback()
 {
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("nsNNTPProtocol::TimerCallback\n"));
+  MOZ_LOG(NNTP, LogLevel::Info,("nsNNTPProtocol::TimerCallback\n"));
   m_nextState = NNTP_READ_LIST;
 
   // process whatever is already in the buffer at least once.
   //
   // NOTE: while downloading, it would almost be enough to just
   // resume necko since it will call us again with data.  however,
   // if we are at the end of the data stream then we must call
   // ProcessProtocolState since necko will not call us again.
@@ -2957,17 +2958,17 @@ nsresult nsNNTPProtocol::BeginReadXover(
 nsresult nsNNTPProtocol::FigureNextChunk()
 {
     nsresult rv = NS_OK;
   int32_t status = 0;
 
   nsCOMPtr<nsIMsgMailNewsUrl> mailnewsurl = do_QueryInterface(m_runningURL);
   if (m_firstArticle > 0)
   {
-      PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) add to known articles:  %d - %d", this, m_firstArticle, m_lastArticle));
+      MOZ_LOG(NNTP, LogLevel::Info,("(%p) add to known articles:  %d - %d", this, m_firstArticle, m_lastArticle));
 
       if (NS_SUCCEEDED(rv) && m_newsgroupList) {
           rv = m_newsgroupList->AddToKnownArticles(m_firstArticle,
                                                  m_lastArticle);
       }
 
     NS_ENSURE_SUCCESS(rv, rv);
   }
@@ -3004,17 +3005,17 @@ nsresult nsNNTPProtocol::FigureNextChunk
   if (m_firstArticle <= 0 || m_firstArticle > m_lastArticle)
   {
     /* Nothing more to get. */
     m_nextState = NEWS_PROCESS_XOVER;
     ClearFlag(NNTP_PAUSE_FOR_READ);
     return NS_OK;
   }
 
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) Chunk will be (%d-%d)", this, m_firstArticle, m_lastArticle));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) Chunk will be (%d-%d)", this, m_firstArticle, m_lastArticle));
 
   m_articleNumber = m_firstArticle;
 
     /* was MSG_InitXOVER() */
     if (m_newsgroupList) {
         rv = m_newsgroupList->InitXOVER(m_firstArticle, m_lastArticle);
   }
 
@@ -3290,17 +3291,17 @@ nsresult nsNNTPProtocol::ReadNewsgroupBo
     return NS_OK;
   }
 
   /* if TCP error of if there is not a full line yet return
   */
   if(!line)
     return rv;
 
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) read_group_body: got line: %s|",this,line));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) read_group_body: got line: %s|",this,line));
 
   /* End of body? */
   if (line[0]=='.' && line[1]=='\0')
   {
     m_nextState = NNTP_READ_GROUP;
     ClearFlag(NNTP_PAUSE_FOR_READ);
     return NS_OK;
   }
@@ -3478,24 +3479,24 @@ nsresult nsNNTPProtocol::StartCancel()
 }
 
 void nsNNTPProtocol::CheckIfAuthor(nsIMsgIdentity *aIdentity, const nsCString &aOldFrom, nsCString &aFrom)
 {
   nsAutoCString from;
   nsresult rv = aIdentity->GetEmail(from);
   if (NS_FAILED(rv))
     return;
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("from = %s", from.get()));
+  MOZ_LOG(NNTP, LogLevel::Info,("from = %s", from.get()));
 
   nsCString us;
   nsCString them;
   ExtractEmail(EncodedHeader(from), us);
   ExtractEmail(EncodedHeader(aOldFrom), them);
 
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("us = %s, them = %s", us.get(), them.get()));
+  MOZ_LOG(NNTP, LogLevel::Info,("us = %s, them = %s", us.get(), them.get()));
 
   if (us.Equals(them, nsCaseInsensitiveCStringComparator()))
     aFrom = from;
 }
 
 nsresult nsNNTPProtocol::DoCancel()
 {
     int32_t status = 0;
@@ -3623,17 +3624,17 @@ nsresult nsNNTPProtocol::DoCancel()
       m_nextState = NNTP_RESPONSE;
       m_nextStateAfterResponse = NNTP_SEND_POST_DATA_RESPONSE;
       SetFlag(NNTP_PAUSE_FOR_READ);
       failure = true;
       goto FAIL;
     }
     else
     {
-      PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) CANCELCHK not supported, so post the cancel message as %s", this, from.get()));
+      MOZ_LOG(NNTP, LogLevel::Info,("(%p) CANCELCHK not supported, so post the cancel message as %s", this, from.get()));
     }
   }
   else
     NNTP_LOG_NOTE("CANCELCHK supported, don't do the us vs. them test");
 
   // QA needs to be able to disable this confirm dialog, for the automated tests.  see bug #31057
   rv = prefBranch->GetBoolPref(PREF_NEWS_CANCEL_CONFIRM, &requireConfirmationForCancel);
   if (NS_FAILED(rv) || requireConfirmationForCancel) {
@@ -3908,17 +3909,17 @@ nsresult nsNNTPProtocol::ListPrettyNames
         if (NS_FAILED(m_nntpServer->GetCharset(charset) ||
             NS_FAILED(ConvertToUnicode(charset, line, lineUtf16)) ||
             NS_FAILED(ConvertToUnicode(charset, prettyName, prettyNameUtf16)))) {
           CopyUTF8toUTF16(line, lineUtf16);
           CopyUTF8toUTF16(prettyName, prettyNameUtf16);
         }
         m_nntpServer->SetPrettyNameForGroup(lineUtf16, prettyNameUtf16);
 
-        PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) adding pretty name %s", this,
+        MOZ_LOG(NNTP, LogLevel::Info,("(%p) adding pretty name %s", this,
                NS_ConvertUTF16toUTF8(prettyNameUtf16).get()));
       }
 #endif
     }
     else
     {
       m_nextState = DISPLAY_NEWSGROUPS;  /* this assumes we were doing a list */
       /*      m_nextState = NEWS_DONE;   */ /* ### dmb - don't really know */
@@ -4009,17 +4010,17 @@ nsresult nsNNTPProtocol::ListXActiveResp
         if (m_nntpServer) {
           rv = m_nntpServer->AddNewsgroupToList(line);
           NS_ASSERTION(NS_SUCCEEDED(rv),"failed to add to subscribe ds");
         }
 
         /* we're either going to list prettynames first, or list
         all prettynames every time, so we won't care so much
         if it gets interrupted. */
-        PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) got xactive for %s of %s", this, line, flags));
+        MOZ_LOG(NNTP, LogLevel::Info,("(%p) got xactive for %s of %s", this, line, flags));
         /*  This isn't required, because the extra info is
         initialized to false for new groups. And it's
         an expensive call.
         */
         /* MSG_SetGroupNeedsExtraInfo(cd->host, line, false); */
       }
     }
     else
@@ -4039,17 +4040,17 @@ nsresult nsNNTPProtocol::ListXActiveResp
                                      getter_AddRefs(m_newsFolder));
         NS_ENSURE_SUCCESS(rv, rv);
 
         // see if we got a different group
         if (old_newsFolder && m_newsFolder &&
           (old_newsFolder.get() != m_newsFolder.get()))
           /* make sure we're not stuck on the same group */
         {
-          PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) listing xactive for %s", this, groupName.get()));
+          MOZ_LOG(NNTP, LogLevel::Info,("(%p) listing xactive for %s", this, groupName.get()));
           m_nextState = NNTP_LIST_XACTIVE;
           ClearFlag(NNTP_PAUSE_FOR_READ);
           PR_FREEIF(line);
           return NS_OK;
         }
         else
         {
           m_newsFolder = nullptr;
@@ -4239,17 +4240,17 @@ nsresult nsNNTPProtocol::ProcessProtocol
     // In these cases, we are going to return since our data is effectively
     // invalid. However, nsInputStream would really rather that we at least read
     // some of our input data (even if not all of it). Therefore, we'll read a
     // little bit.
     char buffer[128];
     uint32_t readData = 0;
     inputStream->Read(buffer, 127, &readData);
     buffer[readData] = '\0';
-    PR_LOG(NNTP, PR_LOG_DEBUG, ("(%p) Ignoring data: %s", this, buffer));
+    MOZ_LOG(NNTP, LogLevel::Debug, ("(%p) Ignoring data: %s", this, buffer));
   }
 
   if (!mailnewsurl)
     return NS_OK; // probably no data available - it's OK.
 
   if (!m_nntpServer)
   {
     // Parsing must result in our m_nntpServer being set, so we should never
@@ -4259,17 +4260,17 @@ nsresult nsNNTPProtocol::ProcessProtocol
     // input.
     return inputStream ? inputStream->Close() : NS_OK;
   }
 
   ClearFlag(NNTP_PAUSE_FOR_READ);
 
   while(!TestFlag(NNTP_PAUSE_FOR_READ))
   {
-    PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) Next state: %s",this, stateLabels[m_nextState]));
+    MOZ_LOG(NNTP, LogLevel::Info,("(%p) Next state: %s",this, stateLabels[m_nextState]));
     // examine our current state and call an appropriate handler for that state.....
     switch(m_nextState)
     {
     case NNTP_RESPONSE:
       if (inputStream == nullptr)
         SetFlag(NNTP_PAUSE_FOR_READ);
       else
         status = NewsResponse(inputStream, length);
@@ -4591,17 +4592,17 @@ nsresult nsNNTPProtocol::ProcessProtocol
 
   } /* end big while */
 
   return NS_OK; /* keep going */
 }
 
 NS_IMETHODIMP nsNNTPProtocol::CloseConnection()
 {
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) ClosingConnection",this));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) ClosingConnection",this));
   SendData(NNTP_CMD_QUIT); // this will cause OnStopRequest get called, which will call CloseSocket()
   // break some cycles
   CleanupNewsgroupList();
 
   if (m_nntpServer) {
     m_nntpServer->RemoveConnection(this);
     m_nntpServer = nullptr;
   }
@@ -4632,17 +4633,17 @@ nsresult nsNNTPProtocol::CleanupAfterRun
 {
   /* do we need to know if we're parsing xover to call finish xover?  */
   /* yes, I think we do! Why did I think we should??? */
   /* If we've gotten to NEWS_FREE and there is still XOVER
   data, there was an error or we were interrupted or
   something.  So, tell libmsg there was an abnormal
   exit so that it can free its data. */
 
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) CleanupAfterRunningUrl()", this));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) CleanupAfterRunningUrl()", this));
 
   // send StopRequest notification after we've cleaned up the protocol
   // because it can synchronously causes a new url to get run in the
   // protocol - truly evil, but we're stuck at the moment.
   if (m_channelListener)
     (void) m_channelListener->OnStopRequest(this, m_channelContext, NS_OK);
 
   if (m_loadGroup)
@@ -4681,17 +4682,17 @@ nsresult nsNNTPProtocol::CleanupAfterRun
   // last thing we do.
   SetIsBusy(false);
 
   return NS_OK;
 }
 
 nsresult nsNNTPProtocol::CloseSocket()
 {
-  PR_LOG(NNTP,PR_LOG_ALWAYS,("(%p) ClosingSocket()",this));
+  MOZ_LOG(NNTP, LogLevel::Info,("(%p) ClosingSocket()",this));
 
   if (m_nntpServer) {
     m_nntpServer->RemoveConnection(this);
     m_nntpServer = nullptr;
   }
 
   CleanupAfterRunningUrl(); // is this needed?
   return nsMsgProtocol::CloseSocket();