bug 1219466 - convert netwerk to LazyLogModule r=valentin.gosu

This commit is contained in:
Patrick McManus 2015-11-02 23:35:29 -05:00
parent 395110a0bf
commit c22eac316b
70 changed files with 189 additions and 335 deletions

View File

@ -9,11 +9,6 @@
#include "base/basictypes.h"
#include "mozilla/Logging.h"
extern PRLogModuleInfo* GetDataChannelLog();
#undef LOG
#define LOG(args) MOZ_LOG(GetDataChannelLog(), mozilla::LogLevel::Debug, args)
#include "nsDOMDataChannelDeclarations.h"
#include "nsDOMDataChannel.h"
#include "nsIDOMDataChannel.h"
@ -29,6 +24,10 @@ extern PRLogModuleInfo* GetDataChannelLog();
#include "nsIScriptObjectPrincipal.h"
#include "DataChannel.h"
#include "DataChannelLog.h"
#undef LOG
#define LOG(args) MOZ_LOG(mozilla::gDataChannelLog, mozilla::LogLevel::Debug, args)
// Since we've moved the windows.h include down here, we have to explicitly
// undef GetBinaryType, otherwise we'll get really odd conflicts

View File

@ -21,7 +21,7 @@ struct JSContext;
//
// set NSPR_LOG_MODULES=UDPSocket:5
//
extern PRLogModuleInfo *gUDPSocketLog;
extern mozilla::LazyLogModule gUDPSocketLog;
#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, mozilla::LogLevel::Debug, args)
#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, mozilla::LogLevel::Debug)

View File

@ -20,7 +20,7 @@ using mozilla::net::gNeckoChild;
//
// set NSPR_LOG_MODULES=UDPSocket:5
//
extern PRLogModuleInfo *gUDPSocketLog;
extern mozilla::LazyLogModule gUDPSocketLog;
#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, mozilla::LogLevel::Debug, args)
#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, mozilla::LogLevel::Debug)

View File

@ -25,7 +25,7 @@
//
// set NSPR_LOG_MODULES=UDPSocket:5
//
extern PRLogModuleInfo *gUDPSocketLog;
extern mozilla::LazyLogModule gUDPSocketLog;
#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, mozilla::LogLevel::Debug, args)
#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, mozilla::LogLevel::Debug)

View File

@ -33,9 +33,9 @@ namespace mozilla {
namespace net {
// NSPR_LOG_MODULES=BackgroundFileSaver:5
PRLogModuleInfo *BackgroundFileSaver::prlog = nullptr;
#define LOG(args) MOZ_LOG(BackgroundFileSaver::prlog, mozilla::LogLevel::Debug, args)
#define LOG_ENABLED() MOZ_LOG_TEST(BackgroundFileSaver::prlog, mozilla::LogLevel::Debug)
static LazyLogModule prlog("BackgroundFileSaver");
#define LOG(args) MOZ_LOG(prlog, mozilla::LogLevel::Debug, args)
#define LOG_ENABLED() MOZ_LOG_TEST(prlog, mozilla::LogLevel::Debug)
////////////////////////////////////////////////////////////////////////////////
//// Globals
@ -110,8 +110,6 @@ BackgroundFileSaver::BackgroundFileSaver()
, mActualTargetKeepPartial(false)
, mDigestContext(nullptr)
{
if (!prlog)
prlog = PR_NewLogModule("BackgroundFileSaver");
LOG(("Created BackgroundFileSaver [this = %p]", this));
}

View File

@ -25,7 +25,6 @@
class nsIAsyncInputStream;
class nsIThread;
class nsIX509CertList;
struct PRLogModuleInfo;
namespace mozilla {
namespace net {
@ -74,8 +73,6 @@ public:
protected:
virtual ~BackgroundFileSaver();
static PRLogModuleInfo *prlog;
/**
* Helper function for managing NSS objects (mDigestContext).
*/

View File

@ -16,13 +16,13 @@ static const char kCaptivePortalLoginSuccessEvent[] = "captive-portal-login-succ
static const uint32_t kDefaultInterval = 60*1000; // check every 60 seconds
static PRLogModuleInfo *gCaptivePortalLog = nullptr;
#undef LOG
#define LOG(args) MOZ_LOG(gCaptivePortalLog, mozilla::LogLevel::Debug, args)
namespace mozilla {
namespace net {
static LazyLogModule gCaptivePortalLog("CaptivePortalService");
#undef LOG
#define LOG(args) MOZ_LOG(gCaptivePortalLog, mozilla::LogLevel::Debug, args)
NS_IMPL_ISUPPORTS(CaptivePortalService, nsICaptivePortalService, nsIObserver,
nsISupportsWeakReference, nsITimerCallback,
nsICaptivePortalCallback)
@ -101,10 +101,6 @@ CaptivePortalService::Initialize()
}
mInitialized = true;
if (!gCaptivePortalLog) {
gCaptivePortalLog = PR_NewLogModule("CaptivePortalService");
}
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (observerService) {

View File

@ -56,7 +56,8 @@ namespace net {
Predictor *Predictor::sSelf = nullptr;
static PRLogModuleInfo *gPredictorLog = nullptr;
static LazyLogModule gPredictorLog("NetworkPredictor");
#define PREDICTOR_LOG(args) MOZ_LOG(gPredictorLog, mozilla::LogLevel::Debug, args)
#define RETURN_IF_FAILED(_rv) \
@ -322,8 +323,6 @@ Predictor::Predictor()
,mStartupCount(1)
,mMaxURILength(PREDICTOR_MAX_URI_LENGTH_DEFAULT)
{
gPredictorLog = PR_NewLogModule("NetworkPredictor");
MOZ_ASSERT(!sSelf, "multiple Predictor instances!");
sSelf = this;
}

View File

@ -13,16 +13,9 @@
#include "nsIHttpChannelInternal.h"
#include "nsIAsyncVerifyRedirectCallback.h"
static mozilla::LazyLogModule gRedirectLog("nsRedirect");
#undef LOG
static PRLogModuleInfo *
GetRedirectLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("nsRedirect");
return sLog;
}
#define LOG(args) MOZ_LOG(GetRedirectLog(), mozilla::LogLevel::Debug, args)
#define LOG(args) MOZ_LOG(gRedirectLog, mozilla::LogLevel::Debug, args)
NS_IMPL_ISUPPORTS(nsAsyncRedirectVerifyHelper,
nsIAsyncVerifyRedirectCallback,

View File

@ -19,7 +19,7 @@ using namespace mozilla;
//
// NSPR_LOG_MODULES=nsStreamCopier:5
//
static PRLogModuleInfo *gStreamCopierLog = nullptr;
static LazyLogModule gStreamCopierLog("nsStreamCopier");
#define LOG(args) MOZ_LOG(gStreamCopierLog, mozilla::LogLevel::Debug, args)
/**
@ -70,8 +70,6 @@ nsAsyncStreamCopier::nsAsyncStreamCopier()
, mIsPending(false)
, mShouldSniffBuffering(false)
{
if (!gStreamCopierLog)
gStreamCopierLog = PR_NewLogModule("nsStreamCopier");
LOG(("Creating nsAsyncStreamCopier @%x\n", this));
}

View File

@ -29,8 +29,7 @@
// the file nspr.log
//
static PRLogModuleInfo* gLog = nullptr;
static mozilla::LazyLogModule gLog("Autodial");
#undef LOGD
#undef LOGE
#define LOGD(args) MOZ_LOG(gLog, mozilla::LogLevel::Debug, args)
@ -62,9 +61,6 @@ nsAutodial::~nsAutodial()
// Returns NS_ERROR_FAILURE if error or NS_OK if success.
nsresult nsAutodial::Init()
{
if (!gLog)
gLog = PR_NewLogModule("Autodial");
mDefaultEntryName[0] = '\0';
mNumRASConnectionEntries = 0;
mAutodialBehavior = QueryAutodialBehavior();

View File

@ -40,7 +40,8 @@ using mozilla::Preferences;
//
// NSPR_LOG_MODULES=nsChannelClassifier:5
//
static PRLogModuleInfo *gChannelClassifierLog;
static mozilla::LazyLogModule gChannelClassifierLog("nsChannelClassifier");
#undef LOG
#define LOG(args) MOZ_LOG(gChannelClassifierLog, mozilla::LogLevel::Debug, args)
#define LOG_ENABLED() MOZ_LOG_TEST(gChannelClassifierLog, mozilla::LogLevel::Debug)
@ -52,8 +53,6 @@ nsChannelClassifier::nsChannelClassifier()
: mIsAllowListed(false),
mSuspendedChannel(false)
{
if (!gChannelClassifierLog)
gChannelClassifierLog = PR_NewLogModule("nsChannelClassifier");
}
nsresult

View File

@ -18,8 +18,6 @@
#include "nsDirectoryIndexStream.h"
#include "mozilla/Logging.h"
#include "prtime.h"
static PRLogModuleInfo* gLog;
#include "nsISimpleEnumerator.h"
#ifdef THREADSAFE_I18N
#include "nsCollationCID.h"
@ -41,12 +39,11 @@ static PRLogModuleInfo* gLog;
//#define THREADSAFE_I18N
static mozilla::LazyLogModule gLog("nsDirectoryIndexStream");
nsDirectoryIndexStream::nsDirectoryIndexStream()
: mOffset(0), mStatus(NS_OK), mPos(0)
{
if (! gLog)
gLog = PR_NewLogModule("nsDirectoryIndexStream");
MOZ_LOG(gLog, LogLevel::Debug,
("nsDirectoryIndexStream[%p]: created", this));
}

View File

@ -24,7 +24,7 @@ static NS_DEFINE_CID(kStreamTransportServiceCID, NS_STREAMTRANSPORTSERVICE_CID);
//
// NSPR_LOG_MODULES=nsStreamPump:5
//
static PRLogModuleInfo *gStreamPumpLog = nullptr;
static mozilla::LazyLogModule gStreamPumpLog("nsStreamPump");
#undef LOG
#define LOG(args) MOZ_LOG(gStreamPumpLog, mozilla::LogLevel::Debug, args)
@ -45,8 +45,6 @@ nsInputStreamPump::nsInputStreamPump()
, mRetargeting(false)
, mMonitor("nsInputStreamPump")
{
if (!gStreamPumpLog)
gStreamPumpLog = PR_NewLogModule("nsStreamPump");
}
nsInputStreamPump::~nsInputStreamPump()

View File

@ -38,8 +38,7 @@ using namespace mozilla::net;
// this enables LogLevel::Debug level information and places all output in
// the file nspr.log
//
static PRLogModuleInfo* gLoadGroupLog = nullptr;
static LazyLogModule gLoadGroupLog("LoadGroup");
#undef LOG
#define LOG(args) MOZ_LOG(gLoadGroupLog, mozilla::LogLevel::Debug, args)
@ -117,11 +116,6 @@ nsLoadGroup::nsLoadGroup(nsISupports* outer)
, mTimedNonCachedRequestsUntilOnEndPageLoad(0)
{
NS_INIT_AGGREGATED(outer);
// Initialize the global PRLogModule for nsILoadGroup logging
if (nullptr == gLoadGroupLog)
gLoadGroupLog = PR_NewLogModule("LoadGroup");
LOG(("LOADGROUP [%x]: Created.\n", this));
}

View File

@ -25,8 +25,14 @@
using namespace mozilla;
using namespace mozilla::net;
namespace mozilla {
namespace net {
LazyLogModule gProxyLog("proxy");
} // namespace net
} // namespace mozilla
#undef LOG
#define LOG(args) MOZ_LOG(GetProxyLog(), mozilla::LogLevel::Debug, args)
#define LOG(args) MOZ_LOG(mozilla::net::gProxyLog, mozilla::LogLevel::Debug, args)
// The PAC thread does evaluations of both PAC files and
// nsISystemProxySettings because they can both block the calling thread and we
@ -768,17 +774,3 @@ nsPACMan::Init(nsISystemProxySettings *systemProxySettings)
return NS_OK;
}
namespace mozilla {
namespace net {
PRLogModuleInfo*
GetProxyLog()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("proxy");
return sLog;
}
} // namespace net
} // namespace mozilla

View File

@ -241,7 +241,7 @@ private:
namespace mozilla {
namespace net {
PRLogModuleInfo* GetProxyLog();
extern LazyLogModule gProxyLog;
} // namespace net
} // namespace mozilla

View File

@ -49,7 +49,7 @@ using namespace mozilla;
#include "mozilla/Logging.h"
#undef LOG
#define LOG(args) MOZ_LOG(net::GetProxyLog(), mozilla::LogLevel::Debug, args)
#define LOG(args) MOZ_LOG(net::gProxyLog, mozilla::LogLevel::Debug, args)
//----------------------------------------------------------------------------

View File

@ -13,7 +13,7 @@
using namespace mozilla;
static PRLogModuleInfo *gRequestObserverProxyLog;
static LazyLogModule gRequestObserverProxyLog("nsRequestObserverProxy");
#undef LOG
#define LOG(args) MOZ_LOG(gRequestObserverProxyLog, mozilla::LogLevel::Debug, args)
@ -173,10 +173,6 @@ NS_IMETHODIMP
nsRequestObserverProxy::Init(nsIRequestObserver *observer, nsISupports *context)
{
NS_ENSURE_ARG_POINTER(observer);
if (!gRequestObserverProxyLog)
gRequestObserverProxyLog = PR_NewLogModule("nsRequestObserverProxy");
mObserver = new nsMainThreadPtrHolder<nsIRequestObserver>(observer);
mContext = new nsMainThreadPtrHolder<nsISupports>(context);

View File

@ -8,17 +8,8 @@
#include "nsIForcePendingChannel.h"
#include "nsCOMPtr.h"
static PRLogModuleInfo*
GetChannelWrapperLog()
{
static PRLogModuleInfo* gChannelWrapperPRLog;
if (!gChannelWrapperPRLog) {
gChannelWrapperPRLog = PR_NewLogModule("ChannelWrapper");
}
return gChannelWrapperPRLog;
}
#define CHANNELWRAPPERLOG(args) MOZ_LOG(GetChannelWrapperLog(), mozilla::LogLevel::Debug, args)
static mozilla::LazyLogModule gChannelWrapperLog("ChannelWrapper");
#define CHANNELWRAPPERLOG(args) MOZ_LOG(gChannelWrapperLog, mozilla::LogLevel::Debug, args)
NS_IMPL_ADDREF(nsSecCheckWrapChannelBase)
NS_IMPL_RELEASE(nsSecCheckWrapChannelBase)

View File

@ -29,8 +29,8 @@
using namespace mozilla;
using namespace mozilla::net;
PRLogModuleInfo *gSocketTransportLog = nullptr;
PRLogModuleInfo *gUDPSocketLog = nullptr;
LazyLogModule gSocketTransportLog("nsSocketTransport");
LazyLogModule gUDPSocketLog("UDPSocket");
nsSocketTransportService *gSocketTransportService = nullptr;
PRThread *gSocketThread = nullptr;
@ -111,9 +111,6 @@ nsSocketTransportService::nsSocketTransportService()
, mTelemetryEnabledPref(false)
, mProbedMaxCount(false)
{
gSocketTransportLog = PR_NewLogModule("nsSocketTransport");
gUDPSocketLog = PR_NewLogModule("UDPSocket");
NS_ASSERTION(NS_IsMainThread(), "wrong thread");
PR_CallOnce(&gMaxCountInitOnce, DiscoverMaxCount);

View File

@ -28,14 +28,14 @@ struct PRPollDesc;
//
// set NSPR_LOG_MODULES=nsSocketTransport:5
//
extern PRLogModuleInfo *gSocketTransportLog;
extern mozilla::LazyLogModule gSocketTransportLog;
#define SOCKET_LOG(args) MOZ_LOG(gSocketTransportLog, mozilla::LogLevel::Debug, args)
#define SOCKET_LOG_ENABLED() MOZ_LOG_TEST(gSocketTransportLog, mozilla::LogLevel::Debug)
//
// set NSPR_LOG_MODULES=UDPSocket:5
//
extern PRLogModuleInfo *gUDPSocketLog;
extern mozilla::LazyLogModule gUDPSocketLog;
#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, mozilla::LogLevel::Debug, args)
#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, mozilla::LogLevel::Debug)

View File

@ -40,7 +40,7 @@ char nsStandardURL::gHostLimitDigits[] = { '/', '\\', '?', '#', 0 };
//
// setenv NSPR_LOG_MODULES nsStandardURL:5
//
static PRLogModuleInfo *gStandardURLLog;
static mozilla::LazyLogModule gStandardURLLog("nsStandardURL");
// The Chromium code defines its own LOG macro which we don't want
#undef LOG
@ -252,9 +252,6 @@ nsStandardURL::nsStandardURL(bool aSupportsFileURL, bool aTrackURL)
, mMutable(true)
, mSupportsFileURL(aSupportsFileURL)
{
if (!gStandardURLLog)
gStandardURLLog = PR_NewLogModule("nsStandardURL");
LOG(("Creating nsStandardURL @%p\n", this));
if (!gInitialized) {

View File

@ -14,17 +14,7 @@
* Cache Service Utility Functions
*/
PRLogModuleInfo * gCacheLog = nullptr;
void
CacheLogInit()
{
if (gCacheLog) return;
gCacheLog = PR_NewLogModule("cache");
NS_ASSERTION(gCacheLog, "\nfailed to allocate cache log.\n");
}
mozilla::LazyLogModule gCacheLog("cache");
void
CacheLogPrintPath(mozilla::LogLevel level, const char * format, nsIFile * item)

View File

@ -19,12 +19,10 @@
#include "nsError.h"
// PR_LOG args = "format string", arg, arg, ...
extern PRLogModuleInfo * gCacheLog;
void CacheLogInit();
extern mozilla::LazyLogModule gCacheLog;
void CacheLogPrintPath(mozilla::LogLevel level,
const char * format,
nsIFile * item);
#define CACHE_LOG_INIT() CacheLogInit()
#define CACHE_LOG_INFO(args) MOZ_LOG(gCacheLog, mozilla::LogLevel::Info, args)
#define CACHE_LOG_ERROR(args) MOZ_LOG(gCacheLog, mozilla::LogLevel::Error, args)
#define CACHE_LOG_WARNING(args) MOZ_LOG(gCacheLog, mozilla::LogLevel::Warning, args)

View File

@ -1129,8 +1129,6 @@ nsCacheService::Init()
return NS_ERROR_UNEXPECTED;
}
CACHE_LOG_INIT();
nsresult rv;
mStorageService = do_GetService("@mozilla.org/storage/service;1", &rv);

View File

@ -16,13 +16,7 @@ namespace net {
//
// this enables LogLevel::Debug level information and places all output in
// the file nspr.log
PRLogModuleInfo* GetCache2Log()
{
static PRLogModuleInfo *sLog;
if (!sLog)
sLog = PR_NewLogModule("cache2");
return sLog;
}
LazyLogModule gCache2Log("cache2");
} // namespace net
} // namespace mozilla

View File

@ -10,9 +10,9 @@
namespace mozilla {
namespace net {
extern PRLogModuleInfo* GetCache2Log();
#define LOG(x) MOZ_LOG(GetCache2Log(), mozilla::LogLevel::Debug, x)
#define LOG_ENABLED() MOZ_LOG_TEST(GetCache2Log(), mozilla::LogLevel::Debug)
extern LazyLogModule gCache2Log;
#define LOG(x) MOZ_LOG(gCache2Log, mozilla::LogLevel::Debug, x)
#define LOG_ENABLED() MOZ_LOG_TEST(gCache2Log, mozilla::LogLevel::Debug)
} // namespace net
} // namespace mozilla

View File

@ -185,55 +185,48 @@ struct nsListIter
#define SET_COOKIE true
#define GET_COOKIE false
static PRLogModuleInfo *
GetCookieLog()
{
static PRLogModuleInfo *sCookieLog;
if (!sCookieLog)
sCookieLog = PR_NewLogModule("cookie");
return sCookieLog;
}
static LazyLogModule gCookieLog("cookie");
#define COOKIE_LOGFAILURE(a, b, c, d) LogFailure(a, b, c, d)
#define COOKIE_LOGSUCCESS(a, b, c, d, e) LogSuccess(a, b, c, d, e)
#define COOKIE_LOGEVICTED(a, details) \
PR_BEGIN_MACRO \
if (MOZ_LOG_TEST(GetCookieLog(), LogLevel::Debug)) \
if (MOZ_LOG_TEST(gCookieLog, LogLevel::Debug)) \
LogEvicted(a, details); \
PR_END_MACRO
#define COOKIE_LOGSTRING(lvl, fmt) \
PR_BEGIN_MACRO \
MOZ_LOG(GetCookieLog(), lvl, fmt); \
MOZ_LOG(GetCookieLog(), lvl, ("\n")); \
MOZ_LOG(gCookieLog, lvl, fmt); \
MOZ_LOG(gCookieLog, lvl, ("\n")); \
PR_END_MACRO
static void
LogFailure(bool aSetCookie, nsIURI *aHostURI, const char *aCookieString, const char *aReason)
{
// if logging isn't enabled, return now to save cycles
if (!MOZ_LOG_TEST(GetCookieLog(), LogLevel::Warning))
if (!MOZ_LOG_TEST(gCookieLog, LogLevel::Warning))
return;
nsAutoCString spec;
if (aHostURI)
aHostURI->GetAsciiSpec(spec);
MOZ_LOG(GetCookieLog(), LogLevel::Warning,
MOZ_LOG(gCookieLog, LogLevel::Warning,
("===== %s =====\n", aSetCookie ? "COOKIE NOT ACCEPTED" : "COOKIE NOT SENT"));
MOZ_LOG(GetCookieLog(), LogLevel::Warning,("request URL: %s\n", spec.get()));
MOZ_LOG(gCookieLog, LogLevel::Warning,("request URL: %s\n", spec.get()));
if (aSetCookie)
MOZ_LOG(GetCookieLog(), LogLevel::Warning,("cookie string: %s\n", aCookieString));
MOZ_LOG(gCookieLog, LogLevel::Warning,("cookie string: %s\n", aCookieString));
PRExplodedTime explodedTime;
PR_ExplodeTime(PR_Now(), PR_GMTParameters, &explodedTime);
char timeString[40];
PR_FormatTimeUSEnglish(timeString, 40, "%c GMT", &explodedTime);
MOZ_LOG(GetCookieLog(), LogLevel::Warning,("current time: %s", timeString));
MOZ_LOG(GetCookieLog(), LogLevel::Warning,("rejected because %s\n", aReason));
MOZ_LOG(GetCookieLog(), LogLevel::Warning,("\n"));
MOZ_LOG(gCookieLog, LogLevel::Warning,("current time: %s", timeString));
MOZ_LOG(gCookieLog, LogLevel::Warning,("rejected because %s\n", aReason));
MOZ_LOG(gCookieLog, LogLevel::Warning,("\n"));
}
static void
@ -244,27 +237,27 @@ LogCookie(nsCookie *aCookie)
char timeString[40];
PR_FormatTimeUSEnglish(timeString, 40, "%c GMT", &explodedTime);
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("current time: %s", timeString));
MOZ_LOG(gCookieLog, LogLevel::Debug,("current time: %s", timeString));
if (aCookie) {
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("----------------\n"));
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("name: %s\n", aCookie->Name().get()));
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("value: %s\n", aCookie->Value().get()));
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("%s: %s\n", aCookie->IsDomain() ? "domain" : "host", aCookie->Host().get()));
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("path: %s\n", aCookie->Path().get()));
MOZ_LOG(gCookieLog, LogLevel::Debug,("----------------\n"));
MOZ_LOG(gCookieLog, LogLevel::Debug,("name: %s\n", aCookie->Name().get()));
MOZ_LOG(gCookieLog, LogLevel::Debug,("value: %s\n", aCookie->Value().get()));
MOZ_LOG(gCookieLog, LogLevel::Debug,("%s: %s\n", aCookie->IsDomain() ? "domain" : "host", aCookie->Host().get()));
MOZ_LOG(gCookieLog, LogLevel::Debug,("path: %s\n", aCookie->Path().get()));
PR_ExplodeTime(aCookie->Expiry() * int64_t(PR_USEC_PER_SEC),
PR_GMTParameters, &explodedTime);
PR_FormatTimeUSEnglish(timeString, 40, "%c GMT", &explodedTime);
MOZ_LOG(GetCookieLog(), LogLevel::Debug,
MOZ_LOG(gCookieLog, LogLevel::Debug,
("expires: %s%s", timeString, aCookie->IsSession() ? " (at end of session)" : ""));
PR_ExplodeTime(aCookie->CreationTime(), PR_GMTParameters, &explodedTime);
PR_FormatTimeUSEnglish(timeString, 40, "%c GMT", &explodedTime);
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("created: %s", timeString));
MOZ_LOG(gCookieLog, LogLevel::Debug,("created: %s", timeString));
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("is secure: %s\n", aCookie->IsSecure() ? "true" : "false"));
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("is httpOnly: %s\n", aCookie->IsHttpOnly() ? "true" : "false"));
MOZ_LOG(gCookieLog, LogLevel::Debug,("is secure: %s\n", aCookie->IsSecure() ? "true" : "false"));
MOZ_LOG(gCookieLog, LogLevel::Debug,("is httpOnly: %s\n", aCookie->IsHttpOnly() ? "true" : "false"));
}
}
@ -272,7 +265,7 @@ static void
LogSuccess(bool aSetCookie, nsIURI *aHostURI, const char *aCookieString, nsCookie *aCookie, bool aReplacing)
{
// if logging isn't enabled, return now to save cycles
if (!MOZ_LOG_TEST(GetCookieLog(), LogLevel::Debug)) {
if (!MOZ_LOG_TEST(gCookieLog, LogLevel::Debug)) {
return;
}
@ -280,27 +273,27 @@ LogSuccess(bool aSetCookie, nsIURI *aHostURI, const char *aCookieString, nsCooki
if (aHostURI)
aHostURI->GetAsciiSpec(spec);
MOZ_LOG(GetCookieLog(), LogLevel::Debug,
MOZ_LOG(gCookieLog, LogLevel::Debug,
("===== %s =====\n", aSetCookie ? "COOKIE ACCEPTED" : "COOKIE SENT"));
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("request URL: %s\n", spec.get()));
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("cookie string: %s\n", aCookieString));
MOZ_LOG(gCookieLog, LogLevel::Debug,("request URL: %s\n", spec.get()));
MOZ_LOG(gCookieLog, LogLevel::Debug,("cookie string: %s\n", aCookieString));
if (aSetCookie)
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("replaces existing cookie: %s\n", aReplacing ? "true" : "false"));
MOZ_LOG(gCookieLog, LogLevel::Debug,("replaces existing cookie: %s\n", aReplacing ? "true" : "false"));
LogCookie(aCookie);
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("\n"));
MOZ_LOG(gCookieLog, LogLevel::Debug,("\n"));
}
static void
LogEvicted(nsCookie *aCookie, const char* details)
{
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("===== COOKIE EVICTED =====\n"));
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("%s\n", details));
MOZ_LOG(gCookieLog, LogLevel::Debug,("===== COOKIE EVICTED =====\n"));
MOZ_LOG(gCookieLog, LogLevel::Debug,("%s\n", details));
LogCookie(aCookie);
MOZ_LOG(GetCookieLog(), LogLevel::Debug,("\n"));
MOZ_LOG(gCookieLog, LogLevel::Debug,("\n"));
}
// inline wrappers to make passing in nsAFlatCStrings easier
@ -346,7 +339,7 @@ protected:
public:
NS_IMETHOD HandleError(mozIStorageError* aError) override
{
if (MOZ_LOG_TEST(GetCookieLog(), LogLevel::Warning)) {
if (MOZ_LOG_TEST(gCookieLog, LogLevel::Warning)) {
int32_t result = -1;
aError->GetResult(&result);

View File

@ -23,11 +23,6 @@
#endif
#include "mozilla/Logging.h"
static PRLogModuleInfo *gGetAddrInfoLog = PR_NewLogModule("GetAddrInfo");
#define LOG(msg, ...) \
MOZ_LOG(gGetAddrInfoLog, LogLevel::Debug, ("[DNS]: " msg, ##__VA_ARGS__))
#define LOG_WARNING(msg, ...) \
MOZ_LOG(gGetAddrInfoLog, LogLevel::Warning, ("[DNS]: " msg, ##__VA_ARGS__))
#if DNSQUERY_AVAILABLE
// There is a bug in windns.h where the type of parameter ppQueryResultsSet for
@ -43,6 +38,12 @@ static PRLogModuleInfo *gGetAddrInfoLog = PR_NewLogModule("GetAddrInfo");
namespace mozilla {
namespace net {
static LazyLogModule gGetAddrInfoLog("GetAddrInfo");
#define LOG(msg, ...) \
MOZ_LOG(gGetAddrInfoLog, LogLevel::Debug, ("[DNS]: " msg, ##__VA_ARGS__))
#define LOG_WARNING(msg, ...) \
MOZ_LOG(gGetAddrInfoLog, LogLevel::Warning, ("[DNS]: " msg, ##__VA_ARGS__))
#if DNSQUERY_AVAILABLE
////////////////////////////
// WINDOWS IMPLEMENTATION //

View File

@ -25,20 +25,15 @@
#include "nsASocketHandler.h"
inline PRLogModuleInfo*
GetOperatorLog()
{
static PRLogModuleInfo* log = PR_NewLogModule("MDNSResponderOperator");
return log;
}
#undef LOG_I
#define LOG_I(...) MOZ_LOG(GetOperatorLog(), mozilla::LogLevel::Debug, (__VA_ARGS__))
#undef LOG_E
#define LOG_E(...) MOZ_LOG(GetOperatorLog(), mozilla::LogLevel::Error, (__VA_ARGS__))
namespace mozilla {
namespace net {
static LazyLogModule gMDNSLog("MDNSResponderOperator");
#undef LOG_I
#define LOG_I(...) MOZ_LOG(mozilla::net::gMDNSLog, mozilla::LogLevel::Debug, (__VA_ARGS__))
#undef LOG_E
#define LOG_E(...) MOZ_LOG(mozilla::net::gMDNSLog, mozilla::LogLevel::Error, (__VA_ARGS__))
class MDNSResponderOperator::ServiceWatcher final
: public nsASocketHandler
{

View File

@ -68,7 +68,7 @@ PR_STATIC_ASSERT (HighThreadThreshold <= MAX_RESOLVER_THREADS);
//----------------------------------------------------------------------------
static PRLogModuleInfo *gHostResolverLog = nullptr;
static LazyLogModule gHostResolverLog("nsHostResolver");
#define LOG(args) MOZ_LOG(gHostResolverLog, mozilla::LogLevel::Debug, args)
#define LOG_HOST(host, interface) host, \
@ -1458,9 +1458,6 @@ nsHostResolver::Create(uint32_t maxCacheEntries,
uint32_t defaultGracePeriod,
nsHostResolver **result)
{
if (!gHostResolverLog)
gHostResolverLog = PR_NewLogModule("nsHostResolver");
nsHostResolver *res = new nsHostResolver(maxCacheEntries, defaultCacheEntryLifetime,
defaultGracePeriod);
NS_ADDREF(res);

View File

@ -10,7 +10,9 @@
#include "nsThreadUtils.h"
#include "mozilla/Attributes.h"
extern PRLogModuleInfo* gFTPLog;
using namespace mozilla;
using namespace mozilla::net;
extern LazyLogModule gFTPLog;
// There are two transport connections established for an
// ftp connection. One is used for the command channel , and

View File

@ -47,12 +47,13 @@
#include "NetStatistics.h"
#endif
extern PRLogModuleInfo* gFTPLog;
using namespace mozilla;
using namespace mozilla::net;
extern LazyLogModule gFTPLog;
#define LOG(args) MOZ_LOG(gFTPLog, mozilla::LogLevel::Debug, args)
#define LOG_INFO(args) MOZ_LOG(gFTPLog, mozilla::LogLevel::Info, args)
using namespace mozilla::net;
// remove FTP parameters (starting with ";") from the path
static void
removeParamsFromPath(nsCString& path)

View File

@ -15,7 +15,10 @@
#include "nsNetCID.h"
#include <algorithm>
extern PRLogModuleInfo* gFTPLog;
using namespace mozilla;
using namespace mozilla::net;
extern LazyLogModule gFTPLog;
#define LOG(args) MOZ_LOG(gFTPLog, mozilla::LogLevel::Debug, args)
#define LOG_INFO(args) MOZ_LOG(gFTPLog, mozilla::LogLevel::Info, args)

View File

@ -45,7 +45,7 @@ using namespace mozilla::net;
// this enables LogLevel::Debug level information and places all output in
// the file nspr.log
//
PRLogModuleInfo* gFTPLog = nullptr;
LazyLogModule gFTPLog("nsFtp");
#undef LOG
#define LOG(args) MOZ_LOG(gFTPLog, mozilla::LogLevel::Debug, args)
@ -67,9 +67,6 @@ nsFtpProtocolHandler::nsFtpProtocolHandler()
, mControlQoSBits(0x00)
, mDataQoSBits(0x00)
{
if (!gFTPLog)
gFTPLog = PR_NewLogModule("nsFtp");
LOG(("FTP:creating handler @%x\n", this));
gFtpHandler = this;

View File

@ -82,6 +82,6 @@ private:
extern nsFtpProtocolHandler *gFtpHandler;
extern PRLogModuleInfo* gFTPLog;
extern mozilla::LazyLogModule gFTPLog;
#endif // !nsFtpProtocolHandler_h__

View File

@ -43,7 +43,6 @@
#include "nsISecurityConsoleMessage.h"
#include "nsCOMArray.h"
extern PRLogModuleInfo *gHttpLog;
class nsPerformance;
class nsISecurityConsoleMessage;
class nsIPrincipal;
@ -53,6 +52,7 @@ namespace mozilla {
class LogCollector;
namespace net {
extern mozilla::LazyLogModule gHttpLog;
/*
* This class is a partial implementation of nsIHttpChannel. It contains code

View File

@ -34,21 +34,25 @@
// this enables LogLevel::Debug level information and places all output in
// the file http.log
//
extern PRLogModuleInfo *gHttpLog;
namespace mozilla {
namespace net {
extern LazyLogModule gHttpLog;
}
}
// http logging
#define LOG1(args) MOZ_LOG(gHttpLog, mozilla::LogLevel::Error, args)
#define LOG2(args) MOZ_LOG(gHttpLog, mozilla::LogLevel::Warning, args)
#define LOG3(args) MOZ_LOG(gHttpLog, mozilla::LogLevel::Info, args)
#define LOG4(args) MOZ_LOG(gHttpLog, mozilla::LogLevel::Debug, args)
#define LOG5(args) MOZ_LOG(gHttpLog, mozilla::LogLevel::Verbose, args)
#define LOG1(args) MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Error, args)
#define LOG2(args) MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Warning, args)
#define LOG3(args) MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Info, args)
#define LOG4(args) MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Debug, args)
#define LOG5(args) MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Verbose, args)
#define LOG(args) LOG4(args)
#define LOG1_ENABLED() MOZ_LOG_TEST(gHttpLog, mozilla::LogLevel::Error)
#define LOG2_ENABLED() MOZ_LOG_TEST(gHttpLog, mozilla::LogLevel::Warning)
#define LOG3_ENABLED() MOZ_LOG_TEST(gHttpLog, mozilla::LogLevel::Info)
#define LOG4_ENABLED() MOZ_LOG_TEST(gHttpLog, mozilla::LogLevel::Debug)
#define LOG5_ENABLED() MOZ_LOG_TEST(gHttpLog, mozilla::LogLevel::Verbose)
#define LOG1_ENABLED() MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Error)
#define LOG2_ENABLED() MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Warning)
#define LOG3_ENABLED() MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Info)
#define LOG4_ENABLED() MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Debug)
#define LOG5_ENABLED() MOZ_LOG_TEST(mozilla::net::gHttpLog, mozilla::LogLevel::Verbose)
#define LOG_ENABLED() LOG4_ENABLED()
#endif // HttpLog_h__

View File

@ -23,8 +23,7 @@ namespace mozilla {
namespace net {
static PackagedAppService *gPackagedAppService = nullptr;
static PRLogModuleInfo *gPASLog = nullptr;
static LazyLogModule gPASLog("PackagedAppService");
#undef LOG
#define LOG(args) MOZ_LOG(gPASLog, mozilla::LogLevel::Debug, args)
@ -1043,7 +1042,6 @@ PackagedAppService::PackagedAppDownloader::OnResourceVerified(const ResourceCach
PackagedAppService::PackagedAppService()
{
gPackagedAppService = this;
gPASLog = PR_NewLogModule("PackagedAppService");
LOG(("[%p] Created PackagedAppService\n", this));
}

View File

@ -13,8 +13,6 @@
#include "mozilla/HashFunctions.h"
#include "nsCRT.h"
PRLogModuleInfo *gHttpLog = nullptr;
namespace mozilla {
namespace net {

View File

@ -14,8 +14,6 @@
#include "mozilla/Logging.h"
#include "ARefBase.h"
extern PRLogModuleInfo *gHttpLog;
//-----------------------------------------------------------------------------
// nsHttpConnectionInfo - holds the properties of a connection
//-----------------------------------------------------------------------------
@ -31,6 +29,8 @@ extern PRLogModuleInfo *gHttpLog;
namespace mozilla { namespace net {
extern LazyLogModule gHttpLog;
class nsHttpConnectionInfo: public ARefBase
{
public:

View File

@ -103,6 +103,8 @@ extern PRThread *gSocketThread;
namespace mozilla {
namespace net {
LazyLogModule gHttpLog("nsHttp");
static nsresult
NewURI(const nsACString &aSpec,
const char *aCharset,
@ -216,8 +218,6 @@ nsHttpHandler::nsHttpHandler()
, mTCPKeepaliveLongLivedIdleTimeS(600)
, mEnforceH1Framing(FRAMECHECK_BARELY)
{
gHttpLog = PR_NewLogModule("nsHttp");
LOG(("Creating nsHttpHandler [this=%p].\n", this));
RegisterStrongMemoryReporter(new SpdyZlibReporter());

View File

@ -22,7 +22,7 @@ namespace mozilla {
// Log module for Substituting Protocol logging. We keep the pre-existing module
// name of "nsResProtocol" to avoid disruption.
static PRLogModuleInfo *gResLog;
static LazyLogModule gResLog("nsResProtocol");
static NS_DEFINE_CID(kSubstitutingURLCID, NS_SUBSTITUTINGURL_CID);
@ -105,10 +105,6 @@ SubstitutingProtocolHandler::ConstructInternal()
nsresult rv;
mIOService = do_GetIOService(&rv);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv) && mIOService);
if (!gResLog) {
gResLog = PR_NewLogModule("nsResProtocol");
}
}
//

View File

@ -42,12 +42,11 @@
#include <algorithm>
#include "nsDebug.h"
extern PRLogModuleInfo* gRtspLog;
#undef LOG
#define LOG(args) MOZ_LOG(gRtspLog, mozilla::LogLevel::Debug, args)
namespace mozilla {
namespace net {
extern LazyLogModule gRtspLog;
#undef LOG
#define LOG(args) MOZ_LOG(mozilla::net::gRtspLog, mozilla::LogLevel::Debug, args)
//-----------------------------------------------------------------------------
// RtspController

View File

@ -15,10 +15,6 @@
#include "nsStringStream.h"
#include "mozilla/Logging.h"
PRLogModuleInfo* gRtspChildLog = nullptr;
#undef LOG
#define LOG(args) MOZ_LOG(gRtspChildLog, mozilla::LogLevel::Debug, args)
const uint32_t kRtspTotalTracks = 2;
const unsigned long kRtspCommandDelayMs = 200;
@ -27,6 +23,10 @@ using namespace mozilla::ipc;
namespace mozilla {
namespace net {
static LazyLogModule gRtspChildLog("nsRtspChild");
#undef LOG
#define LOG(args) MOZ_LOG(mozilla::net::gRtspChildLog, mozilla::LogLevel::Debug, args)
NS_IMPL_ADDREF(RtspControllerChild)
NS_IMETHODIMP_(nsrefcnt) RtspControllerChild::Release()
@ -69,8 +69,6 @@ RtspControllerChild::RtspControllerChild(nsIChannel *channel)
, mPlayTimer(nullptr)
, mPauseTimer(nullptr)
{
if (!gRtspChildLog)
gRtspChildLog = PR_NewLogModule("nsRtspChild");
AddIPDLReference();
gNeckoChild->SendPRtspControllerConstructor(this);
}

View File

@ -16,10 +16,6 @@
#include <sys/types.h>
PRLogModuleInfo* gRtspLog;
#undef LOG
#define LOG(args) MOZ_LOG(gRtspLog, mozilla::LogLevel::Debug, args)
#define SEND_DISCONNECT_IF_ERROR(rv) \
if (NS_FAILED(rv) && mIPCOpen && mTotalTracks > 0ul) { \
for (uint32_t i = 0; i < mTotalTracks; i++) { \
@ -32,6 +28,10 @@ using namespace mozilla::ipc;
namespace mozilla {
namespace net {
LazyLogModule gRtspLog("nsRtsp");
#undef LOG
#define LOG(args) MOZ_LOG(mozilla::net::gRtspLog, mozilla::LogLevel::Debug, args)
void
RtspControllerParent::Destroy()
{
@ -61,8 +61,6 @@ RtspControllerParent::RtspControllerParent()
: mIPCOpen(true)
, mTotalTracks(0)
{
if (!gRtspLog)
gRtspLog = PR_NewLogModule("nsRtsp");
}
RtspControllerParent::~RtspControllerParent()

View File

@ -44,7 +44,11 @@
#include "prio.h"
#include "prnetdb.h"
extern PRLogModuleInfo* gRtspLog;
namespace mozilla {
namespace net {
extern LazyLogModule gRtspLog;
}
}
// If no access units are received within 10 secs, assume that the rtp
// stream has ended and abort.

View File

@ -8,12 +8,15 @@
#define RTSPPRLOG_H
#include "mozilla/Logging.h"
namespace mozilla {
namespace net {
extern LazyLogModule gRtspLog;
}
}
extern PRLogModuleInfo* gRtspLog;
#define LOGI(msg, ...) MOZ_LOG(gRtspLog, mozilla::LogLevel::Info, (msg, ##__VA_ARGS__))
#define LOGV(msg, ...) MOZ_LOG(gRtspLog, mozilla::LogLevel::Debug, (msg, ##__VA_ARGS__))
#define LOGE(msg, ...) MOZ_LOG(gRtspLog, mozilla::LogLevel::Error, (msg, ##__VA_ARGS__))
#define LOGW(msg, ...) MOZ_LOG(gRtspLog, mozilla::LogLevel::Warning, (msg, ##__VA_ARGS__))
#define LOGI(msg, ...) MOZ_LOG(mozilla::net::gRtspLog, mozilla::LogLevel::Info, (msg, ##__VA_ARGS__))
#define LOGV(msg, ...) MOZ_LOG(mozilla::net::gRtspLog, mozilla::LogLevel::Debug, (msg, ##__VA_ARGS__))
#define LOGE(msg, ...) MOZ_LOG(mozilla::net::gRtspLog, mozilla::LogLevel::Error, (msg, ##__VA_ARGS__))
#define LOGW(msg, ...) MOZ_LOG(mozilla::net::gRtspLog, mozilla::LogLevel::Warning, (msg, ##__VA_ARGS__))
#endif // RTSPPRLOG_H

View File

@ -18,11 +18,10 @@
using mozilla::dom::ContentChild;
PRLogModuleInfo *webSocketLog = nullptr;
namespace mozilla {
namespace net {
LazyLogModule webSocketLog("nsWebSocket");
static uint64_t gNextWebSocketID = 0;
// We use only 53 bits for the WebSocket serial ID so that it can be converted
@ -42,9 +41,6 @@ BaseWebSocketChannel::BaseWebSocketChannel()
, mPingInterval(0)
, mPingResponseTimeout(10000)
{
if (!webSocketLog)
webSocketLog = PR_NewLogModule("nsWebSocket");
// Generation of a unique serial ID.
uint64_t processID = 0;
if (XRE_IsContentProcess()) {

View File

@ -35,8 +35,6 @@ WebSocketChannelParent::WebSocketChannelParent(nsIAuthPromptProvider* aAuthProvi
{
// Websocket channels can't have a private browsing override
MOZ_ASSERT_IF(!aLoadContext, aOverrideStatus == kPBOverride_Unset);
if (!webSocketLog)
webSocketLog = PR_NewLogModule("nsWebSocket");
mObserver = new OfflineObserver(this);
}

View File

@ -11,9 +11,13 @@
#include "mozilla/Logging.h"
#include "mozilla/net/NeckoChild.h"
extern PRLogModuleInfo* webSocketLog;
namespace mozilla {
namespace net {
extern LazyLogModule webSocketLog;
}
}
#undef LOG
#define LOG(args) MOZ_LOG(webSocketLog, mozilla::LogLevel::Debug, args)
#define LOG(args) MOZ_LOG(mozilla::net::webSocketLog, mozilla::LogLevel::Debug, args)
#endif

View File

@ -25,8 +25,6 @@ WyciwygChannelParent::WyciwygChannelParent()
: mIPCClosed(false)
, mReceivedAppData(false)
{
if (!gWyciwygLog)
gWyciwygLog = PR_NewLogModule("nsWyciwygChannel");
}
WyciwygChannelParent::~WyciwygChannelParent()

View File

@ -5,5 +5,6 @@
#include "nsWyciwyg.h"
#include "nscore.h"
PRLogModuleInfo *gWyciwygLog = nullptr;
mozilla::LazyLogModule gWyciwygLog("nsWyciwygChannel");

View File

@ -23,7 +23,7 @@
// this enables LogLevel::Debug level information and places all output in
// the file wyciwyg.log
//
extern PRLogModuleInfo *gWyciwygLog;
extern mozilla::LazyLogModule gWyciwygLog;
// http logging
#define LOG1(args) MOZ_LOG(gWyciwygLog, mozilla::LogLevel::Error, args)

View File

@ -26,7 +26,7 @@ class nsIOutputStream;
class nsIProgressEventSink;
class nsIURI;
extern PRLogModuleInfo * gWyciwygLog;
extern mozilla::LazyLogModule gWyciwygLog;
//-----------------------------------------------------------------------------

View File

@ -22,9 +22,6 @@ using namespace mozilla::net;
nsWyciwygProtocolHandler::nsWyciwygProtocolHandler()
{
if (!gWyciwygLog)
gWyciwygLog = PR_NewLogModule("nsWyciwygChannel");
LOG(("Creating nsWyciwygProtocolHandler [this=%p].\n", this));
}

View File

@ -51,24 +51,6 @@
#include "DataChannel.h"
#include "DataChannelProtocol.h"
PRLogModuleInfo*
GetDataChannelLog()
{
static PRLogModuleInfo* sLog;
if (!sLog)
sLog = PR_NewLogModule("DataChannel");
return sLog;
}
PRLogModuleInfo*
GetSCTPLog()
{
static PRLogModuleInfo* sLog;
if (!sLog)
sLog = PR_NewLogModule("SCTP");
return sLog;
}
// Let us turn on and off important assertions in non-debug builds
#ifdef DEBUG
#define ASSERT_WEBRTC(x) MOZ_ASSERT((x))
@ -80,6 +62,9 @@ static bool sctp_initialized;
namespace mozilla {
LazyLogModule gDataChannelLog("DataChannel");
static LazyLogModule gSCTPLog("SCTP");
class DataChannelShutdown : public nsIObserver
{
public:
@ -170,7 +155,7 @@ debug_printf(const char *format, ...)
va_list ap;
char buffer[1024];
if (MOZ_LOG_TEST(GetSCTPLog(), LogLevel::Debug)) {
if (MOZ_LOG_TEST(gSCTPLog, LogLevel::Debug)) {
va_start(ap, format);
#ifdef _WIN32
if (vsnprintf_s(buffer, sizeof(buffer), _TRUNCATE, format, ap) > 0) {
@ -327,7 +312,7 @@ DataChannelConnection::Init(unsigned short aPort, uint16_t aNumStreams, bool aUs
}
// Set logging to SCTP:LogLevel::Debug to get SCTP debugs
if (MOZ_LOG_TEST(GetSCTPLog(), LogLevel::Debug)) {
if (MOZ_LOG_TEST(gSCTPLog, LogLevel::Debug)) {
usrsctp_sysctl_set_sctp_debug_on(SCTP_DEBUG_ALL);
}
@ -671,7 +656,7 @@ void
DataChannelConnection::SctpDtlsInput(TransportFlow *flow,
const unsigned char *data, size_t len)
{
if (MOZ_LOG_TEST(GetSCTPLog(), LogLevel::Debug)) {
if (MOZ_LOG_TEST(gSCTPLog, LogLevel::Debug)) {
char *buf;
if ((buf = usrsctp_dumppacket((void *)data, len, SCTP_DUMP_INBOUND)) != nullptr) {
@ -701,7 +686,7 @@ DataChannelConnection::SctpDtlsOutput(void *addr, void *buffer, size_t length,
DataChannelConnection *peer = static_cast<DataChannelConnection *>(addr);
int res;
if (MOZ_LOG_TEST(GetSCTPLog(), LogLevel::Debug)) {
if (MOZ_LOG_TEST(gSCTPLog, LogLevel::Debug)) {
char *buf;
if ((buf = usrsctp_dumppacket(buffer, length, SCTP_DUMP_OUTBOUND)) != nullptr) {

View File

@ -10,10 +10,11 @@
#include "base/basictypes.h"
#include "mozilla/Logging.h"
extern PRLogModuleInfo* GetDataChannelLog();
extern PRLogModuleInfo* GetSCTPLog();
namespace mozilla {
extern mozilla::LazyLogModule gDataChannelLog;
}
#undef LOG
#define LOG(args) MOZ_LOG(GetDataChannelLog(), mozilla::LogLevel::Debug, args)
#define LOG(args) MOZ_LOG(mozilla::gDataChannelLog, mozilla::LogLevel::Debug, args)
#endif

View File

@ -30,7 +30,8 @@ static PRIOMethods nsSOCKSIOLayerMethods;
static bool firstTime = true;
static bool ipv6Supported = true;
static PRLogModuleInfo *gSOCKSLog;
static mozilla::LazyLogModule gSOCKSLog("SOCKS");
#define LOGDEBUG(args) MOZ_LOG(gSOCKSLog, mozilla::LogLevel::Debug, args)
#define LOGERROR(args) MOZ_LOG(gSOCKSLog, mozilla::LogLevel::Error , args)
@ -1307,8 +1308,6 @@ nsSOCKSIOLayerAddToSocket(int32_t family,
nsSOCKSIOLayerMethods.close = nsSOCKSIOLayerClose;
firstTime = false;
gSOCKSLog = PR_NewLogModule("SOCKS");
}
LOGDEBUG(("Entering nsSOCKSIOLayerAddToSocket()."));

View File

@ -30,8 +30,7 @@
// this enables LogLevel::Debug level information and places all output in
// the file nspr.log
//
PRLogModuleInfo* gFTPDirListConvLog = nullptr;
static mozilla::LazyLogModule gFTPDirListConvLog("nsFTPDirListingConv");
// nsISupports implementation
NS_IMPL_ISUPPORTS(nsFTPDirListingConv,
@ -189,19 +188,6 @@ nsFTPDirListingConv::~nsFTPDirListingConv() {
NS_IF_RELEASE(mFinalListener);
}
nsresult
nsFTPDirListingConv::Init() {
//
// Initialize the global PRLogModule for FTP Protocol logging
// if necessary...
//
if (nullptr == gFTPDirListConvLog) {
gFTPDirListConvLog = PR_NewLogModule("nsFTPDirListingConv");
}
return NS_OK;
}
nsresult
nsFTPDirListingConv::GetHeaders(nsACString& headers,
nsIURI* uri)
@ -358,5 +344,5 @@ NS_NewFTPDirListingConv(nsFTPDirListingConv** aFTPDirListingConv)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*aFTPDirListingConv);
return (*aFTPDirListingConv)->Init();
return NS_OK;
}

View File

@ -34,7 +34,6 @@ public:
// nsFTPDirListingConv methods
nsFTPDirListingConv();
nsresult Init();
private:
virtual ~nsFTPDirListingConv();

View File

@ -20,12 +20,12 @@
#include "state.h"
#include "decode.h"
extern PRLogModuleInfo *gHttpLog;
#define LOG(args) MOZ_LOG(gHttpLog, mozilla::LogLevel::Debug, args)
namespace mozilla {
namespace net {
extern LazyLogModule gHttpLog;
#define LOG(args) MOZ_LOG(mozilla::net::gHttpLog, mozilla::LogLevel::Debug, args)
// nsISupports implementation
NS_IMPL_ISUPPORTS(nsHTTPCompressConv,
nsIStreamConverter,

View File

@ -42,7 +42,7 @@ static const unsigned int kNetworkChangeCoalescingPeriod = 1000;
using namespace mozilla;
static PRLogModuleInfo *gNotifyAddrLog = nullptr;
static LazyLogModule gNotifyAddrLog("nsNotifyAddr");
#define LOG(args) MOZ_LOG(gNotifyAddrLog, mozilla::LogLevel::Debug, args)
#define NETWORK_NOTIFY_CHANGED_PREF "network.notify.changed"
@ -349,9 +349,6 @@ class NuwaMarkLinkMonitorThreadRunner : public nsRunnable
nsresult
nsNotifyAddrListener::Init(void)
{
if (!gNotifyAddrLog)
gNotifyAddrLog = PR_NewLogModule("nsNotifyAddr");
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (!observerService)

View File

@ -19,7 +19,7 @@
using namespace mozilla;
static PRLogModuleInfo *gNotifyAddrLog = nullptr;
static LazyLogModule gNotifyAddrLog("nsNotifyAddr");
#define LOG(args) MOZ_LOG(gNotifyAddrLog, mozilla::LogLevel::Debug, args)
// If non-successful, extract the error code and return it. This
@ -125,9 +125,6 @@ nsNetworkLinkService::Init(void)
{
nsresult rv;
if (!gNotifyAddrLog)
gNotifyAddrLog = PR_NewLogModule("nsNotifyAddr");
nsCOMPtr<nsIObserverService> observerService =
do_GetService("@mozilla.org/observer-service;1", &rv);
NS_ENSURE_SUCCESS(rv, rv);

View File

@ -35,7 +35,7 @@
using namespace mozilla;
static PRLogModuleInfo *gNotifyAddrLog = nullptr;
static LazyLogModule gNotifyAddrLog("nsNotifyAddr");
#define LOG(args) MOZ_LOG(gNotifyAddrLog, mozilla::LogLevel::Debug, args)
static HMODULE sNetshell;
@ -248,9 +248,6 @@ nsNotifyAddrListener::Observe(nsISupports *subject,
nsresult
nsNotifyAddrListener::Init(void)
{
if (!gNotifyAddrLog)
gNotifyAddrLog = PR_NewLogModule("nsNotifyAddr");
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (!observerService)

View File

@ -7,10 +7,9 @@
#include "nsMemory.h"
#include "mozilla/Logging.h"
extern PRLogModuleInfo *gWifiMonitorLog;
extern mozilla::LazyLogModule gWifiMonitorLog;
#define LOG(args) MOZ_LOG(gWifiMonitorLog, mozilla::LogLevel::Debug, args)
NS_IMPL_ISUPPORTS(nsWifiAccessPoint, nsIWifiAccessPoint)
nsWifiAccessPoint::nsWifiAccessPoint()

View File

@ -20,7 +20,7 @@
using namespace mozilla;
PRLogModuleInfo *gWifiMonitorLog;
LazyLogModule gWifiMonitorLog("WifiMonitor");
NS_IMPL_ISUPPORTS(nsWifiMonitor,
nsIRunnable,
@ -32,8 +32,6 @@ nsWifiMonitor::nsWifiMonitor()
, mThreadComplete(false)
, mReentrantMonitor("nsWifiMonitor.mReentrantMonitor")
{
gWifiMonitorLog = PR_NewLogModule("WifiMonitor");
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
if (obsSvc)
obsSvc->AddObserver(this, "xpcom-shutdown", false);

View File

@ -26,7 +26,7 @@
#include "win_wifiScanner.h"
#endif
extern PRLogModuleInfo *gWifiMonitorLog;
extern mozilla::LazyLogModule gWifiMonitorLog;
#define LOG(args) MOZ_LOG(gWifiMonitorLog, mozilla::LogLevel::Debug, args)
class nsWifiAccessPoint;

View File

@ -22,7 +22,7 @@
using namespace mozilla;
PRLogModuleInfo *gWifiMonitorLog;
LazyLogModule gWifiMonitorLog("WifiMonitor");
NS_IMPL_ISUPPORTS(nsWifiMonitor,
nsIWifiMonitor,
@ -31,8 +31,6 @@ NS_IMPL_ISUPPORTS(nsWifiMonitor,
nsWifiMonitor::nsWifiMonitor()
{
gWifiMonitorLog = PR_NewLogModule("WifiMonitor");
nsCOMPtr<nsIObserverService> obsSvc = mozilla::services::GetObserverService();
if (obsSvc) {
obsSvc->AddObserver(this, "xpcom-shutdown", false);