From 3ea1cc0dd0e7ab1c0a20821172df4eea7a88585e Mon Sep 17 00:00:00 2001 From: roytam1 Date: Mon, 1 Mar 2021 10:32:55 +0800 Subject: [PATCH] import changes from `dev' branch of rmottola/Arctic-Fox: - Bug 1165515 - Part 1: Convert PR_LOG to MOZ_LOG. r=froydnj (034b6056f) - Bug 1165515 - Part 3: Convert PR_LOG_TEST to MOZ_LOG_TEST. r=froydnj (38739377e) - Bug 1165515 - Part 5: Convert instances of PR_LOG_ALWAYS. r=froydnj (867725f77) - Bug 1165515 - Part 7: Convert PR_LOG_DEBUG + 1 to PR_LOG_VERBOSE. rs=froydnj (afe55d0b8) - Bug 1165515 - Part 8: Convert log level 6 to PR_LOG_VERBOSE. r=jesup (d01127f2c) - Bug 1165515 - Part 9: Remove instances of using numeric log levels 15. rs=froydnj (2ff8b0056) - Bug 1165515 - Part 10: Convert mtransport/logging.h to use PR_LOG levels. r=ekr (a0334c607) - Bug 1165515 - Part 11: Align CSFLogLevel with PR_LOG levels. r=jesup (ca57ae88a) - Bug 1165515 - Part 12: Convert nsPluginLogging to use PR_LOG levels. r=bsmedberg (1f3226ca8) - Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj (96db7f2e9) - Bug 1165515 - Part 14: Undef PR_LOG macros when using mozilla/Logging.h. r=froydnj (81d9dc8e5) - fix some bustage after Bug 1165515 - Part 14, stuff missed in part 13 (80c83c78d) - Bug 1165515 - Part 15: Reduce log level of WebRTC during testing. r=jesup (dda33e173) --- build/automation.py.in | 2 +- build/automationutils.py | 2 +- docshell/base/nsDocShell.cpp | 30 +- docshell/shistory/src/nsSHistory.cpp | 6 +- dom/base/ThirdPartyUtil.cpp | 2 +- dom/base/nsContentPolicy.cpp | 4 +- dom/base/nsDOMDataChannel.cpp | 2 +- dom/base/nsDocument.cpp | 26 +- dom/base/nsFocusManager.cpp | 20 +- dom/base/nsGlobalWindow.cpp | 14 +- dom/base/nsNodeInfoManager.cpp | 6 +- dom/base/nsObjectLoadingContent.cpp | 4 +- dom/camera/CameraCommon.h | 4 +- dom/events/IMEStateManager.cpp | 126 ++-- dom/html/HTMLMediaElement.cpp | 64 +- dom/html/HTMLTrackElement.cpp | 10 +- dom/indexedDB/ActorsParent.cpp | 4 +- dom/indexedDB/ProfilerHelpers.h | 6 +- dom/ipc/ProcessPriorityManager.cpp | 4 +- dom/media/AudioSink.cpp | 4 +- dom/media/AudioStream.cpp | 26 +- dom/media/GraphDriver.cpp | 58 +- dom/media/Latency.cpp | 6 +- dom/media/MediaCache.cpp | 60 +- dom/media/MediaDecoder.cpp | 2 +- dom/media/MediaDecoderReader.cpp | 2 +- dom/media/MediaDecoderStateMachine.cpp | 8 +- dom/media/MediaFormatReader.cpp | 4 +- dom/media/MediaManager.cpp | 2 +- dom/media/MediaManager.h | 2 +- dom/media/MediaPromise.h | 2 +- dom/media/MediaRecorder.cpp | 46 +- dom/media/MediaResource.cpp | 2 +- dom/media/MediaShutdownManager.cpp | 6 +- dom/media/MediaStreamGraph.cpp | 60 +- dom/media/MediaTimer.h | 2 +- dom/media/RtspMediaResource.cpp | 2 +- dom/media/StateMirroring.h | 2 +- dom/media/StateWatching.h | 2 +- dom/media/StreamBuffer.cpp | 8 +- dom/media/TrackUnionStream.cpp | 6 +- dom/media/WebVTTListener.cpp | 2 +- dom/media/apple/AppleMP3Reader.cpp | 6 +- dom/media/directshow/AudioSinkFilter.cpp | 2 +- dom/media/directshow/AudioSinkInputPin.cpp | 2 +- dom/media/directshow/DirectShowReader.cpp | 2 +- dom/media/directshow/SampleSink.cpp | 6 +- dom/media/directshow/SourceFilter.cpp | 2 +- dom/media/encoder/MediaEncoder.cpp | 42 +- dom/media/encoder/TrackEncoder.cpp | 6 +- dom/media/encoder/VP8TrackEncoder.cpp | 2 +- dom/media/encoder/VorbisTrackEncoder.cpp | 2 +- dom/media/fmp4/MP4Reader.cpp | 4 +- dom/media/gmp/GMPAudioDecoderParent.cpp | 4 +- dom/media/gmp/GMPChild.cpp | 4 +- dom/media/gmp/GMPContentParent.cpp | 4 +- dom/media/gmp/GMPParent.cpp | 4 +- dom/media/gmp/GMPService.cpp | 4 +- dom/media/gmp/GMPServiceChild.cpp | 4 +- dom/media/gmp/GMPServiceParent.cpp | 4 +- dom/media/gmp/GMPStorageParent.cpp | 4 +- dom/media/gmp/GMPTimerParent.cpp | 4 +- dom/media/gmp/GMPVideoDecoderParent.cpp | 8 +- dom/media/gmp/GMPVideoEncoderParent.cpp | 6 +- dom/media/imagecapture/ImageCapture.h | 2 +- dom/media/mediasource/ContainerParser.cpp | 4 +- dom/media/mediasource/MediaSource.cpp | 4 +- dom/media/mediasource/MediaSourceDecoder.cpp | 4 +- dom/media/mediasource/MediaSourceReader.cpp | 4 +- dom/media/mediasource/MediaSourceResource.h | 2 +- dom/media/mediasource/ResourceQueue.cpp | 4 +- dom/media/mediasource/SourceBuffer.cpp | 6 +- dom/media/mediasource/SourceBufferDecoder.cpp | 2 +- dom/media/mediasource/SourceBufferList.cpp | 4 +- .../mediasource/SourceBufferResource.cpp | 4 +- dom/media/mediasource/TrackBuffer.cpp | 2 +- dom/media/mediasource/TrackBuffersManager.cpp | 4 +- dom/media/ogg/OggCodecState.cpp | 22 +- dom/media/ogg/OggReader.cpp | 48 +- dom/media/ogg/OpusParser.cpp | 42 +- dom/media/omx/AudioOffloadPlayer.cpp | 44 +- dom/media/omx/AudioOutput.cpp | 22 +- dom/media/omx/I420ColorConverterHelper.cpp | 2 +- dom/media/omx/MediaOmxCommonDecoder.cpp | 12 +- dom/media/omx/MediaOmxCommonReader.cpp | 6 +- dom/media/omx/MediaOmxReader.cpp | 2 +- dom/media/omx/OmxDecoder.cpp | 18 +- dom/media/platforms/apple/AppleATDecoder.cpp | 2 +- dom/media/platforms/apple/AppleCMLinker.cpp | 2 +- dom/media/platforms/apple/AppleVDADecoder.cpp | 2 +- dom/media/platforms/apple/AppleVDALinker.cpp | 2 +- dom/media/platforms/apple/AppleVTDecoder.cpp | 2 +- dom/media/platforms/apple/AppleVTLinker.cpp | 2 +- dom/media/platforms/ffmpeg/FFmpegLog.h | 2 +- .../gonk/GonkAudioDecoderManager.cpp | 2 +- .../platforms/gonk/GonkMediaDataDecoder.cpp | 2 +- .../gonk/GonkVideoDecoderManager.cpp | 2 +- dom/media/platforms/wmf/MFTDecoder.cpp | 2 +- .../platforms/wmf/WMFAudioMFTManager.cpp | 2 +- .../platforms/wmf/WMFMediaDataDecoder.cpp | 2 +- .../platforms/wmf/WMFVideoMFTManager.cpp | 2 +- dom/media/systemservices/LoadManager.cpp | 4 +- dom/media/systemservices/LoadMonitor.cpp | 6 +- dom/media/systemservices/MediaChild.cpp | 2 +- dom/media/systemservices/MediaParent.cpp | 2 +- dom/media/systemservices/OpenSLESProvider.cpp | 4 +- dom/media/wave/WaveReader.cpp | 6 +- dom/media/webm/AudioDecoder.cpp | 14 +- dom/media/webm/IntelWebMVideoDecoder.cpp | 2 +- dom/media/webm/WebMReader.cpp | 18 +- .../webrtc/MediaEngineCameraVideoSource.cpp | 6 +- .../webrtc/MediaEngineGonkVideoSource.cpp | 4 +- dom/media/webrtc/MediaEngineWebRTC.cpp | 4 +- dom/media/webrtc/MediaEngineWebRTCAudio.cpp | 6 +- dom/media/webrtc/MediaEngineWebRTCVideo.cpp | 6 +- .../recognition/SpeechRecognition.cpp | 2 +- .../webspeech/recognition/SpeechRecognition.h | 2 +- dom/media/webspeech/synth/SpeechSynthesis.cpp | 4 +- dom/media/webspeech/synth/nsSpeechTask.cpp | 16 +- .../webspeech/synth/nsSynthVoiceRegistry.cpp | 24 +- dom/media/wmf/WMFByteStream.cpp | 2 +- dom/media/wmf/WMFReader.cpp | 2 +- dom/media/wmf/WMFSourceReaderCallback.cpp | 2 +- dom/network/UDPSocket.h | 4 +- dom/network/UDPSocketChild.cpp | 4 +- dom/network/UDPSocketParent.cpp | 4 +- dom/plugins/base/nsNPAPIPlugin.cpp | 4 +- dom/plugins/base/nsPluginHost.cpp | 16 +- dom/plugins/base/nsPluginLogging.h | 15 +- .../base/nsPluginStreamListenerPeer.cpp | 6 +- dom/plugins/ipc/PluginInstanceChild.cpp | 10 +- dom/plugins/ipc/PluginInstanceParent.cpp | 4 +- dom/plugins/ipc/PluginMessageUtils.h | 6 +- dom/plugins/ipc/PluginModuleParent.cpp | 2 +- .../provider/MulticastDNSDeviceProvider.cpp | 4 +- dom/security/nsCSPContext.cpp | 4 +- dom/security/nsCSPParser.cpp | 4 +- dom/security/nsCSPService.cpp | 20 +- dom/security/nsCSPUtils.cpp | 4 +- dom/xslt/xslt/txExecutionState.cpp | 2 +- dom/xslt/xslt/txMozillaStylesheetCompiler.cpp | 2 +- dom/xslt/xslt/txMozillaXMLOutput.cpp | 6 +- dom/xslt/xslt/txStylesheet.cpp | 7 +- dom/xslt/xslt/txStylesheetCompiler.cpp | 14 +- dom/xul/XULDocument.cpp | 42 +- dom/xul/nsXULCommandDispatcher.cpp | 16 +- dom/xul/nsXULContentSink.cpp | 16 +- dom/xul/templates/nsContentTestNode.cpp | 7 +- dom/xul/templates/nsInstantiationNode.cpp | 2 +- .../templates/nsRDFConInstanceTestNode.cpp | 19 +- dom/xul/templates/nsRDFConMemberTestNode.cpp | 33 +- dom/xul/templates/nsRDFPropertyTestNode.cpp | 37 +- dom/xul/templates/nsRuleNetwork.cpp | 14 +- dom/xul/templates/nsXULContentBuilder.cpp | 18 +- dom/xul/templates/nsXULContentUtils.cpp | 2 +- dom/xul/templates/nsXULTemplateBuilder.cpp | 4 +- .../nsXULTemplateQueryProcessorRDF.cpp | 22 +- dom/xul/templates/nsXULTreeBuilder.cpp | 2 +- extensions/auth/nsAuth.h | 2 +- extensions/auth/nsAuthGSSAPI.cpp | 2 +- extensions/gio/nsGIOProtocolHandler.cpp | 2 +- .../pref/autoconfig/src/nsAutoConfig.cpp | 14 +- .../pref/autoconfig/src/nsReadConfig.cpp | 6 +- gfx/2d/Logging.h | 18 +- gfx/layers/Layers.cpp | 2 +- gfx/layers/LayersTypes.h | 4 +- gfx/thebes/gfxDWriteFontList.cpp | 20 +- gfx/thebes/gfxFT2FontList.cpp | 4 +- gfx/thebes/gfxFcPlatformFontList.cpp | 12 +- gfx/thebes/gfxFont.cpp | 8 +- gfx/thebes/gfxFontEntry.cpp | 4 +- gfx/thebes/gfxFontUtils.cpp | 4 +- gfx/thebes/gfxGDIFontList.cpp | 12 +- gfx/thebes/gfxMacPlatformFontList.mm | 12 +- gfx/thebes/gfxPlatformFontList.cpp | 20 +- gfx/thebes/gfxTextRun.cpp | 8 +- gfx/thebes/gfxUserFontSet.cpp | 4 +- hal/HalLog.h | 4 +- image/ImageLogging.h | 24 +- image/ProgressTracker.cpp | 4 +- image/RasterImage.cpp | 2 +- image/decoders/nsBMPDecoder.cpp | 10 +- image/decoders/nsJPEGDecoder.cpp | 38 +- image/decoders/nsPNGDecoder.cpp | 10 +- image/decoders/nsWEBPDecoder.cpp | 4 +- image/encoders/png/nsPNGEncoder.cpp | 4 +- image/imgLoader.cpp | 36 +- image/imgRequest.cpp | 18 +- image/imgRequestProxy.cpp | 6 +- ipc/chromium/src/base/logging.cc | 14 +- js/xpconnect/loader/mozJSComponentLoader.cpp | 2 +- js/xpconnect/src/XPCLog.cpp | 4 +- js/xpconnect/src/nsXPConnect.cpp | 4 +- layout/base/AccessibleCaretLogger.h | 4 +- layout/base/SelectionCarets.cpp | 4 +- layout/base/TouchCaret.cpp | 4 +- layout/base/nsDocumentViewer.cpp | 2 +- layout/base/nsPresContext.cpp | 2 +- layout/base/nsPresShell.cpp | 18 +- layout/base/nsRefreshDriver.cpp | 2 +- layout/generic/nsFlexContainerFrame.cpp | 14 +- layout/generic/nsPageFrame.cpp | 2 +- layout/generic/nsPluginFrame.cpp | 6 +- layout/generic/nsSimplePageSequenceFrame.cpp | 2 +- layout/printing/nsPrintData.cpp | 2 +- layout/printing/nsPrintEngine.cpp | 4 +- layout/style/FontFaceSet.cpp | 6 +- layout/style/Loader.cpp | 14 +- layout/style/nsFontFaceLoader.cpp | 6 +- media/libstagefright/binding/MoofParser.cpp | 2 +- media/mtransport/logging.h | 15 +- media/mtransport/nricectx.cpp | 6 +- media/mtransport/nrinterfaceprioritizer.cpp | 2 +- .../src/common/browser_logging/CSFLog.cpp | 8 +- .../src/common/browser_logging/CSFLog.h | 19 +- .../src/common/browser_logging/WebRtcLog.cpp | 4 +- .../src/media-conduit/AudioConduit.cpp | 8 +- .../src/media-conduit/WebrtcGmpVideoCodec.cpp | 8 +- .../src/peerconnection/PeerConnectionImpl.cpp | 2 +- modules/libjar/nsJARChannel.cpp | 4 +- netwerk/base/BackgroundFileSaver.cpp | 4 +- netwerk/base/Predictor.cpp | 2 +- netwerk/base/nsAsyncRedirectVerifyHelper.cpp | 2 +- netwerk/base/nsAsyncStreamCopier.cpp | 2 +- netwerk/base/nsAutodialWin.cpp | 6 +- netwerk/base/nsChannelClassifier.cpp | 2 +- netwerk/base/nsDirectoryIndexStream.cpp | 14 +- netwerk/base/nsInputStreamPump.cpp | 2 +- netwerk/base/nsLoadGroup.cpp | 14 +- netwerk/base/nsPACMan.cpp | 2 +- netwerk/base/nsProtocolProxyService.cpp | 2 +- netwerk/base/nsRequestObserverProxy.cpp | 2 +- netwerk/base/nsSecCheckWrapChannel.cpp | 6 +- netwerk/base/nsSocketTransportService2.h | 8 +- netwerk/base/nsStandardURL.cpp | 4 +- netwerk/cache/nsCache.cpp | 6 +- netwerk/cache/nsCache.h | 10 +- netwerk/cache/nsCacheService.cpp | 30 +- netwerk/cache/nsDiskCacheDevice.cpp | 4 +- netwerk/cache/nsDiskCacheDeviceSQL.cpp | 2 +- netwerk/cache2/CacheEntry.cpp | 4 - netwerk/cache2/CacheEntry.h | 2 - netwerk/cache2/CacheLog.cpp | 2 +- netwerk/cache2/CacheLog.h | 4 +- netwerk/cookie/nsCookieService.cpp | 116 ++-- netwerk/dns/GetAddrInfo.cpp | 4 +- .../mdns/libmdns/MDNSResponderOperator.cpp | 4 +- netwerk/dns/nsHostResolver.cpp | 2 +- netwerk/protocol/ftp/FTPChannelChild.cpp | 2 +- netwerk/protocol/ftp/FTPChannelParent.cpp | 2 +- .../protocol/ftp/nsFtpConnectionThread.cpp | 12 +- .../protocol/ftp/nsFtpControlConnection.cpp | 10 +- netwerk/protocol/ftp/nsFtpProtocolHandler.cpp | 4 +- netwerk/protocol/http/HttpBaseChannel.h | 4 +- netwerk/protocol/http/HttpLog.h | 22 +- netwerk/protocol/http/nsHttpConnectionInfo.h | 2 +- netwerk/protocol/res/nsResProtocolHandler.cpp | 7 +- .../rtsp/controller/RtspController.cpp | 2 +- .../rtsp/controller/RtspControllerChild.cpp | 2 +- .../rtsp/controller/RtspControllerParent.cpp | 2 +- netwerk/protocol/rtsp/rtsp/RtspPrlog.h | 8 +- netwerk/protocol/websocket/WebSocketLog.h | 2 +- netwerk/protocol/wyciwyg/nsWyciwyg.h | 18 +- netwerk/sctp/datachannel/DataChannel.cpp | 10 +- netwerk/sctp/datachannel/DataChannelLog.h | 2 +- netwerk/socket/nsSOCKSIOLayer.cpp | 8 +- .../converters/nsFTPDirListingConv.cpp | 12 +- .../linux/nsNotifyAddrListener_Linux.cpp | 2 +- netwerk/system/win32/nsNotifyAddrListener.cpp | 2 +- netwerk/test/TestBlockingSocket.cpp | 2 +- netwerk/test/TestIOThreads.cpp | 2 +- netwerk/test/TestOverlappedIO.cpp | 2 +- netwerk/test/TestProtocols.cpp | 2 +- netwerk/test/TestServ.cpp | 2 +- netwerk/test/TestSocketIO.cpp | 2 +- netwerk/test/TestSocketTransport.cpp | 2 +- netwerk/test/TestStreamChannel.cpp | 2 +- netwerk/test/TestStreamLoader.cpp | 2 +- netwerk/test/TestStreamPump.cpp | 2 +- netwerk/test/TestStreamTransport.cpp | 2 +- netwerk/test/TestUpload.cpp | 2 +- netwerk/wifi/nsWifiAccessPoint.cpp | 2 +- netwerk/wifi/nsWifiMonitor.h | 2 +- parser/htmlparser/nsExpatDriver.cpp | 16 +- rdf/base/nsInMemoryDataSource.cpp | 6 +- rdf/base/nsRDFContentSink.cpp | 16 +- rdf/base/nsRDFService.cpp | 30 +- rdf/base/nsRDFXMLDataSource.cpp | 24 +- security/apps/AppSignatureVerification.cpp | 2 +- security/certverifier/CertVerifier.cpp | 6 +- .../certverifier/NSSCertDBTrustDomain.cpp | 38 +- security/certverifier/OCSPCache.cpp | 4 +- security/certverifier/OCSPRequestor.cpp | 4 +- security/manager/ssl/CertBlocklist.cpp | 36 +- security/manager/ssl/PSMContentListener.cpp | 8 +- .../manager/ssl/PublicKeyPinningService.cpp | 20 +- .../ssl/RootCertificateTelemetryUtils.cpp | 4 +- .../manager/ssl/SSLServerCertVerification.cpp | 50 +- security/manager/ssl/nsCertTree.cpp | 14 +- security/manager/ssl/nsNSSCallbacks.cpp | 28 +- security/manager/ssl/nsNSSCertificate.cpp | 26 +- security/manager/ssl/nsNSSCertificateDB.cpp | 20 +- security/manager/ssl/nsNSSComponent.cpp | 70 +- security/manager/ssl/nsNSSIOLayer.cpp | 40 +- security/manager/ssl/nsNSSShutDown.cpp | 6 +- security/manager/ssl/nsNTLMAuthModule.cpp | 4 +- security/manager/ssl/nsPKCS11Slot.cpp | 6 +- security/manager/ssl/nsPKCS12Blob.cpp | 4 +- .../manager/ssl/nsSecureBrowserUIImpl.cpp | 76 +-- .../manager/ssl/nsSecurityHeaderParser.cpp | 2 +- .../manager/ssl/nsSiteSecurityService.cpp | 2 +- security/manager/ssl/nsUsageArrayHelper.cpp | 2 +- storage/VacuumManager.cpp | 4 +- storage/mozStorageAsyncStatement.cpp | 10 +- storage/mozStorageConnection.cpp | 14 +- storage/mozStorageStatement.cpp | 20 +- .../downloads/ApplicationReputation.cpp | 4 +- .../filewatcher/NativeFileWatcherWin.cpp | 2 +- toolkit/xre/nsUpdateDriver.cpp | 2 +- uriloader/base/nsDocLoader.cpp | 44 +- uriloader/base/nsURILoader.cpp | 6 +- .../exthandler/mac/nsOSHelperAppService.mm | 10 +- .../exthandler/nsExternalHelperAppService.cpp | 18 +- .../exthandler/unix/nsOSHelperAppService.cpp | 4 +- .../exthandler/win/nsOSHelperAppService.cpp | 2 +- .../prefetch/OfflineCacheUpdateChild.cpp | 6 +- uriloader/prefetch/OfflineCacheUpdateGlue.cpp | 6 +- .../prefetch/OfflineCacheUpdateParent.cpp | 6 +- uriloader/prefetch/nsOfflineCacheUpdate.cpp | 6 +- .../prefetch/nsOfflineCacheUpdateService.cpp | 6 +- uriloader/prefetch/nsPrefetchService.cpp | 6 +- widget/cocoa/NativeKeyBindings.mm | 20 +- widget/cocoa/TextInputHandler.mm | 180 ++--- widget/cocoa/nsChildView.mm | 10 +- widget/cocoa/nsClipboard.mm | 3 +- widget/cocoa/nsDragService.mm | 2 +- widget/gtk/nsDeviceContextSpecG.cpp | 2 +- widget/gtk/nsDragService.cpp | 146 ++--- widget/gtk/nsGtkIMModule.cpp | 186 +++--- widget/gtk/nsGtkKeyUtils.cpp | 56 +- widget/gtk/nsIdleServiceGTK.cpp | 12 +- widget/gtk/nsWindow.h | 8 +- widget/nsIdleService.cpp | 60 +- widget/qt/nsDeviceContextSpecQt.cpp | 2 +- widget/qt/nsWindow.h | 8 +- widget/windows/KeyboardLayout.cpp | 6 +- widget/windows/WinMouseScrollHandler.cpp | 120 ++-- widget/windows/WinUtils.cpp | 4 +- widget/windows/nsClipboard.cpp | 28 +- widget/windows/nsDataObj.cpp | 2 +- widget/windows/nsDeviceContextSpecWin.cpp | 2 +- widget/windows/nsIMM32Handler.cpp | 228 +++---- widget/windows/nsNativeThemeWin.cpp | 4 +- widget/windows/nsSound.cpp | 6 +- widget/windows/nsTextStore.cpp | 618 +++++++++--------- widget/windows/nsWinGesture.cpp | 2 +- widget/windows/nsWindow.cpp | 56 +- widget/windows/nsWindowDbg.cpp | 6 +- widget/windows/nsWindowDbg.h | 2 +- widget/xremoteclient/XRemoteClient.cpp | 58 +- xpcom/base/nsDebugImpl.cpp | 12 +- xpcom/base/nsTraceRefcnt.cpp | 4 +- xpcom/build/perfprobe.cpp | 2 +- xpcom/components/nsComponentManager.cpp | 24 +- xpcom/components/nsNativeModuleLoader.cpp | 10 +- xpcom/ds/TimeStamp_windows.cpp | 4 +- xpcom/ds/nsObserverService.cpp | 4 +- xpcom/glue/Logging.h | 3 + xpcom/io/nsInputStreamTee.cpp | 2 +- xpcom/io/nsPipe3.cpp | 2 +- xpcom/io/nsStorageStream.cpp | 4 +- xpcom/threads/TimerThread.cpp | 14 +- xpcom/threads/nsEventQueue.cpp | 2 +- xpcom/threads/nsThread.cpp | 2 +- xpcom/threads/nsThreadPool.cpp | 2 +- xpcom/threads/nsTimerImpl.cpp | 28 +- 376 files changed, 2627 insertions(+), 2588 deletions(-) diff --git a/build/automation.py.in b/build/automation.py.in index d3800ab59c..b3f82c0f6c 100644 --- a/build/automation.py.in +++ b/build/automation.py.in @@ -498,7 +498,7 @@ class Automation(object): env['XRE_NO_WINDOWS_CRASH_DIALOG'] = '1' # Set WebRTC logging in case it is not set yet - env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:5,datachannel:5,jsep:5,MediaPipelineFactory:5') + env.setdefault('NSPR_LOG_MODULES', 'signaling:3,mtransport:4,datachannel:4,jsep:4,MediaPipelineFactory:4') env.setdefault('R_LOG_LEVEL', '6') env.setdefault('R_LOG_DESTINATION', 'stderr') env.setdefault('R_LOG_VERBOSE', '1') diff --git a/build/automationutils.py b/build/automationutils.py index bdbdf0a889..3d08ad6e79 100644 --- a/build/automationutils.py +++ b/build/automationutils.py @@ -334,7 +334,7 @@ def environment(xrePath, env=None, debugger=False, dmdPath=None, lsanPath=None): env.setdefault('MOZ_DISABLE_NONLOCAL_CONNECTIONS', '1') # Set WebRTC logging in case it is not set yet - env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:5,datachannel:5,jsep:5,MediaPipelineFactory:5') + env.setdefault('NSPR_LOG_MODULES', 'signaling:3,mtransport:4,datachannel:4,jsep:4,MediaPipelineFactory:4') env.setdefault('R_LOG_LEVEL', '6') env.setdefault('R_LOG_DESTINATION', 'stderr') env.setdefault('R_LOG_VERBOSE', '1') diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index cdc4ca93e7..5f883ab3cf 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -925,7 +925,7 @@ nsDocShell::nsDocShell() gDocShellLeakLog = PR_NewLogModule("nsDocShellLeak"); } if (gDocShellLeakLog) { - PR_LOG(gDocShellLeakLog, PR_LOG_DEBUG, ("DOCSHELL %p created\n", this)); + MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p created\n", this)); } #ifdef DEBUG @@ -960,7 +960,7 @@ nsDocShell::~nsDocShell() } if (gDocShellLeakLog) { - PR_LOG(gDocShellLeakLog, PR_LOG_DEBUG, ("DOCSHELL %p destroyed\n", this)); + MOZ_LOG(gDocShellLeakLog, LogLevel::Debug, ("DOCSHELL %p destroyed\n", this)); } #ifdef DEBUG @@ -1099,7 +1099,7 @@ nsDocShell::GetInterface(const nsIID& aIID, void** aSink) } #if defined(DEBUG) - PR_LOG(gDocShellLog, PR_LOG_DEBUG, + MOZ_LOG(gDocShellLog, LogLevel::Debug, ("nsDocShell[%p]: returning app cache container %p", this, domDoc.get())); #endif @@ -1431,10 +1431,10 @@ nsDocShell::LoadURI(nsIURI* aURI, } #if defined(DEBUG) - if (PR_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gDocShellLog, LogLevel::Debug)) { nsAutoCString uristr; aURI->GetAsciiSpec(uristr); - PR_LOG(gDocShellLog, PR_LOG_DEBUG, + MOZ_LOG(gDocShellLog, LogLevel::Debug, ("nsDocShell[%p]: loading %s with flags 0x%08x", this, uristr.get(), aLoadFlags)); } @@ -1553,7 +1553,7 @@ nsDocShell::LoadURI(nsIURI* aURI, if (shEntry) { #ifdef DEBUG - PR_LOG(gDocShellLog, PR_LOG_DEBUG, + MOZ_LOG(gDocShellLog, LogLevel::Debug, ("nsDocShell[%p]: loading from session history", this)); #endif @@ -2005,7 +2005,7 @@ bool nsDocShell::SetCurrentURI(nsIURI* aURI, nsIRequest* aRequest, bool aFireOnLocationChange, uint32_t aLocationFlags) { - if (gDocShellLeakLog && PR_LOG_TEST(gDocShellLeakLog, PR_LOG_DEBUG)) { + if (gDocShellLeakLog && MOZ_LOG_TEST(gDocShellLeakLog, LogLevel::Debug)) { nsAutoCString spec; if (aURI) { aURI->GetSpec(spec); @@ -5300,7 +5300,7 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL, nsIChannel* aFailedChannel) { #if defined(DEBUG) - if (PR_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gDocShellLog, LogLevel::Debug)) { nsAutoCString spec; aURI->GetSpec(spec); @@ -5311,7 +5311,7 @@ nsDocShell::LoadErrorPage(nsIURI* aURI, const char16_t* aURL, chanName.AssignLiteral(""); } - PR_LOG(gDocShellLog, PR_LOG_DEBUG, + MOZ_LOG(gDocShellLog, LogLevel::Debug, ("nsDocShell[%p]::LoadErrorPage(\"%s\", \"%s\", {...}, [%s])\n", this, spec.get(), NS_ConvertUTF16toUTF8(aURL).get(), chanName.get())); } @@ -9677,7 +9677,7 @@ nsDocShell::InternalLoad2(nsIURI* aURI, nsresult rv = NS_OK; mOriginalUriString.Truncate(); - if (gDocShellLeakLog && PR_LOG_TEST(gDocShellLeakLog, PR_LOG_DEBUG)) { + if (gDocShellLeakLog && MOZ_LOG_TEST(gDocShellLeakLog, LogLevel::Debug)) { nsAutoCString spec; if (aURI) { aURI->GetSpec(spec); @@ -11288,7 +11288,7 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel, nsISupports* aOwner, NS_PRECONDITION(!aChannel || !aOwner, "Shouldn't have both set"); #if defined(DEBUG) - if (PR_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gDocShellLog, LogLevel::Debug)) { nsAutoCString spec; aURI->GetSpec(spec); @@ -11299,7 +11299,7 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel, nsISupports* aOwner, chanName.AssignLiteral(""); } - PR_LOG(gDocShellLog, PR_LOG_DEBUG, + MOZ_LOG(gDocShellLog, LogLevel::Debug, ("nsDocShell[%p]::OnNewURI(\"%s\", [%s], 0x%x)\n", this, spec.get(), chanName.get(), aLoadType)); } @@ -11364,7 +11364,7 @@ nsDocShell::OnNewURI(nsIURI* aURI, nsIChannel* aChannel, nsISupports* aOwner, // XXX This log message is almost useless because |updateSHistory| // and |updateGHistory| are not correct at this point. - PR_LOG(gDocShellLog, PR_LOG_DEBUG, + MOZ_LOG(gDocShellLog, LogLevel::Debug, (" shAvailable=%i updateSHistory=%i updateGHistory=%i" " equalURI=%i\n", shAvailable, updateSHistory, updateGHistory, equalUri)); @@ -11928,7 +11928,7 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel, NS_PRECONDITION(!aChannel || !aOwner, "Shouldn't have both set"); #if defined(DEBUG) - if (PR_LOG_TEST(gDocShellLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gDocShellLog, LogLevel::Debug)) { nsAutoCString spec; aURI->GetSpec(spec); @@ -11939,7 +11939,7 @@ nsDocShell::AddToSessionHistory(nsIURI* aURI, nsIChannel* aChannel, chanName.AssignLiteral(""); } - PR_LOG(gDocShellLog, PR_LOG_DEBUG, + MOZ_LOG(gDocShellLog, LogLevel::Debug, ("nsDocShell[%p]::AddToSessionHistory(\"%s\", [%s])\n", this, spec.get(), chanName.get())); } diff --git a/docshell/shistory/src/nsSHistory.cpp b/docshell/shistory/src/nsSHistory.cpp index ecbdecc331..19ae282082 100644 --- a/docshell/shistory/src/nsSHistory.cpp +++ b/docshell/shistory/src/nsSHistory.cpp @@ -68,7 +68,7 @@ GetSHistoryLog() } return sLog; } -#define LOG(format) PR_LOG(GetSHistoryLog(), PR_LOG_DEBUG, format) +#define LOG(format) MOZ_LOG(GetSHistoryLog(), LogLevel::Debug, format) // This macro makes it easier to print a log message which includes a URI's // spec. Example use: @@ -78,7 +78,7 @@ GetSHistoryLog() // #define LOG_SPEC(format, uri) \ PR_BEGIN_MACRO \ - if (PR_LOG_TEST(GetSHistoryLog(), PR_LOG_DEBUG)) { \ + if (MOZ_LOG_TEST(GetSHistoryLog(), LogLevel::Debug)) { \ nsAutoCString _specStr(NS_LITERAL_CSTRING("(null)"));\ if (uri) { \ uri->GetSpec(_specStr); \ @@ -96,7 +96,7 @@ GetSHistoryLog() // #define LOG_SHENTRY_SPEC(format, shentry) \ PR_BEGIN_MACRO \ - if (PR_LOG_TEST(GetSHistoryLog(), PR_LOG_DEBUG)) { \ + if (MOZ_LOG_TEST(GetSHistoryLog(), LogLevel::Debug)) { \ nsCOMPtr uri; \ shentry->GetURI(getter_AddRefs(uri)); \ LOG_SPEC(format, uri); \ diff --git a/dom/base/ThirdPartyUtil.cpp b/dom/base/ThirdPartyUtil.cpp index 4aefd2288c..16c1b462b3 100644 --- a/dom/base/ThirdPartyUtil.cpp +++ b/dom/base/ThirdPartyUtil.cpp @@ -24,7 +24,7 @@ NS_IMPL_ISUPPORTS(ThirdPartyUtil, mozIThirdPartyUtil) // static PRLogModuleInfo *gThirdPartyLog; #undef LOG -#define LOG(args) PR_LOG(gThirdPartyLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gThirdPartyLog, mozilla::LogLevel::Debug, args) nsresult ThirdPartyUtil::Init() diff --git a/dom/base/nsContentPolicy.cpp b/dom/base/nsContentPolicy.cpp index 6b61b14d15..0e74767e50 100644 --- a/dom/base/nsContentPolicy.cpp +++ b/dom/base/nsContentPolicy.cpp @@ -205,7 +205,7 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod, #define LOG_CHECK(logType) \ PR_BEGIN_MACRO \ /* skip all this nonsense if the call failed or logging is disabled */ \ - if (NS_SUCCEEDED(rv) && PR_LOG_TEST(gConPolLog, PR_LOG_DEBUG)) { \ + if (NS_SUCCEEDED(rv) && MOZ_LOG_TEST(gConPolLog, LogLevel::Debug)) { \ const char *resultName; \ if (decision) { \ resultName = NS_CP_ResponseName(*decision); \ @@ -220,7 +220,7 @@ nsContentPolicy::CheckPolicy(CPMethod policyMethod, if (requestingLocation) { \ requestingLocation->GetSpec(refSpec); \ } \ - PR_LOG(gConPolLog, PR_LOG_DEBUG, \ + MOZ_LOG(gConPolLog, LogLevel::Debug, \ ("Content Policy: " logType ": <%s> result=%s", \ spec.get(), refSpec.get(), resultName) \ ); \ diff --git a/dom/base/nsDOMDataChannel.cpp b/dom/base/nsDOMDataChannel.cpp index 5bbf6def1e..a96da7373e 100644 --- a/dom/base/nsDOMDataChannel.cpp +++ b/dom/base/nsDOMDataChannel.cpp @@ -11,7 +11,7 @@ extern PRLogModuleInfo* GetDataChannelLog(); #undef LOG -#define LOG(args) PR_LOG(GetDataChannelLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(GetDataChannelLog(), mozilla::LogLevel::Debug, args) #include "nsDOMDataChannelDeclarations.h" diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 56c05d9734..a7ccdd1453 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -1570,7 +1570,7 @@ nsDocument::nsDocument(const char* aContentType) gDocumentLeakPRLog = PR_NewLogModule("DocumentLeak"); if (gDocumentLeakPRLog) - PR_LOG(gDocumentLeakPRLog, PR_LOG_DEBUG, + MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug, ("DOCUMENT %p created", this)); if (!gCspPRLog) @@ -1614,7 +1614,7 @@ nsIDocument::~nsIDocument() nsDocument::~nsDocument() { if (gDocumentLeakPRLog) - PR_LOG(gDocumentLeakPRLog, PR_LOG_DEBUG, + MOZ_LOG(gDocumentLeakPRLog, LogLevel::Debug, ("DOCUMENT %p destroyed", this)); NS_ASSERTION(!mIsShowing, "Destroying a currently-showing document"); @@ -2269,7 +2269,7 @@ nsDocument::ResetToURI(nsIURI *aURI, nsILoadGroup *aLoadGroup, { NS_PRECONDITION(aURI, "Null URI passed to ResetToURI"); - if (gDocumentLeakPRLog && PR_LOG_TEST(gDocumentLeakPRLog, PR_LOG_DEBUG)) { + if (gDocumentLeakPRLog && MOZ_LOG_TEST(gDocumentLeakPRLog, LogLevel::Debug)) { nsAutoCString spec; aURI->GetSpec(spec); PR_LogPrint("DOCUMENT %p ResetToURI %s", this, spec.get()); @@ -2602,7 +2602,7 @@ nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsIStreamListener **aDocListener, bool aReset, nsIContentSink* aSink) { - if (gDocumentLeakPRLog && PR_LOG_TEST(gDocumentLeakPRLog, PR_LOG_DEBUG)) { + if (gDocumentLeakPRLog && MOZ_LOG_TEST(gDocumentLeakPRLog, LogLevel::Debug)) { nsCOMPtr uri; aChannel->GetURI(getter_AddRefs(uri)); nsAutoCString spec; @@ -2737,7 +2737,7 @@ AppendCSPFromHeader(nsIContentSecurityPolicy* csp, rv = csp->AppendPolicy(policy, aReportOnly); NS_ENSURE_SUCCESS(rv, rv); { - PR_LOG(gCspPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("CSP refined with policy: \"%s\"", NS_ConvertUTF16toUTF8(policy).get())); } @@ -2777,7 +2777,7 @@ nsDocument::InitCSP(nsIChannel* aChannel) { nsCOMPtr csp; if (!CSPService::sCSPEnabled) { - PR_LOG(gCspPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("CSP is disabled, skipping CSP init for document %p", this)); return NS_OK; } @@ -2840,12 +2840,12 @@ nsDocument::InitCSP(nsIChannel* aChannel) !applyLoopCSP && cspHeaderValue.IsEmpty() && cspROHeaderValue.IsEmpty()) { - if (PR_LOG_TEST(gCspPRLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gCspPRLog, LogLevel::Debug)) { nsCOMPtr chanURI; aChannel->GetURI(getter_AddRefs(chanURI)); nsAutoCString aspec; chanURI->GetAsciiSpec(aspec); - PR_LOG(gCspPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("no CSP for document, %s, %s", aspec.get(), applyAppDefaultCSP ? "is app" : "not an app")); @@ -2854,7 +2854,7 @@ nsDocument::InitCSP(nsIChannel* aChannel) return NS_OK; } - PR_LOG(gCspPRLog, PR_LOG_DEBUG, ("Document is an app or CSP header specified %p", this)); + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("Document is an app or CSP header specified %p", this)); nsresult rv; @@ -2873,7 +2873,7 @@ nsDocument::InitCSP(nsIChannel* aChannel) NS_ENSURE_SUCCESS(rv, rv); if (csp) { - PR_LOG(gCspPRLog, PR_LOG_DEBUG, ("%s %s %s", + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("%s %s %s", "This document is sharing principal with another document.", "Since the document is an app, CSP was already set.", "Skipping attempt to set CSP.")); @@ -2884,7 +2884,7 @@ nsDocument::InitCSP(nsIChannel* aChannel) csp = do_CreateInstance("@mozilla.org/cspcontext;1", &rv); if (NS_FAILED(rv)) { - PR_LOG(gCspPRLog, PR_LOG_DEBUG, ("Failed to create CSP object: %x", rv)); + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("Failed to create CSP object: %x", rv)); return rv; } @@ -2937,7 +2937,7 @@ nsDocument::InitCSP(nsIChannel* aChannel) rv = csp->PermitsAncestry(docShell, &safeAncestry); if (NS_FAILED(rv) || !safeAncestry) { - PR_LOG(gCspPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("CSP doesn't like frame's ancestry, not loading.")); // stop! ERROR page! aChannel->Cancel(NS_ERROR_CSP_FRAME_ANCESTOR_VIOLATION); @@ -2962,7 +2962,7 @@ nsDocument::InitCSP(nsIChannel* aChannel) rv = principal->SetCsp(csp); NS_ENSURE_SUCCESS(rv, rv); - PR_LOG(gCspPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("Inserted CSP into principal %p", principal)); return NS_OK; diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index b25bf7f1b4..ee783daf9d 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -80,16 +80,16 @@ using namespace mozilla::widget; PRLogModuleInfo* gFocusLog; PRLogModuleInfo* gFocusNavigationLog; -#define LOGFOCUS(args) PR_LOG(gFocusLog, PR_LOG_DEBUG, args) -#define LOGFOCUSNAVIGATION(args) PR_LOG(gFocusNavigationLog, PR_LOG_DEBUG, args) +#define LOGFOCUS(args) MOZ_LOG(gFocusLog, mozilla::LogLevel::Debug, args) +#define LOGFOCUSNAVIGATION(args) MOZ_LOG(gFocusNavigationLog, mozilla::LogLevel::Debug, args) #define LOGTAG(log, format, content) \ - if (PR_LOG_TEST(log, PR_LOG_DEBUG)) { \ + if (MOZ_LOG_TEST(log, LogLevel::Debug)) { \ nsAutoCString tag(NS_LITERAL_CSTRING("(none)")); \ if (content) { \ content->NodeInfo()->NameAtom()->ToUTF8String(tag); \ } \ - PR_LOG(log, PR_LOG_DEBUG, (format, tag.get())); \ + MOZ_LOG(log, LogLevel::Debug, (format, tag.get())); \ } #define LOGCONTENT(format, content) LOGTAG(gFocusLog, format, content) @@ -485,7 +485,7 @@ nsFocusManager::MoveFocus(nsIDOMWindow* aWindow, nsIDOMElement* aStartElement, LOGFOCUS(("<>", aType, aFlags)); - if (PR_LOG_TEST(gFocusLog, PR_LOG_DEBUG) && mFocusedWindow) { + if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug) && mFocusedWindow) { nsIDocument* doc = mFocusedWindow->GetExtantDoc(); if (doc && doc->GetDocumentURI()) { nsAutoCString spec; @@ -645,7 +645,7 @@ nsFocusManager::WindowRaised(nsIDOMWindow* aWindow) nsCOMPtr window = do_QueryInterface(aWindow); NS_ENSURE_TRUE(window && window->IsOuterWindow(), NS_ERROR_INVALID_ARG); - if (PR_LOG_TEST(gFocusLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug)) { LOGFOCUS(("Window %p Raised [Currently: %p %p]", aWindow, mActiveWindow.get(), mFocusedWindow.get())); nsAutoCString spec; nsIDocument* doc = window->GetExtantDoc(); @@ -741,7 +741,7 @@ nsFocusManager::WindowLowered(nsIDOMWindow* aWindow) nsCOMPtr window = do_QueryInterface(aWindow); NS_ENSURE_TRUE(window && window->IsOuterWindow(), NS_ERROR_INVALID_ARG); - if (PR_LOG_TEST(gFocusLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug)) { LOGFOCUS(("Window %p Lowered [Currently: %p %p]", aWindow, mActiveWindow.get(), mFocusedWindow.get())); nsAutoCString spec; nsIDocument* doc = window->GetExtantDoc(); @@ -859,7 +859,7 @@ nsFocusManager::WindowShown(nsIDOMWindow* aWindow, bool aNeedsFocus) window = window->GetOuterWindow(); - if (PR_LOG_TEST(gFocusLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug)) { LOGFOCUS(("Window %p Shown [Currently: %p %p]", window.get(), mActiveWindow.get(), mFocusedWindow.get())); nsAutoCString spec; nsIDocument* doc = window->GetExtantDoc(); @@ -914,7 +914,7 @@ nsFocusManager::WindowHidden(nsIDOMWindow* aWindow) window = window->GetOuterWindow(); - if (PR_LOG_TEST(gFocusLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug)) { LOGFOCUS(("Window %p Hidden [Currently: %p %p]", window.get(), mActiveWindow.get(), mFocusedWindow.get())); nsAutoCString spec; nsIDocument* doc = window->GetExtantDoc(); @@ -1785,7 +1785,7 @@ nsFocusManager::Focus(nsPIDOMWindow* aWindow, LOGCONTENT("Element %s has been focused", aContent); - if (PR_LOG_TEST(gFocusLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gFocusLog, LogLevel::Debug)) { nsIDocument* docm = aWindow->GetExtantDoc(); if (docm) { LOGCONTENT(" from %s", docm->GetRootElement()); diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 025f1e301f..ccb490488b 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -1213,7 +1213,7 @@ nsGlobalWindow::nsGlobalWindow(nsGlobalWindow *aOuterWindow) #endif if (gDOMLeakPRLog) - PR_LOG(gDOMLeakPRLog, PR_LOG_DEBUG, + MOZ_LOG(gDOMLeakPRLog, LogLevel::Debug, ("DOMWINDOW %p created outer=%p", this, aOuterWindow)); NS_ASSERTION(sWindowsById, "Windows hash table must be created!"); @@ -1303,7 +1303,7 @@ nsGlobalWindow::~nsGlobalWindow() #endif if (gDOMLeakPRLog) - PR_LOG(gDOMLeakPRLog, PR_LOG_DEBUG, + MOZ_LOG(gDOMLeakPRLog, LogLevel::Debug, ("DOMWINDOW %p destroyed", this)); if (IsOuterWindow()) { @@ -2830,7 +2830,7 @@ nsGlobalWindow::InnerSetNewDocument(JSContext* aCx, nsIDocument* aDocument) NS_PRECONDITION(IsInnerWindow(), "Must only be called on inner windows"); MOZ_ASSERT(aDocument); - if (gDOMLeakPRLog && PR_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) { + if (gDOMLeakPRLog && MOZ_LOG_TEST(gDOMLeakPRLog, LogLevel::Debug)) { nsIURI *uri = aDocument->GetDocumentURI(); nsAutoCString spec; if (uri) @@ -10719,7 +10719,7 @@ nsGlobalWindow::GetSessionStorage(ErrorResult& aError) } if (mSessionStorage) { - if (PR_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gDOMLeakPRLog, LogLevel::Debug)) { PR_LogPrint("nsGlobalWindow %p has %p sessionStorage", this, mSessionStorage.get()); } bool canAccess = mSessionStorage->CanAccess(principal); @@ -10770,7 +10770,7 @@ nsGlobalWindow::GetSessionStorage(ErrorResult& aError) mSessionStorage = static_cast(storage.get()); MOZ_ASSERT(mSessionStorage); - if (PR_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gDOMLeakPRLog, LogLevel::Debug)) { PR_LogPrint("nsGlobalWindow %p tried to get a new sessionStorage %p", this, mSessionStorage.get()); } @@ -10780,7 +10780,7 @@ nsGlobalWindow::GetSessionStorage(ErrorResult& aError) } } - if (PR_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gDOMLeakPRLog, LogLevel::Debug)) { PR_LogPrint("nsGlobalWindow %p returns %p sessionStorage", this, mSessionStorage.get()); } @@ -11698,7 +11698,7 @@ nsGlobalWindow::Observe(nsISupports* aSubject, const char* aTopic, return NS_OK; } - if (PR_LOG_TEST(gDOMLeakPRLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gDOMLeakPRLog, LogLevel::Debug)) { PR_LogPrint("nsGlobalWindow %p with sessionStorage %p passing event from %p", this, mSessionStorage.get(), changingStorage.get()); } diff --git a/dom/base/nsNodeInfoManager.cpp b/dom/base/nsNodeInfoManager.cpp index 6c093159f3..5d850daa09 100644 --- a/dom/base/nsNodeInfoManager.cpp +++ b/dom/base/nsNodeInfoManager.cpp @@ -119,7 +119,7 @@ nsNodeInfoManager::nsNodeInfoManager() gNodeInfoManagerLeakPRLog = PR_NewLogModule("NodeInfoManagerLeak"); if (gNodeInfoManagerLeakPRLog) - PR_LOG(gNodeInfoManagerLeakPRLog, PR_LOG_DEBUG, + MOZ_LOG(gNodeInfoManagerLeakPRLog, LogLevel::Debug, ("NODEINFOMANAGER %p created", this)); mNodeInfoHash = PL_NewHashTable(32, GetNodeInfoInnerHashValue, @@ -139,7 +139,7 @@ nsNodeInfoManager::~nsNodeInfoManager() mBindingManager = nullptr; if (gNodeInfoManagerLeakPRLog) - PR_LOG(gNodeInfoManagerLeakPRLog, PR_LOG_DEBUG, + MOZ_LOG(gNodeInfoManagerLeakPRLog, LogLevel::Debug, ("NODEINFOMANAGER %p destroyed", this)); nsLayoutStatics::Release(); @@ -196,7 +196,7 @@ nsNodeInfoManager::Init(nsIDocument *aDocument) mDocument = aDocument; if (gNodeInfoManagerLeakPRLog) - PR_LOG(gNodeInfoManagerLeakPRLog, PR_LOG_DEBUG, + MOZ_LOG(gNodeInfoManagerLeakPRLog, LogLevel::Debug, ("NODEINFOMANAGER %p Init document=%p", this, aDocument)); return NS_OK; diff --git a/dom/base/nsObjectLoadingContent.cpp b/dom/base/nsObjectLoadingContent.cpp index 38409bd500..3ceb0b9a4b 100644 --- a/dom/base/nsObjectLoadingContent.cpp +++ b/dom/base/nsObjectLoadingContent.cpp @@ -117,8 +117,8 @@ GetObjectLog() return sLog; } -#define LOG(args) PR_LOG(GetObjectLog(), PR_LOG_DEBUG, args) -#define LOG_ENABLED() PR_LOG_TEST(GetObjectLog(), PR_LOG_DEBUG) +#define LOG(args) MOZ_LOG(GetObjectLog(), mozilla::LogLevel::Debug, args) +#define LOG_ENABLED() MOZ_LOG_TEST(GetObjectLog(), mozilla::LogLevel::Debug) static bool IsJavaMIME(const nsACString & aMIMEType) diff --git a/dom/camera/CameraCommon.h b/dom/camera/CameraCommon.h index a79d984693..ac383c5aee 100644 --- a/dom/camera/CameraCommon.h +++ b/dom/camera/CameraCommon.h @@ -18,9 +18,9 @@ #include "mozilla/Logging.h" extern PRLogModuleInfo* GetCameraLog(); -#define DOM_CAMERA_LOG( type, ... ) PR_LOG(GetCameraLog(), (PRLogModuleLevel)type, ( __VA_ARGS__ )) +#define DOM_CAMERA_LOG( type, ... ) MOZ_LOG(GetCameraLog(), (mozilla::LogLevel)type, ( __VA_ARGS__ )) -#define DOM_CAMERA_LOGA( ... ) DOM_CAMERA_LOG( 0, __VA_ARGS__ ) +#define DOM_CAMERA_LOGA( ... ) DOM_CAMERA_LOG( mozilla::LogLevel::Error, __VA_ARGS__ ) /** * From the least to the most output. diff --git a/dom/events/IMEStateManager.cpp b/dom/events/IMEStateManager.cpp index 3ea48ffc20..b93ae454ea 100644 --- a/dom/events/IMEStateManager.cpp +++ b/dom/events/IMEStateManager.cpp @@ -44,16 +44,16 @@ using namespace widget; /** * When a method is called, log its arguments and/or related static variables - * with PR_LOG_ALWAYS. However, if it puts too many logs like + * with LogLevel::Info. However, if it puts too many logs like * OnDestroyPresContext(), should long only when the method actually does * something. In this case, the log should start with "ISM: ". * * When a method quits due to unexpected situation, log the reason with - * PR_LOG_ERROR. In this case, the log should start with + * LogLevel::Error. In this case, the log should start with * "ISM: (), FAILED". The indent makes the log look easier. * * When a method does something only in some situations and it may be important - * for debug, log the information with PR_LOG_DEBUG. In this case, the log + * for debug, log the information with LogLevel::Debug. In this case, the log * should start with "ISM: (),". */ PRLogModuleInfo* sISMLog = nullptr; @@ -205,7 +205,7 @@ IMEStateManager::Init() void IMEStateManager::Shutdown() { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::Shutdown(), " "sTextCompositions=0x%p, sTextCompositions->Length()=%u", sTextCompositions, sTextCompositions ? sTextCompositions->Length() : 0)); @@ -226,7 +226,7 @@ IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext) TextCompositionArray::index_type i = sTextCompositions->IndexOf(aPresContext); if (i != TextCompositionArray::NoIndex) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnDestroyPresContext(), " "removing TextComposition instance from the array (index=%u)", i)); // there should be only one composition per presContext object. @@ -234,7 +234,7 @@ IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext) sTextCompositions->RemoveElementAt(i); if (sTextCompositions->IndexOf(aPresContext) != TextCompositionArray::NoIndex) { - PR_LOG(sISMLog, PR_LOG_ERROR, + MOZ_LOG(sISMLog, LogLevel::Error, ("ISM: IMEStateManager::OnDestroyPresContext(), FAILED to remove " "TextComposition instance from the array")); MOZ_CRASH("Failed to remove TextComposition instance from the array"); @@ -246,7 +246,7 @@ IMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext) return NS_OK; } - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::OnDestroyPresContext(aPresContext=0x%p), " "sPresContext=0x%p, sContent=0x%p, sTextCompositions=0x%p", aPresContext, sPresContext, sContent, sTextCompositions)); @@ -278,7 +278,7 @@ IMEStateManager::OnRemoveContent(nsPresContext* aPresContext, sTextCompositions->GetCompositionInContent(aPresContext, aContent); if (compositionInContent) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnRemoveContent(), " "composition is in the content")); @@ -301,7 +301,7 @@ IMEStateManager::OnRemoveContent(nsPresContext* aPresContext, return NS_OK; } - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::OnRemoveContent(aPresContext=0x%p, " "aContent=0x%p), sPresContext=0x%p, sContent=0x%p, sTextCompositions=0x%p", aPresContext, aContent, sPresContext, sContent, sTextCompositions)); @@ -329,7 +329,7 @@ IMEStateManager::OnChangeFocus(nsPresContext* aPresContext, nsIContent* aContent, InputContextAction::Cause aCause) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::OnChangeFocus(aPresContext=0x%p, " "aContent=0x%p, aCause=%s)", aPresContext, aContent, GetActionCauseName(aCause))); @@ -344,7 +344,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext, nsIContent* aContent, InputContextAction aAction) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::OnChangeFocusInternal(aPresContext=0x%p, " "aContent=0x%p, aAction={ mCause=%s, mFocusChange=%s }), " "sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p", @@ -372,7 +372,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext, } if (!aPresContext) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnChangeFocusInternal(), " "no nsPresContext is being activated")); return NS_OK; @@ -382,7 +382,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext, (sPresContext == aPresContext) ? oldWidget.get() : aPresContext->GetRootWidget(); if (NS_WARN_IF(!widget)) { - PR_LOG(sISMLog, PR_LOG_ERROR, + MOZ_LOG(sISMLog, LogLevel::Error, ("ISM: IMEStateManager::OnChangeFocusInternal(), FAILED due to " "no widget to manage its IME state")); return NS_OK; @@ -400,7 +400,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext, // on focus to the main process... but this cannot cause bugs like missed keypresses. // (It just means a lot of needless IPC.) if ((newState.mEnabled == IMEState::DISABLED) && TabParent::GetIMETabParent()) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnChangeFocusInternal(), " "Parent process cancels to set DISABLED state because the content process " "has IME focus and has already sets IME state")); @@ -415,7 +415,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext, // we should do it. InputContext context = widget->GetInputContext(); if (context.mIMEState.mEnabled == newState.mEnabled) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnChangeFocusInternal(), " "neither focus nor IME state is changing")); return NS_OK; @@ -454,7 +454,7 @@ IMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext, void IMEStateManager::OnInstalledMenuKeyboardListener(bool aInstalling) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::OnInstalledMenuKeyboardListener(aInstalling=%s), " "sInstalledMenuKeyboardListener=%s", GetBoolName(aInstalling), GetBoolName(sInstalledMenuKeyboardListener))); @@ -473,27 +473,27 @@ IMEStateManager::OnMouseButtonEventInEditor(nsPresContext* aPresContext, nsIContent* aContent, nsIDOMMouseEvent* aMouseEvent) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::OnMouseButtonEventInEditor(aPresContext=0x%p, " "aContent=0x%p, aMouseEvent=0x%p), sPresContext=0x%p, sContent=0x%p", aPresContext, aContent, aMouseEvent, sPresContext, sContent)); if (sPresContext != aPresContext || sContent != aContent) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnMouseButtonEventInEditor(), " "the mouse event isn't fired on the editor managed by ISM")); return false; } if (!sActiveIMEContentObserver) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnMouseButtonEventInEditor(), " "there is no active IMEContentObserver")); return false; } if (!sActiveIMEContentObserver->IsManaging(aPresContext, aContent)) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnMouseButtonEventInEditor(), " "the active IMEContentObserver isn't managing the editor")); return false; @@ -502,7 +502,7 @@ IMEStateManager::OnMouseButtonEventInEditor(nsPresContext* aPresContext, WidgetMouseEvent* internalEvent = aMouseEvent->GetInternalNSEvent()->AsMouseEvent(); if (NS_WARN_IF(!internalEvent)) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnMouseButtonEventInEditor(), " "the internal event of aMouseEvent isn't WidgetMouseEvent")); return false; @@ -511,10 +511,10 @@ IMEStateManager::OnMouseButtonEventInEditor(nsPresContext* aPresContext, bool consumed = sActiveIMEContentObserver->OnMouseButtonEvent(aPresContext, internalEvent); - if (PR_LOG_TEST(sISMLog, PR_LOG_ALWAYS)) { + if (MOZ_LOG_TEST(sISMLog, LogLevel::Info)) { nsAutoString eventType; aMouseEvent->GetType(eventType); - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::OnMouseButtonEventInEditor(), " "mouse event (type=%s, button=%d) is %s", NS_ConvertUTF16toUTF8(eventType).get(), internalEvent->button, @@ -530,13 +530,13 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext, nsIContent* aContent, nsIDOMMouseEvent* aMouseEvent) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::OnClickInEditor(aPresContext=0x%p, aContent=0x%p, " "aMouseEvent=0x%p), sPresContext=0x%p, sContent=0x%p", aPresContext, aContent, aMouseEvent, sPresContext, sContent)); if (sPresContext != aPresContext || sContent != aContent) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnClickInEditor(), " "the mouse event isn't fired on the editor managed by ISM")); return; @@ -549,7 +549,7 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext, nsresult rv = aMouseEvent->GetIsTrusted(&isTrusted); NS_ENSURE_SUCCESS_VOID(rv); if (!isTrusted) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnClickInEditor(), " "the mouse event isn't a trusted event")); return; // ignore untrusted event. @@ -559,7 +559,7 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext, rv = aMouseEvent->GetButton(&button); NS_ENSURE_SUCCESS_VOID(rv); if (button != 0) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnClickInEditor(), " "the mouse event isn't a left mouse button event")); return; // not a left click event. @@ -569,7 +569,7 @@ IMEStateManager::OnClickInEditor(nsPresContext* aPresContext, rv = aMouseEvent->GetDetail(&clickCount); NS_ENSURE_SUCCESS_VOID(rv); if (clickCount != 1) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnClickInEditor(), " "the mouse event isn't a single click event")); return; // should notify only first click event. @@ -587,7 +587,7 @@ IMEStateManager::OnFocusInEditor(nsPresContext* aPresContext, nsIContent* aContent, nsIEditor* aEditor) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::OnFocusInEditor(aPresContext=0x%p, aContent=0x%p, " "aEditor=0x%p), sPresContext=0x%p, sContent=0x%p, " "sActiveIMEContentObserver=0x%p", @@ -595,7 +595,7 @@ IMEStateManager::OnFocusInEditor(nsPresContext* aPresContext, sActiveIMEContentObserver)); if (sPresContext != aPresContext || sContent != aContent) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnFocusInEditor(), " "an editor not managed by ISM gets focus")); return; @@ -605,7 +605,7 @@ IMEStateManager::OnFocusInEditor(nsPresContext* aPresContext, // we need to recreate the instance. if (sActiveIMEContentObserver) { if (sActiveIMEContentObserver->IsManaging(aPresContext, aContent)) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::OnFocusInEditor(), " "the editor is already being managed by sActiveIMEContentObserver")); return; @@ -622,7 +622,7 @@ IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState, nsIContent* aContent, nsIEditor* aEditor) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::UpdateIMEState(aNewIMEState={ mEnabled=%s, " "mOpen=%s }, aContent=0x%p, aEditor=0x%p), " "sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p, " @@ -633,21 +633,21 @@ IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState, GetBoolName(sIsGettingNewIMEState))); if (sIsGettingNewIMEState) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::UpdateIMEState(), " "does nothing because of called while getting new IME state")); return; } if (NS_WARN_IF(!sPresContext)) { - PR_LOG(sISMLog, PR_LOG_ERROR, + MOZ_LOG(sISMLog, LogLevel::Error, ("ISM: IMEStateManager::UpdateIMEState(), FAILED due to " "no managing nsPresContext")); return; } nsCOMPtr widget = sPresContext->GetRootWidget(); if (NS_WARN_IF(!widget)) { - PR_LOG(sISMLog, PR_LOG_ERROR, + MOZ_LOG(sISMLog, LogLevel::Error, ("ISM: IMEStateManager::UpdateIMEState(), FAILED due to " "no widget for the managing nsPresContext")); return; @@ -657,12 +657,12 @@ IMEStateManager::UpdateIMEState(const IMEState& aNewIMEState, // editor with current editable root content due to reframed. In such case, // We should try to reinitialize the IMEContentObserver. if (sActiveIMEContentObserver && IsIMEObserverNeeded(aNewIMEState)) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::UpdateIMEState(), try to reinitialize the " "active IMEContentObserver")); if (!sActiveIMEContentObserver->MaybeReinitialize(widget, sPresContext, aContent, aEditor)) { - PR_LOG(sISMLog, PR_LOG_ERROR, + MOZ_LOG(sISMLog, LogLevel::Error, ("ISM: IMEStateManager::UpdateIMEState(), failed to reinitialize the " "active IMEContentObserver")); } @@ -702,7 +702,7 @@ IMEState IMEStateManager::GetNewIMEState(nsPresContext* aPresContext, nsIContent* aContent) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::GetNewIMEState(aPresContext=0x%p, aContent=0x%p), " "sInstalledMenuKeyboardListener=%s", aPresContext, aContent, GetBoolName(sInstalledMenuKeyboardListener))); @@ -710,14 +710,14 @@ IMEStateManager::GetNewIMEState(nsPresContext* aPresContext, // On Printing or Print Preview, we don't need IME. if (aPresContext->Type() == nsPresContext::eContext_PrintPreview || aPresContext->Type() == nsPresContext::eContext_Print) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::GetNewIMEState() returns DISABLED because " "the nsPresContext is for print or print preview")); return IMEState(IMEState::DISABLED); } if (sInstalledMenuKeyboardListener) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::GetNewIMEState() returns DISABLED because " "menu keyboard listener was installed")); return IMEState(IMEState::DISABLED); @@ -728,12 +728,12 @@ IMEStateManager::GetNewIMEState(nsPresContext* aPresContext, // editable, such case is design mode. nsIDocument* doc = aPresContext->Document(); if (doc && doc->HasFlag(NODE_IS_EDITABLE)) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::GetNewIMEState() returns ENABLED because " "design mode editor has focus")); return IMEState(IMEState::ENABLED); } - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::GetNewIMEState() returns DISABLED because " "no content has focus")); return IMEState(IMEState::DISABLED); @@ -747,7 +747,7 @@ IMEStateManager::GetNewIMEState(nsPresContext* aPresContext, GettingNewIMEStateBlocker blocker; IMEState newIMEState = aContent->GetDesiredIMEState(); - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::GetNewIMEState() returns { mEnabled=%s, " "mOpen=%s }", GetIMEStateEnabledName(newIMEState.mEnabled), @@ -768,7 +768,7 @@ public: nsCOMPtr observerService = services::GetObserverService(); if (observerService) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEEnabledStateChangedEvent::Run(), notifies observers of " "\"ime-enabled-state-changed\"")); nsAutoString state; @@ -809,7 +809,7 @@ IMEStateManager::SetIMEState(const IMEState& aState, nsIWidget* aWidget, InputContextAction aAction) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::SetIMEState(aState={ mEnabled=%s, mOpen=%s }, " "aContent=0x%p, aWidget=0x%p, aAction={ mCause=%s, mFocusChange=%s })", GetIMEStateEnabledName(aState.mEnabled), @@ -897,7 +897,7 @@ IMEStateManager::SetIMEState(const IMEState& aState, } - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::SetIMEState(), " "calling nsIWidget::SetInputContext(context={ mIMEState={ mEnabled=%s, " "mOpen=%s }, mHTMLInputType=\"%s\", mHTMLInputInputmode=\"%s\", " @@ -939,7 +939,7 @@ IMEStateManager::DispatchCompositionEvent( EventDispatchingCallback* aCallBack, bool aIsSynthesized) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::DispatchCompositionEvent(aNode=0x%p, " "aPresContext=0x%p, aCompositionEvent={ message=%s, " "mFlags={ mIsTrusted=%s, mPropagationStopped=%s } }, " @@ -968,7 +968,7 @@ IMEStateManager::DispatchCompositionEvent( if (NS_WARN_IF(aIsSynthesized)) { return; } - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::DispatchCompositionEvent(), " "adding new TextComposition to the array")); MOZ_ASSERT(aCompositionEvent->message == NS_COMPOSITION_START); @@ -1004,7 +1004,7 @@ IMEStateManager::DispatchCompositionEvent( TextCompositionArray::index_type i = sTextCompositions->IndexOf(aCompositionEvent->widget); if (i != TextCompositionArray::NoIndex) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::DispatchCompositionEvent(), " "removing TextComposition from the array since NS_COMPOSTION_END " "was dispatched")); @@ -1022,7 +1022,7 @@ IMEStateManager::OnCompositionEventDiscarded( // Note that this method is never called for synthesized events for emulating // commit or cancel composition. - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::OnCompositionEventDiscarded(aCompositionEvent={ " "message=%s, mFlags={ mIsTrusted=%s } })", GetEventMessageName(aCompositionEvent->message), @@ -1045,7 +1045,7 @@ IMEStateManager::OnCompositionEventDiscarded( // a TextComposition instance for the composition was already removed from // the array and destroyed in OnDestroyPresContext(). Therefore, we may // fail to retrieve a TextComposition instance here. - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::OnCompositionEventDiscarded(), " "TextComposition instance for the widget has already gone")); return; @@ -1066,14 +1066,14 @@ IMEStateManager::NotifyIME(IMEMessage aMessage, bool isSynthesizedForTests = composition && composition->IsSynthesizedForTests(); - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::NotifyIME(aMessage=%s, aWidget=0x%p), " "composition=0x%p, composition->IsSynthesizedForTests()=%s", GetNotifyIMEMessageName(aMessage), aWidget, composition.get(), GetBoolName(isSynthesizedForTests))); if (NS_WARN_IF(!aWidget)) { - PR_LOG(sISMLog, PR_LOG_ERROR, + MOZ_LOG(sISMLog, LogLevel::Error, ("ISM: IMEStateManager::NotifyIME(), FAILED due to no widget")); return NS_ERROR_INVALID_ARG; } @@ -1101,7 +1101,7 @@ nsresult IMEStateManager::NotifyIME(IMEMessage aMessage, nsPresContext* aPresContext) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::NotifyIME(aMessage=%s, aPresContext=0x%p)", GetNotifyIMEMessageName(aMessage), aPresContext)); @@ -1109,7 +1109,7 @@ IMEStateManager::NotifyIME(IMEMessage aMessage, nsIWidget* widget = aPresContext->GetRootWidget(); if (NS_WARN_IF(!widget)) { - PR_LOG(sISMLog, PR_LOG_ERROR, + MOZ_LOG(sISMLog, LogLevel::Error, ("ISM: IMEStateManager::NotifyIME(), FAILED due to no widget for the " "nsPresContext")); return NS_ERROR_NOT_AVAILABLE; @@ -1176,18 +1176,18 @@ IMEStateManager::IsIMEObserverNeeded(const IMEState& aState) void IMEStateManager::DestroyIMEContentObserver() { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::DestroyIMEContentObserver(), " "sActiveIMEContentObserver=0x%p", sActiveIMEContentObserver)); if (!sActiveIMEContentObserver) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::DestroyIMEContentObserver() does nothing")); return; } - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::DestroyIMEContentObserver(), destroying " "the active IMEContentObserver...")); nsRefPtr tsm; @@ -1199,7 +1199,7 @@ IMEStateManager::DestroyIMEContentObserver() void IMEStateManager::CreateIMEContentObserver(nsIEditor* aEditor) { - PR_LOG(sISMLog, PR_LOG_ALWAYS, + MOZ_LOG(sISMLog, LogLevel::Info, ("ISM: IMEStateManager::CreateIMEContentObserver(aEditor=0x%p), " "sPresContext=0x%p, sContent=0x%p, sActiveIMEContentObserver=0x%p, " "sActiveIMEContentObserver->IsManaging(sPresContext, sContent)=%s", @@ -1208,7 +1208,7 @@ IMEStateManager::CreateIMEContentObserver(nsIEditor* aEditor) sActiveIMEContentObserver->IsManaging(sPresContext, sContent) : false))); if (NS_WARN_IF(sActiveIMEContentObserver)) { - PR_LOG(sISMLog, PR_LOG_ERROR, + MOZ_LOG(sISMLog, LogLevel::Error, ("ISM: IMEStateManager::CreateIMEContentObserver(), FAILED due to " "there is already an active IMEContentObserver")); MOZ_ASSERT(sActiveIMEContentObserver->IsManaging(sPresContext, sContent)); @@ -1217,7 +1217,7 @@ IMEStateManager::CreateIMEContentObserver(nsIEditor* aEditor) nsCOMPtr widget = sPresContext->GetRootWidget(); if (!widget) { - PR_LOG(sISMLog, PR_LOG_ERROR, + MOZ_LOG(sISMLog, LogLevel::Error, ("ISM: IMEStateManager::CreateIMEContentObserver(), FAILED due to " "there is a root widget for the nsPresContext")); return; // Sometimes, there are no widgets. @@ -1225,13 +1225,13 @@ IMEStateManager::CreateIMEContentObserver(nsIEditor* aEditor) // If it's not text editable, we don't need to create IMEContentObserver. if (!IsIMEObserverNeeded(widget->GetInputContext().mIMEState)) { - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::CreateIMEContentObserver() doesn't create " "IMEContentObserver because of non-editable IME state")); return; } - PR_LOG(sISMLog, PR_LOG_DEBUG, + MOZ_LOG(sISMLog, LogLevel::Debug, ("ISM: IMEStateManager::CreateIMEContentObserver() is creating an " "IMEContentObserver instance...")); sActiveIMEContentObserver = new IMEContentObserver(); diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index 15e2636185..0526c029d6 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -91,8 +91,8 @@ static PRLogModuleInfo* gMediaElementLog; static PRLogModuleInfo* gMediaElementEventsLog; -#define LOG(type, msg) PR_LOG(gMediaElementLog, type, msg) -#define LOG_EVENT(type, msg) PR_LOG(gMediaElementEventsLog, type, msg) +#define LOG(type, msg) MOZ_LOG(gMediaElementLog, type, msg) +#define LOG_EVENT(type, msg) MOZ_LOG(gMediaElementEventsLog, type, msg) #include "nsIContentSecurityPolicy.h" @@ -235,7 +235,7 @@ public: // Silently cancel if our load has been cancelled. if (IsCancelled()) return NS_OK; - LOG_EVENT(PR_LOG_DEBUG, ("%p Dispatching simple event source error", mElement.get())); + LOG_EVENT(LogLevel::Debug, ("%p Dispatching simple event source error", mElement.get())); return nsContentUtils::DispatchTrustedEvent(mElement->OwnerDoc(), mSource, NS_LITERAL_STRING("error"), @@ -855,7 +855,7 @@ void HTMLMediaElement::SelectResource() nsCOMPtr uri; nsresult rv = NewURIFromString(src, getter_AddRefs(uri)); if (NS_SUCCEEDED(rv)) { - LOG(PR_LOG_DEBUG, ("%p Trying load from src=%s", this, NS_ConvertUTF16toUTF8(src).get())); + LOG(LogLevel::Debug, ("%p Trying load from src=%s", this, NS_ConvertUTF16toUTF8(src).get())); NS_ASSERTION(!mIsLoadingFromSourceChildren, "Should think we're not loading from source children by default"); @@ -888,7 +888,7 @@ void HTMLMediaElement::SelectResource() void HTMLMediaElement::NotifyLoadError() { if (!mIsLoadingFromSourceChildren) { - LOG(PR_LOG_DEBUG, ("NotifyLoadError(), no supported media error")); + LOG(LogLevel::Debug, ("NotifyLoadError(), no supported media error")); NoSupportedMediaSourceError(); } else if (mSourceLoadCandidate) { DispatchAsyncSourceError(mSourceLoadCandidate); @@ -983,7 +983,7 @@ void HTMLMediaElement::LoadFromSourceChildren() ReportLoadError("MediaLoadSourceMediaNotMatched", params, ArrayLength(params)); continue; } - LOG(PR_LOG_DEBUG, ("%p Trying load from =%s type=%s media=%s", this, + LOG(LogLevel::Debug, ("%p Trying load from =%s type=%s media=%s", this, NS_ConvertUTF16toUTF8(src).get(), NS_ConvertUTF16toUTF8(type).get(), NS_ConvertUTF16toUTF8(media).get())); @@ -1447,7 +1447,7 @@ HTMLMediaElement::Seek(double aTime, if (mPlayed && mCurrentPlayRangeStart != -1.0) { double rangeEndTime = CurrentTime(); - LOG(PR_LOG_DEBUG, ("%p Adding \'played\' a range : [%f, %f]", this, mCurrentPlayRangeStart, rangeEndTime)); + LOG(LogLevel::Debug, ("%p Adding \'played\' a range : [%f, %f]", this, mCurrentPlayRangeStart, rangeEndTime)); // Multiple seek without playing, or seek while playing. if (mCurrentPlayRangeStart != rangeEndTime) { mPlayed->Add(mCurrentPlayRangeStart, rangeEndTime); @@ -1540,7 +1540,7 @@ HTMLMediaElement::Seek(double aTime, mPlayingBeforeSeek = IsPotentiallyPlaying(); // The media backend is responsible for dispatching the timeupdate // event if it changes the playback position as a result of the seek. - LOG(PR_LOG_DEBUG, ("%p SetCurrentTime(%f) starting seek", this, aTime)); + LOG(LogLevel::Debug, ("%p SetCurrentTime(%f) starting seek", this, aTime)); nsresult rv = mDecoder->Seek(aTime, aSeekType); if (NS_FAILED(rv)) { aRv.Throw(rv); @@ -1554,7 +1554,7 @@ NS_IMETHODIMP HTMLMediaElement::SetCurrentTime(double aCurrentTime) { // Detect for a NaN and invalid values. if (mozilla::IsNaN(aCurrentTime)) { - LOG(PR_LOG_DEBUG, ("%p SetCurrentTime(%f) failed: bad time", this, aCurrentTime)); + LOG(LogLevel::Debug, ("%p SetCurrentTime(%f) failed: bad time", this, aCurrentTime)); return NS_ERROR_FAILURE; } @@ -1658,7 +1658,7 @@ void HTMLMediaElement::Pause(ErrorResult& aRv) { if (mNetworkState == nsIDOMHTMLMediaElement::NETWORK_EMPTY) { - LOG(PR_LOG_DEBUG, ("Loading due to Pause()")); + LOG(LogLevel::Debug, ("Loading due to Pause()")); DoLoad(); } else if (mDecoder) { mDecoder->Pause(); @@ -2214,7 +2214,7 @@ HTMLMediaElement::PlayInternal(bool aCallerIsChrome) && !IsScriptedAutoplayEnabled() && !EventStateManager::IsHandlingUserInput() && !aCallerIsChrome) { - LOG(PR_LOG_DEBUG, ("%p Blocked attempt to autoplay media.", this)); + LOG(LogLevel::Debug, ("%p Blocked attempt to autoplay media.", this)); return NS_OK; } @@ -2236,7 +2236,7 @@ HTMLMediaElement::PlayInternal(bool aCallerIsChrome) if (Preferences::GetBool("media.block-play-until-visible", false) && !aCallerIsChrome && OwnerDoc()->Hidden()) { - LOG(PR_LOG_DEBUG, ("%p Blocked playback because owner hidden.", this)); + LOG(LogLevel::Debug, ("%p Blocked playback because owner hidden.", this)); mPlayBlockedBecauseHidden = true; return NS_OK; } @@ -2627,17 +2627,17 @@ HTMLMediaElement::ReportMSETelemetry() } Telemetry::Accumulate(Telemetry::VIDEO_MSE_UNLOAD_STATE, state); - LOG(PR_LOG_DEBUG, ("%p VIDEO_MSE_UNLOAD_STATE = %d", this, state)); + LOG(LogLevel::Debug, ("%p VIDEO_MSE_UNLOAD_STATE = %d", this, state)); Telemetry::Accumulate(Telemetry::VIDEO_MSE_PLAY_TIME_MS, SECONDS_TO_MS(mPlayTime.Total())); - LOG(PR_LOG_DEBUG, ("%p VIDEO_MSE_PLAY_TIME_MS = %f", this, mPlayTime.Total())); + LOG(LogLevel::Debug, ("%p VIDEO_MSE_PLAY_TIME_MS = %f", this, mPlayTime.Total())); Telemetry::Accumulate(Telemetry::VIDEO_MSE_BUFFERING_COUNT, mRebufferTime.Count()); - LOG(PR_LOG_DEBUG, ("%p VIDEO_MSE_BUFFERING_COUNT = %d", this, mRebufferTime.Count())); + LOG(LogLevel::Debug, ("%p VIDEO_MSE_BUFFERING_COUNT = %d", this, mRebufferTime.Count())); double latency = mJoinLatency.Count() ? mJoinLatency.Total() / mJoinLatency.Count() : 0.0; Telemetry::Accumulate(Telemetry::VIDEO_MSE_JOIN_LATENCY_MS, SECONDS_TO_MS(latency)); - LOG(PR_LOG_DEBUG, ("%p VIDEO_MSE_JOIN_LATENCY = %f (%d ms) count=%d\n", + LOG(LogLevel::Debug, ("%p VIDEO_MSE_JOIN_LATENCY = %f (%d ms) count=%d\n", this, latency, SECONDS_TO_MS(latency), mJoinLatency.Count())); } @@ -2693,7 +2693,7 @@ HTMLMediaElement::CanPlayType(const nsAString& aType, nsAString& aResult) break; } - LOG(PR_LOG_DEBUG, ("%p CanPlayType(%s) = \"%s\"", this, + LOG(LogLevel::Debug, ("%p CanPlayType(%s) = \"%s\"", this, NS_ConvertUTF16toUTF8(aType).get(), NS_ConvertUTF16toUTF8(aResult).get())); @@ -2712,10 +2712,10 @@ nsresult HTMLMediaElement::InitializeDecoderAsClone(MediaDecoder* aOriginal) if (!decoder) return NS_ERROR_FAILURE; - LOG(PR_LOG_DEBUG, ("%p Cloned decoder %p from %p", this, decoder.get(), aOriginal)); + LOG(LogLevel::Debug, ("%p Cloned decoder %p from %p", this, decoder.get(), aOriginal)); if (!decoder->Init(this)) { - LOG(PR_LOG_DEBUG, ("%p Failed to init cloned decoder %p", this, decoder.get())); + LOG(LogLevel::Debug, ("%p Failed to init cloned decoder %p", this, decoder.get())); return NS_ERROR_FAILURE; } @@ -2723,7 +2723,7 @@ nsresult HTMLMediaElement::InitializeDecoderAsClone(MediaDecoder* aOriginal) nsRefPtr resource = originalResource->CloneData(decoder); if (!resource) { - LOG(PR_LOG_DEBUG, ("%p Failed to cloned stream for decoder %p", this, decoder.get())); + LOG(LogLevel::Debug, ("%p Failed to cloned stream for decoder %p", this, decoder.get())); return NS_ERROR_FAILURE; } @@ -2751,7 +2751,7 @@ nsresult HTMLMediaElement::InitializeDecoderForChannel(nsIChannel* aChannel, return NS_ERROR_FAILURE; } - LOG(PR_LOG_DEBUG, ("%p Created decoder %p for type %s", this, decoder.get(), mimeType.get())); + LOG(LogLevel::Debug, ("%p Created decoder %p for type %s", this, decoder.get(), mimeType.get())); nsRefPtr resource = MediaResource::Create(decoder, aChannel); if (!resource) @@ -2811,7 +2811,7 @@ nsresult HTMLMediaElement::FinishDecoderSetup(MediaDecoder* aDecoder, nsresult rv = aDecoder->Load(aListener, aCloneDonor); if (NS_FAILED(rv)) { SetDecoder(nullptr); - LOG(PR_LOG_DEBUG, ("%p Failed to load for decoder %p", this, aDecoder)); + LOG(LogLevel::Debug, ("%p Failed to load for decoder %p", this, aDecoder)); return rv; } @@ -3339,7 +3339,7 @@ void HTMLMediaElement::PlaybackEnded() } if (mSrcStream || (mDecoder && mDecoder->IsInfinite())) { - LOG(PR_LOG_DEBUG, ("%p, got duration by reaching the end of the resource", this)); + LOG(LogLevel::Debug, ("%p, got duration by reaching the end of the resource", this)); DispatchAsyncEvent(NS_LITERAL_STRING("durationchange")); } @@ -3641,7 +3641,7 @@ void HTMLMediaElement::ChangeReadyState(nsMediaReadyState aState) return; } - LOG(PR_LOG_DEBUG, ("%p Ready state changed to %s", this, gReadyStateToString[aState])); + LOG(LogLevel::Debug, ("%p Ready state changed to %s", this, gReadyStateToString[aState])); UpdateAudioChannelPlayingState(); @@ -3696,7 +3696,7 @@ void HTMLMediaElement::ChangeNetworkState(nsMediaNetworkState aState) nsMediaNetworkState oldState = mNetworkState; mNetworkState = aState; - LOG(PR_LOG_DEBUG, ("%p Network state changed to %s", this, gNetworkStateToString[aState])); + LOG(LogLevel::Debug, ("%p Network state changed to %s", this, gNetworkStateToString[aState])); // TODO: |mBegun| reflects the download status. We should be able to remove // it and check |mNetworkState| only. @@ -3747,7 +3747,7 @@ void HTMLMediaElement::CheckAutoplayDataReady() if (Preferences::GetBool("media.block-play-until-visible", false) && OwnerDoc()->Hidden()) { - LOG(PR_LOG_DEBUG, ("%p Blocked autoplay because owner hidden.", this)); + LOG(LogLevel::Debug, ("%p Blocked autoplay because owner hidden.", this)); mPlayBlockedBecauseHidden = true; return; } @@ -3819,7 +3819,7 @@ VideoFrameContainer* HTMLMediaElement::GetOverlayImageVideoFrameContainer() nsresult HTMLMediaElement::DispatchEvent(const nsAString& aName) { - LOG_EVENT(PR_LOG_DEBUG, ("%p Dispatching event %s", this, + LOG_EVENT(LogLevel::Debug, ("%p Dispatching event %s", this, NS_ConvertUTF16toUTF8(aName).get())); // Save events that occur while in the bfcache. These will be dispatched @@ -3838,7 +3838,7 @@ nsresult HTMLMediaElement::DispatchEvent(const nsAString& aName) nsresult HTMLMediaElement::DispatchAsyncEvent(const nsAString& aName) { - LOG_EVENT(PR_LOG_DEBUG, ("%p Queuing event %s", this, + LOG_EVENT(LogLevel::Debug, ("%p Queuing event %s", this, NS_ConvertUTF16toUTF8(aName).get())); // Save events that occur while in the bfcache. These will be dispatched @@ -3950,7 +3950,7 @@ void HTMLMediaElement::UpdateInitialMediaSize(const nsIntSize& aSize) void HTMLMediaElement::SuspendOrResumeElement(bool aPauseElement, bool aSuspendEvents) { - LOG(PR_LOG_DEBUG, ("%p SuspendOrResumeElement(pause=%d, suspendEvents=%d) hidden=%d", + LOG(LogLevel::Debug, ("%p SuspendOrResumeElement(pause=%d, suspendEvents=%d) hidden=%d", this, aPauseElement, aSuspendEvents, OwnerDoc()->Hidden())); if (aPauseElement != mPausedForInactiveDocumentOrChannel) { @@ -4017,7 +4017,7 @@ void HTMLMediaElement::NotifyOwnerDocumentActivityChanged() if (!mPausedForInactiveDocumentOrChannel && mPlayBlockedBecauseHidden && !OwnerDoc()->Hidden()) { - LOG(PR_LOG_DEBUG, ("%p Resuming playback now that owner doc is visble.", this)); + LOG(LogLevel::Debug, ("%p Resuming playback now that owner doc is visble.", this)); mPlayBlockedBecauseHidden = false; Play(); } @@ -4092,7 +4092,7 @@ HTMLMediaElement::IsNodeOfType(uint32_t aFlags) const void HTMLMediaElement::DispatchAsyncSourceError(nsIContent* aSourceElement) { - LOG_EVENT(PR_LOG_DEBUG, ("%p Queuing simple source error event", this)); + LOG_EVENT(LogLevel::Debug, ("%p Queuing simple source error event", this)); nsCOMPtr event = new nsSourceErrorEventRunner(this, aSourceElement); NS_DispatchToMainThread(event); @@ -4180,7 +4180,7 @@ void HTMLMediaElement::ChangeDelayLoadStatus(bool aDelay) mDelayingLoadEvent = aDelay; - LOG(PR_LOG_DEBUG, ("%p ChangeDelayLoadStatus(%d) doc=0x%p", this, aDelay, mLoadBlockedDoc.get())); + LOG(LogLevel::Debug, ("%p ChangeDelayLoadStatus(%d) doc=0x%p", this, aDelay, mLoadBlockedDoc.get())); if (mDecoder) { mDecoder->SetLoadInBackground(!aDelay); } diff --git a/dom/html/HTMLTrackElement.cpp b/dom/html/HTMLTrackElement.cpp index 983b872bf8..b9d24d50c4 100644 --- a/dom/html/HTMLTrackElement.cpp +++ b/dom/html/HTMLTrackElement.cpp @@ -41,7 +41,7 @@ #include "nsVideoFrame.h" static PRLogModuleInfo* gTrackElementLog; -#define LOG(type, msg) PR_LOG(gTrackElementLog, type, msg) +#define LOG(type, msg) MOZ_LOG(gTrackElementLog, type, msg) // Replace the usual NS_IMPL_NS_NEW_HTML_ELEMENT(Track) so // we can return an UnknownElement instead when pref'd off. @@ -195,7 +195,7 @@ HTMLTrackElement::LoadResource() nsCOMPtr uri; nsresult rv = NewURIFromString(src, getter_AddRefs(uri)); NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv)); - LOG(PR_LOG_ALWAYS, ("%p Trying to load from src=%s", this, + LOG(LogLevel::Info, ("%p Trying to load from src=%s", this, NS_ConvertUTF16toUTF8(src).get())); if (mChannel) { @@ -246,7 +246,7 @@ HTMLTrackElement::LoadResource() NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv)); channel->SetNotificationCallbacks(mListener); - LOG(PR_LOG_DEBUG, ("opening webvtt channel")); + LOG(LogLevel::Debug, ("opening webvtt channel")); rv = channel->AsyncOpen(mListener, nullptr); NS_ENSURE_TRUE_VOID(NS_SUCCEEDED(rv)); @@ -269,7 +269,7 @@ HTMLTrackElement::BindToTree(nsIDocument* aDocument, return NS_OK; } - LOG(PR_LOG_DEBUG, ("Track Element bound to tree.")); + LOG(LogLevel::Debug, ("Track Element bound to tree.")); if (!aParent || !aParent->IsNodeOfType(nsINode::eMEDIA)) { return NS_OK; } @@ -281,7 +281,7 @@ HTMLTrackElement::BindToTree(nsIDocument* aDocument, HTMLMediaElement* media = static_cast(aParent); // TODO: separate notification for 'alternate' tracks? media->NotifyAddedSource(); - LOG(PR_LOG_DEBUG, ("Track element sent notification to parent.")); + LOG(LogLevel::Debug, ("Track element sent notification to parent.")); mMediaParent->RunInStableState( NS_NewRunnableMethod(this, &HTMLTrackElement::LoadResource)); diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 340559af45..6817aabf1f 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -102,8 +102,8 @@ #endif #define IDB_DEBUG_LOG(_args) \ - PR_LOG(IndexedDatabaseManager::GetLoggingModule(), \ - PR_LOG_DEBUG, \ + MOZ_LOG(IndexedDatabaseManager::GetLoggingModule(), \ + LogLevel::Debug, \ _args ) #if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK) diff --git a/dom/indexedDB/ProfilerHelpers.h b/dom/indexedDB/ProfilerHelpers.h index 2d3441822e..70a720c02f 100644 --- a/dom/indexedDB/ProfilerHelpers.h +++ b/dom/indexedDB/ProfilerHelpers.h @@ -282,9 +282,9 @@ LoggingHelper(bool aUseProfiler, const char* aFmt, ...) PRLogModuleInfo* logModule = IndexedDatabaseManager::GetLoggingModule(); MOZ_ASSERT(logModule); - static const PRLogModuleLevel logLevel = PR_LOG_WARNING; + static const mozilla::LogLevel logLevel = LogLevel::Warning; - if (PR_LOG_TEST(logModule, logLevel) || + if (MOZ_LOG_TEST(logModule, logLevel) || (aUseProfiler && profiler_is_active())) { nsAutoCString message; @@ -297,7 +297,7 @@ LoggingHelper(bool aUseProfiler, const char* aFmt, ...) va_end(args); } - PR_LOG(logModule, logLevel, ("%s", message.get())); + MOZ_LOG(logModule, logLevel, ("%s", message.get())); if (aUseProfiler) { PROFILER_MARKER(message.get()); diff --git a/dom/ipc/ProcessPriorityManager.cpp b/dom/ipc/ProcessPriorityManager.cpp index 42833d4316..a1d8935b16 100644 --- a/dom/ipc/ProcessPriorityManager.cpp +++ b/dom/ipc/ProcessPriorityManager.cpp @@ -78,10 +78,10 @@ return sLog; } # define LOG(fmt, ...) \ - PR_LOG(GetPPMLog(), PR_LOG_DEBUG, \ + MOZ_LOG(GetPPMLog(), LogLevel::Debug, \ ("ProcessPriorityManager - " fmt, ##__VA_ARGS__)) # define LOGP(fmt, ...) \ - PR_LOG(GetPPMLog(), PR_LOG_DEBUG, \ + MOZ_LOG(GetPPMLog(), LogLevel::Debug, \ ("ProcessPriorityManager[%schild-id=%" PRIu64 ", pid=%d] - " fmt, \ NameWithComma().get(), \ static_cast(ChildID()), Pid(), ##__VA_ARGS__)) diff --git a/dom/media/AudioSink.cpp b/dom/media/AudioSink.cpp index 6302601f6c..34ba2e1036 100644 --- a/dom/media/AudioSink.cpp +++ b/dom/media/AudioSink.cpp @@ -12,9 +12,9 @@ namespace mozilla { extern PRLogModuleInfo* gMediaDecoderLog; #define SINK_LOG(msg, ...) \ - PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("AudioSink=%p " msg, this, ##__VA_ARGS__)) + MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("AudioSink=%p " msg, this, ##__VA_ARGS__)) #define SINK_LOG_V(msg, ...) \ - PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG+1, ("AudioSink=%p " msg, this, ##__VA_ARGS__)) + MOZ_LOG(gMediaDecoderLog, LogLevel::Verbose, ("AudioSink=%p " msg, this, ##__VA_ARGS__)) AudioSink::OnAudioEndTimeUpdateTask::OnAudioEndTimeUpdateTask( MediaDecoderStateMachine* aStateMachine) diff --git a/dom/media/AudioStream.cpp b/dom/media/AudioStream.cpp index 6ab9ab5baf..9cc18cc97c 100644 --- a/dom/media/AudioStream.cpp +++ b/dom/media/AudioStream.cpp @@ -30,7 +30,7 @@ namespace mozilla { PRLogModuleInfo* gAudioStreamLog = nullptr; // For simple logs -#define LOG(x) PR_LOG(gAudioStreamLog, PR_LOG_DEBUG, x) +#define LOG(x) MOZ_LOG(gAudioStreamLog, mozilla::LogLevel::Debug, x) /** * When MOZ_DUMP_AUDIO is set in the environment (to anything), @@ -329,7 +329,7 @@ AudioStream::Init(int32_t aNumChannels, int32_t aRate, return NS_ERROR_FAILURE; } - PR_LOG(gAudioStreamLog, PR_LOG_DEBUG, + MOZ_LOG(gAudioStreamLog, LogLevel::Debug, ("%s channels: %d, rate: %d for %p", __FUNCTION__, aNumChannels, aRate, this)); mInRate = mOutRate = aRate; mChannels = aNumChannels; @@ -544,12 +544,12 @@ AudioStream::CheckForStart() if (mLatencyRequest == LowLatency || mNeedsStart) { StartUnlocked(); // mState = STARTED or ERRORED mNeedsStart = false; - PR_LOG(gAudioStreamLog, PR_LOG_WARNING, + MOZ_LOG(gAudioStreamLog, LogLevel::Warning, ("Started waiting %s-latency stream", mLatencyRequest == LowLatency ? "low" : "high")); } else { // high latency, not full - OR Pause() was called before we got here - PR_LOG(gAudioStreamLog, PR_LOG_DEBUG, + MOZ_LOG(gAudioStreamLog, LogLevel::Debug, ("Not starting waiting %s-latency stream", mLatencyRequest == LowLatency ? "low" : "high")); } @@ -609,7 +609,7 @@ AudioStream::Write(const AudioDataValue* aBuf, uint32_t aFrames, TimeStamp *aTim uint32_t bytesToCopy = FramesToBytes(aFrames); // XXX this will need to change if we want to enable this on-the-fly! - if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) { // Record the position and time this data was inserted int64_t timeMs; if (aTime && !aTime->IsNull()) { @@ -642,7 +642,7 @@ AudioStream::Write(const AudioDataValue* aBuf, uint32_t aFrames, TimeStamp *aTim remains = mBuffer.Length() - bytesToCopy; // Free up just enough space } // account for dropping samples - PR_LOG(gAudioStreamLog, PR_LOG_WARNING, ("Stream %p dropping %u bytes (%u frames)in Write()", + MOZ_LOG(gAudioStreamLog, LogLevel::Warning, ("Stream %p dropping %u bytes (%u frames)in Write()", this, mBuffer.Length() - remains, BytesToFrames(mBuffer.Length() - remains))); mReadPoint += BytesToFrames(mBuffer.Length() - remains); mBuffer.ContractTo(remains); @@ -650,14 +650,14 @@ AudioStream::Write(const AudioDataValue* aBuf, uint32_t aFrames, TimeStamp *aTim // If we are not playing, but our buffer is full, start playing to make // room for soon-to-be-decoded data. if (mState != STARTED && mState != RUNNING) { - PR_LOG(gAudioStreamLog, PR_LOG_WARNING, ("Starting stream %p in Write (%u waiting)", + MOZ_LOG(gAudioStreamLog, LogLevel::Warning, ("Starting stream %p in Write (%u waiting)", this, bytesToCopy)); StartUnlocked(); if (mState == ERRORED) { return NS_ERROR_FAILURE; } } - PR_LOG(gAudioStreamLog, PR_LOG_WARNING, ("Stream %p waiting in Write() (%u waiting)", + MOZ_LOG(gAudioStreamLog, LogLevel::Warning, ("Stream %p waiting in Write() (%u waiting)", this, bytesToCopy)); mon.Wait(); } @@ -1070,16 +1070,16 @@ AudioStream::DataCallback(void* aBuffer, long aFrames) TimeStamp now = TimeStamp::Now(); if (!mStartTime.IsNull()) { int64_t timeMs = (now - mStartTime).ToMilliseconds(); - PR_LOG(gAudioStreamLog, PR_LOG_WARNING, + MOZ_LOG(gAudioStreamLog, LogLevel::Warning, ("Stream took %lldms to start after first Write() @ %u", timeMs, mOutRate)); } else { - PR_LOG(gAudioStreamLog, PR_LOG_WARNING, + MOZ_LOG(gAudioStreamLog, LogLevel::Warning, ("Stream started before Write() @ %u", mOutRate)); } if (old_len != available) { // Note that we may have dropped samples in Write() as well! - PR_LOG(gAudioStreamLog, PR_LOG_WARNING, + MOZ_LOG(gAudioStreamLog, LogLevel::Warning, ("AudioStream %p dropped %u + %u initial frames @ %u", this, mReadPoint, BytesToFrames(old_len - available), mOutRate)); mReadPoint += BytesToFrames(old_len - available); @@ -1120,7 +1120,7 @@ AudioStream::DataCallback(void* aBuffer, long aFrames) uint8_t* rpos = static_cast(aBuffer) + FramesToBytes(aFrames - underrunFrames); memset(rpos, 0, FramesToBytes(underrunFrames)); if (underrunFrames) { - PR_LOG(gAudioStreamLog, PR_LOG_WARNING, + MOZ_LOG(gAudioStreamLog, LogLevel::Warning, ("AudioStream %p lost %d frames", this, underrunFrames)); } servicedFrames += underrunFrames; @@ -1130,7 +1130,7 @@ AudioStream::DataCallback(void* aBuffer, long aFrames) WriteDumpFile(mDumpFile, this, aFrames, aBuffer); // Don't log if we're not interested or if the stream is inactive - if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG) && + if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug) && mState != SHUTDOWN && insertTime != INT64_MAX && servicedFrames > underrunFrames) { uint32_t latency = UINT32_MAX; diff --git a/dom/media/GraphDriver.cpp b/dom/media/GraphDriver.cpp index 5de92b5f5d..6be6be828e 100644 --- a/dom/media/GraphDriver.cpp +++ b/dom/media/GraphDriver.cpp @@ -11,7 +11,7 @@ #endif extern PRLogModuleInfo* gMediaStreamGraphLog; -#define STREAM_LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg) +#define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg) // We don't use NSPR log here because we want this interleaved with adb logcat // on Android/B2G @@ -69,7 +69,7 @@ void GraphDriver::SetGraphTime(GraphDriver* aPreviousDriver, mStateComputedTime = aLastSwitchStateComputedTime; mNextStateComputedTime = aLastSwitchNextStateComputedTime; - STREAM_LOG(PR_LOG_DEBUG, ("Setting previous driver: %p (%s)", aPreviousDriver, aPreviousDriver->AsAudioCallbackDriver() ? "AudioCallbackDriver" : "SystemClockDriver")); + STREAM_LOG(LogLevel::Debug, ("Setting previous driver: %p (%s)", aPreviousDriver, aPreviousDriver->AsAudioCallbackDriver() ? "AudioCallbackDriver" : "SystemClockDriver")); MOZ_ASSERT(!mPreviousDriver); mPreviousDriver = aPreviousDriver; } @@ -182,7 +182,7 @@ public: NS_IMETHOD Run() { char aLocal; - STREAM_LOG(PR_LOG_DEBUG, ("Starting system thread")); + STREAM_LOG(LogLevel::Debug, ("Starting system thread")); profiler_register_thread("MediaStreamGraph", &aLocal); LIFECYCLE_LOG("Starting a new system driver for graph %p\n", mDriver->mGraphImpl); @@ -236,7 +236,7 @@ ThreadedDriver::Revive() { // Note: only called on MainThread, without monitor // We know were weren't in a running state - STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver reviving.")); + STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver reviving.")); // If we were switching, switch now. Otherwise, tell thread to run the main // loop again. MonitorAutoLock mon(mGraphImpl->GetMonitor()); @@ -256,7 +256,7 @@ ThreadedDriver::Stop() { NS_ASSERTION(NS_IsMainThread(), "Must be called on main thread"); // mGraph's thread is not running so it's OK to do whatever here - STREAM_LOG(PR_LOG_DEBUG, ("Stopping threads for MediaStreamGraph %p", this)); + STREAM_LOG(LogLevel::Debug, ("Stopping threads for MediaStreamGraph %p", this)); if (mThread) { mThread->Shutdown(); @@ -287,7 +287,7 @@ ThreadedDriver::RunThread() mNextStateComputedTime = mGraphImpl->RoundUpToNextAudioBlock( nextCurrentTime + mGraphImpl->MillisecondsToMediaTime(AUDIO_TARGET_MS)); - STREAM_LOG(PR_LOG_DEBUG, + STREAM_LOG(LogLevel::Debug, ("interval[%ld; %ld] state[%ld; %ld]", (long)mIterationStart, (long)mIterationEnd, (long)mStateComputedTime, (long)mNextStateComputedTime)); @@ -300,7 +300,7 @@ ThreadedDriver::RunThread() mNextStateComputedTime); if (mNextDriver && stillProcessing) { - STREAM_LOG(PR_LOG_DEBUG, ("Switching to AudioCallbackDriver")); + STREAM_LOG(LogLevel::Debug, ("Switching to AudioCallbackDriver")); mNextDriver->SetGraphTime(this, mIterationStart, mIterationEnd, mStateComputedTime, mNextStateComputedTime); mGraphImpl->SetCurrentDriver(mNextDriver); @@ -319,20 +319,20 @@ SystemClockDriver::GetIntervalForIteration(GraphTime& aFrom, GraphTime& aTo) mCurrentTimeStamp = now; - PR_LOG(gMediaStreamGraphLog, PR_LOG_DEBUG+1, ("Updating current time to %f (real %f, mStateComputedTime %f)", + MOZ_LOG(gMediaStreamGraphLog, LogLevel::Verbose, ("Updating current time to %f (real %f, mStateComputedTime %f)", mGraphImpl->MediaTimeToSeconds(aTo), (now - mInitialTimeStamp).ToSeconds(), mGraphImpl->MediaTimeToSeconds(StateComputedTime()))); if (mStateComputedTime < aTo) { - STREAM_LOG(PR_LOG_WARNING, ("Media graph global underrun detected")); + STREAM_LOG(LogLevel::Warning, ("Media graph global underrun detected")); aTo = mIterationEnd = mStateComputedTime; } if (aFrom >= aTo) { NS_ASSERTION(aFrom == aTo , "Time can't go backwards!"); // This could happen due to low clock resolution, maybe? - STREAM_LOG(PR_LOG_DEBUG, ("Time did not advance")); + STREAM_LOG(LogLevel::Debug, ("Time did not advance")); } } @@ -363,7 +363,7 @@ SystemClockDriver::WaitForNextIteration() // least once a minute, if we need to wake up at all timeoutMS = std::max(0, std::min(timeoutMS, 60*1000)); timeout = PR_MillisecondsToInterval(uint32_t(timeoutMS)); - STREAM_LOG(PR_LOG_DEBUG+1, ("Waiting for next iteration; at %f, timeout=%f", (now - mInitialTimeStamp).ToSeconds(), timeoutMS/1000.0)); + STREAM_LOG(LogLevel::Verbose, ("Waiting for next iteration; at %f, timeout=%f", (now - mInitialTimeStamp).ToSeconds(), timeoutMS/1000.0)); if (mWaitState == WAITSTATE_WAITING_INDEFINITELY) { mGraphImpl->mGraphDriverAsleep = false; // atomic } @@ -374,7 +374,7 @@ SystemClockDriver::WaitForNextIteration() } if (timeout > 0) { mGraphImpl->GetMonitor().Wait(timeout); - STREAM_LOG(PR_LOG_DEBUG+1, ("Resuming after timeout; at %f, elapsed=%f", + STREAM_LOG(LogLevel::Verbose, ("Resuming after timeout; at %f, elapsed=%f", (TimeStamp::Now() - mInitialTimeStamp).ToSeconds(), (TimeStamp::Now() - now).ToSeconds())); } @@ -439,14 +439,14 @@ OfflineClockDriver::GetIntervalForIteration(GraphTime& aFrom, GraphTime& aTo) aTo = mIterationEnd = IterationEnd() + mGraphImpl->MillisecondsToMediaTime(mSlice); if (mStateComputedTime < aTo) { - STREAM_LOG(PR_LOG_WARNING, ("Media graph global underrun detected")); + STREAM_LOG(LogLevel::Warning, ("Media graph global underrun detected")); aTo = mIterationEnd = mStateComputedTime; } if (aFrom >= aTo) { NS_ASSERTION(aFrom == aTo , "Time can't go backwards!"); // This could happen due to low clock resolution, maybe? - STREAM_LOG(PR_LOG_DEBUG, ("Time did not advance")); + STREAM_LOG(LogLevel::Debug, ("Time did not advance")); } } @@ -545,7 +545,7 @@ AudioCallbackDriver::AudioCallbackDriver(MediaStreamGraphImpl* aGraphImpl, dom:: , mCallbackReceivedWhileSwitching(0) #endif { - STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver ctor for graph %p", aGraphImpl)); + STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver ctor for graph %p", aGraphImpl)); } AudioCallbackDriver::~AudioCallbackDriver() @@ -613,21 +613,21 @@ AudioCallbackDriver::Init() StartStream(); - STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver started.")); + STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver started.")); } void AudioCallbackDriver::Destroy() { - STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver destroyed.")); + STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver destroyed.")); mAudioStream.reset(); } void AudioCallbackDriver::Resume() { - STREAM_LOG(PR_LOG_DEBUG, ("Resuming audio threads for MediaStreamGraph %p", mGraphImpl)); + STREAM_LOG(LogLevel::Debug, ("Resuming audio threads for MediaStreamGraph %p", mGraphImpl)); if (cubeb_stream_start(mAudioStream) != CUBEB_OK) { NS_WARNING("Could not start cubeb stream for MSG."); } @@ -639,12 +639,12 @@ AudioCallbackDriver::Start() // If this is running on the main thread, we can't open the stream directly, // because it is a blocking operation. if (NS_IsMainThread()) { - STREAM_LOG(PR_LOG_DEBUG, ("Starting audio threads for MediaStreamGraph %p from a new thread.", mGraphImpl)); + STREAM_LOG(LogLevel::Debug, ("Starting audio threads for MediaStreamGraph %p from a new thread.", mGraphImpl)); nsRefPtr initEvent = new AsyncCubebTask(this, AsyncCubebOperation::INIT); initEvent->Dispatch(); } else { - STREAM_LOG(PR_LOG_DEBUG, ("Starting audio threads for MediaStreamGraph %p from the previous driver's thread", mGraphImpl)); + STREAM_LOG(LogLevel::Debug, ("Starting audio threads for MediaStreamGraph %p from the previous driver's thread", mGraphImpl)); Init(); // Check if we need to resolve promises because the driver just got switched @@ -689,7 +689,7 @@ AudioCallbackDriver::Revive() { // Note: only called on MainThread, without monitor // We know were weren't in a running state - STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver reviving.")); + STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver reviving.")); // If we were switching, switch now. Otherwise, start the audio thread again. MonitorAutoLock mon(mGraphImpl->GetMonitor()); if (mNextDriver) { @@ -698,7 +698,7 @@ AudioCallbackDriver::Revive() mGraphImpl->SetCurrentDriver(mNextDriver); mNextDriver->Start(); } else { - STREAM_LOG(PR_LOG_DEBUG, ("Starting audio threads for MediaStreamGraph %p from a new thread.", mGraphImpl)); + STREAM_LOG(LogLevel::Debug, ("Starting audio threads for MediaStreamGraph %p from a new thread.", mGraphImpl)); nsRefPtr initEvent = new AsyncCubebTask(this, AsyncCubebOperation::INIT); initEvent->Dispatch(); @@ -782,9 +782,9 @@ AudioCallbackDriver::OSXDeviceSwitchingWorkaround() // callback is called "some" number of times, and then stops being called, // and then gets called again. 10 is to be safe, it's a low-enough number // of milliseconds anyways (< 100ms) - //STREAM_LOG(PR_LOG_DEBUG, ("Callbacks during switch: %d", mCallbackReceivedWhileSwitching+1)); + //STREAM_LOG(LogLevel::Debug, ("Callbacks during switch: %d", mCallbackReceivedWhileSwitching+1)); if (mCallbackReceivedWhileSwitching++ >= 10) { - STREAM_LOG(PR_LOG_DEBUG, ("Got %d callbacks, switching back to CallbackDriver", mCallbackReceivedWhileSwitching)); + STREAM_LOG(LogLevel::Debug, ("Got %d callbacks, switching back to CallbackDriver", mCallbackReceivedWhileSwitching)); // If we have a self reference, we have fallen back temporarily on a // system clock driver, but we just got called back, that means the osx // audio backend has switched to the new device. @@ -883,7 +883,7 @@ AudioCallbackDriver::DataCallback(AudioDataValue* aBuffer, long aFrames) // reclock the current time against the state time, here. mIterationEnd = mIterationStart + 0.8 * inGraph; - STREAM_LOG(PR_LOG_DEBUG, ("interval[%ld; %ld] state[%ld; %ld] (frames: %ld) (durationMS: %u) (duration ticks: %ld)\n", + STREAM_LOG(LogLevel::Debug, ("interval[%ld; %ld] state[%ld; %ld] (frames: %ld) (durationMS: %u) (duration ticks: %ld)\n", (long)mIterationStart, (long)mIterationEnd, (long)mStateComputedTime, (long)mNextStateComputedTime, (long)aFrames, (uint32_t)durationMS, @@ -892,7 +892,7 @@ AudioCallbackDriver::DataCallback(AudioDataValue* aBuffer, long aFrames) mCurrentTimeStamp = TimeStamp::Now(); if (mStateComputedTime < mIterationEnd) { - STREAM_LOG(PR_LOG_WARNING, ("Media graph global underrun detected")); + STREAM_LOG(LogLevel::Warning, ("Media graph global underrun detected")); mIterationEnd = mStateComputedTime; } @@ -916,7 +916,7 @@ AudioCallbackDriver::DataCallback(AudioDataValue* aBuffer, long aFrames) return aFrames; } } - STREAM_LOG(PR_LOG_DEBUG, ("Switching to system driver.")); + STREAM_LOG(LogLevel::Debug, ("Switching to system driver.")); mNextDriver->SetGraphTime(this, mIterationStart, mIterationEnd, mStateComputedTime, mNextStateComputedTime); mGraphImpl->SetCurrentDriver(mNextDriver); @@ -936,7 +936,7 @@ AudioCallbackDriver::DataCallback(AudioDataValue* aBuffer, long aFrames) void AudioCallbackDriver::StateCallback(cubeb_state aState) { - STREAM_LOG(PR_LOG_DEBUG, ("AudioCallbackDriver State: %d", aState)); + STREAM_LOG(LogLevel::Debug, ("AudioCallbackDriver State: %d", aState)); } void @@ -1020,7 +1020,7 @@ AudioCallbackDriver::DeviceChangedCallback() { if (mSelfReference) { return; } - STREAM_LOG(PR_LOG_ERROR, ("Switching to SystemClockDriver during output switch")); + STREAM_LOG(LogLevel::Error, ("Switching to SystemClockDriver during output switch")); mSelfReference.Take(this); mCallbackReceivedWhileSwitching = 0; mGraphImpl->mFlushSourcesOnNextIteration = true; diff --git a/dom/media/Latency.cpp b/dom/media/Latency.cpp index 94367a5d7e..870bc99c98 100644 --- a/dom/media/Latency.cpp +++ b/dom/media/Latency.cpp @@ -191,11 +191,11 @@ void AsyncLatencyLogger::WriteLog(LatencyLogIndex aIndex, uint64_t aID, int64_t TimeStamp aTimeStamp) { if (aTimeStamp.IsNull()) { - PR_LOG(GetLatencyLog(), PR_LOG_DEBUG, + MOZ_LOG(GetLatencyLog(), LogLevel::Debug, ("Latency: %s,%llu,%lld,%lld", LatencyLogIndex2Strings[aIndex], aID, GetTimeStamp(), aValue)); } else { - PR_LOG(GetLatencyLog(), PR_LOG_DEBUG, + MOZ_LOG(GetLatencyLog(), LogLevel::Debug, ("Latency: %s,%llu,%lld,%lld,%lld", LatencyLogIndex2Strings[aIndex], aID, GetTimeStamp(), aValue, static_cast((aTimeStamp - gAsyncLogger->mStart).ToMilliseconds()))); @@ -216,7 +216,7 @@ void AsyncLatencyLogger::Log(LatencyLogIndex aIndex, uint64_t aID, int64_t aValu void AsyncLatencyLogger::Log(LatencyLogIndex aIndex, uint64_t aID, int64_t aValue, TimeStamp &aTime) { - if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) { nsCOMPtr event = new LogEvent(aIndex, aID, aValue, aTime); if (mThread) { mThread->Dispatch(event, NS_DISPATCH_NORMAL); diff --git a/dom/media/MediaCache.cpp b/dom/media/MediaCache.cpp index 5b430ad261..7c4207a344 100644 --- a/dom/media/MediaCache.cpp +++ b/dom/media/MediaCache.cpp @@ -25,7 +25,7 @@ namespace mozilla { PRLogModuleInfo* gMediaCacheLog; -#define CACHE_LOG(type, msg) PR_LOG(gMediaCacheLog, type, msg) +#define CACHE_LOG(type, msg) MOZ_LOG(gMediaCacheLog, type, msg) // Readahead blocks for non-seekable streams will be limited to this // fraction of the cache space. We don't normally evict such blocks @@ -955,7 +955,7 @@ MediaCache::FreeBlock(int32_t aBlock) return; } - CACHE_LOG(PR_LOG_DEBUG, ("Released block %d", aBlock)); + CACHE_LOG(LogLevel::Debug, ("Released block %d", aBlock)); for (uint32_t i = 0; i < block->mOwners.Length(); ++i) { BlockOwner* bo = &block->mOwners[i]; @@ -1121,17 +1121,17 @@ MediaCache::Update() if (NS_SUCCEEDED(rv)) { // We successfully copied the file data. - CACHE_LOG(PR_LOG_DEBUG, ("Swapping blocks %d and %d (trimming cache)", + CACHE_LOG(LogLevel::Debug, ("Swapping blocks %d and %d (trimming cache)", blockIndex, destinationBlockIndex)); // Swapping the block metadata here lets us maintain the // correct positions in the linked lists SwapBlocks(blockIndex, destinationBlockIndex); //Free the overflowing block even if the copy failed. - CACHE_LOG(PR_LOG_DEBUG, ("Released block %d (trimming cache)", blockIndex)); + CACHE_LOG(LogLevel::Debug, ("Released block %d (trimming cache)", blockIndex)); FreeBlock(blockIndex); } } else { - CACHE_LOG(PR_LOG_DEBUG, ("Could not trim cache block %d (destination %d, predicted next use %f, latest predicted use for overflow %f", + CACHE_LOG(LogLevel::Debug, ("Could not trim cache block %d (destination %d, predicted next use %f, latest predicted use for overflow %f", blockIndex, destinationBlockIndex, PredictNextUse(now, destinationBlockIndex).ToSeconds(), latestPredictedUseForOverflow.ToSeconds())); @@ -1169,7 +1169,7 @@ MediaCache::Update() MediaCacheStream* stream = mStreams[i]; if (stream->mClosed) { - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p closed", stream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p closed", stream)); continue; } @@ -1220,29 +1220,29 @@ MediaCache::Update() // advertised with Content-Length, and we may as well keep reading. // But we don't want to seek to the end of the stream if we're not // already there. - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p at end of stream", stream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p at end of stream", stream)); enableReading = !stream->mCacheSuspended && stream->mStreamLength == stream->mChannelOffset; } else if (desiredOffset < stream->mStreamOffset) { // We're reading to try to catch up to where the current stream // reader wants to be. Better not stop. - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p catching up", stream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p catching up", stream)); enableReading = true; } else if (desiredOffset < stream->mStreamOffset + BLOCK_SIZE) { // The stream reader is waiting for us, or nearly so. Better feed it. - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p feeding reader", stream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p feeding reader", stream)); enableReading = true; } else if (!stream->mIsTransportSeekable && nonSeekableReadaheadBlockCount >= maxBlocks*NONSEEKABLE_READAHEAD_MAX) { // This stream is not seekable and there are already too many blocks // being cached for readahead for nonseekable streams (which we can't // free). So stop reading ahead now. - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p throttling non-seekable readahead", stream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p throttling non-seekable readahead", stream)); enableReading = false; } else if (mIndex.Length() > uint32_t(maxBlocks)) { // We're in the process of bringing the cache size back to the // desired limit, so don't bring in more data yet - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p throttling to reduce cache size", stream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p throttling to reduce cache size", stream)); enableReading = false; } else { TimeDuration predictedNewDataUse = PredictNextUseForIncomingData(stream); @@ -1250,24 +1250,24 @@ MediaCache::Update() if (stream->mCacheSuspended && predictedNewDataUse.ToSeconds() > resumeThreshold) { // Don't need data for a while, so don't bother waking up the stream - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p avoiding wakeup since more data is not needed", stream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p avoiding wakeup since more data is not needed", stream)); enableReading = false; } else if (predictedNewDataUse.ToSeconds() > readaheadLimit) { // Don't read ahead more than this much - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p throttling to avoid reading ahead too far", stream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p throttling to avoid reading ahead too far", stream)); enableReading = false; } else if (freeBlockCount > 0) { // Free blocks in the cache, so keep reading - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p reading since there are free blocks", stream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p reading since there are free blocks", stream)); enableReading = true; } else if (latestNextUse <= TimeDuration(0)) { // No reusable blocks, so can't read anything - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p throttling due to no reusable blocks", stream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p throttling due to no reusable blocks", stream)); enableReading = false; } else { // Read ahead if the data we expect to read is more valuable than // the least valuable block in the main part of the cache - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p predict next data in %f, current worst block is %f", + CACHE_LOG(LogLevel::Debug, ("Stream %p predict next data in %f, current worst block is %f", stream, predictedNewDataUse.ToSeconds(), latestNextUse.ToSeconds())); enableReading = predictedNewDataUse < latestNextUse; } @@ -1282,7 +1282,7 @@ MediaCache::Update() // This block is already going to be read by the other stream. // So don't try to read it from this stream as well. enableReading = false; - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p waiting on same block (%lld) from stream %p", + CACHE_LOG(LogLevel::Debug, ("Stream %p waiting on same block (%lld) from stream %p", stream, desiredOffset/BLOCK_SIZE, other)); break; } @@ -1346,18 +1346,18 @@ MediaCache::Update() switch (actions[i]) { case SEEK: case SEEK_AND_RESUME: - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p CacheSeek to %lld (resume=%d)", stream, + CACHE_LOG(LogLevel::Debug, ("Stream %p CacheSeek to %lld (resume=%d)", stream, (long long)stream->mChannelOffset, actions[i] == SEEK_AND_RESUME)); rv = stream->mClient->CacheClientSeek(stream->mChannelOffset, actions[i] == SEEK_AND_RESUME); break; case RESUME: - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p Resumed", stream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p Resumed", stream)); rv = stream->mClient->CacheClientResume(); QueueSuspendedStatusUpdate(stream->mResourceID); break; case SUSPEND: - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p Suspended", stream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p Suspended", stream)); rv = stream->mClient->CacheClientSuspend(); QueueSuspendedStatusUpdate(stream->mResourceID); break; @@ -1497,7 +1497,7 @@ MediaCache::AllocateAndWriteBlock(MediaCacheStream* aStream, const void* aData, if (stream->mBlocks[streamBlockIndex] >= 0) { // We no longer want to own this block int32_t globalBlockIndex = stream->mBlocks[streamBlockIndex]; - CACHE_LOG(PR_LOG_DEBUG, ("Released block %d from stream %p block %d(%lld)", + CACHE_LOG(LogLevel::Debug, ("Released block %d from stream %p block %d(%lld)", globalBlockIndex, stream, streamBlockIndex, (long long)streamBlockIndex*BLOCK_SIZE)); RemoveBlockOwner(globalBlockIndex, stream); } @@ -1511,7 +1511,7 @@ MediaCache::AllocateAndWriteBlock(MediaCacheStream* aStream, const void* aData, FreeBlock(blockIndex); Block* block = &mIndex[blockIndex]; - CACHE_LOG(PR_LOG_DEBUG, ("Allocated block %d to stream %p block %d(%lld)", + CACHE_LOG(LogLevel::Debug, ("Allocated block %d to stream %p block %d(%lld)", blockIndex, aStream, streamBlockIndex, (long long)streamBlockIndex*BLOCK_SIZE)); mFreeBlocks.RemoveBlock(blockIndex); @@ -1546,7 +1546,7 @@ MediaCache::AllocateAndWriteBlock(MediaCacheStream* aStream, const void* aData, nsresult rv = mFileCache->WriteBlock(blockIndex, reinterpret_cast(aData)); if (NS_FAILED(rv)) { - CACHE_LOG(PR_LOG_DEBUG, ("Released block %d from stream %p block %d(%lld)", + CACHE_LOG(LogLevel::Debug, ("Released block %d from stream %p block %d(%lld)", blockIndex, aStream, streamBlockIndex, (long long)streamBlockIndex*BLOCK_SIZE)); FreeBlock(blockIndex); } @@ -1563,7 +1563,7 @@ MediaCache::OpenStream(MediaCacheStream* aStream) NS_ASSERTION(NS_IsMainThread(), "Only call on main thread"); ReentrantMonitorAutoEnter mon(mReentrantMonitor); - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p opened", aStream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p opened", aStream)); mStreams.AppendElement(aStream); aStream->mResourceID = AllocateResourceID(); @@ -1577,7 +1577,7 @@ MediaCache::ReleaseStream(MediaCacheStream* aStream) NS_ASSERTION(NS_IsMainThread(), "Only call on main thread"); ReentrantMonitorAutoEnter mon(mReentrantMonitor); - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p closed", aStream)); + CACHE_LOG(LogLevel::Debug, ("Stream %p closed", aStream)); mStreams.RemoveElement(aStream); // Update MediaCache again for |mStreams| is changed. @@ -1598,7 +1598,7 @@ MediaCache::ReleaseStreamBlocks(MediaCacheStream* aStream) for (uint32_t i = 0; i < length; ++i) { int32_t blockIndex = aStream->mBlocks[i]; if (blockIndex >= 0) { - CACHE_LOG(PR_LOG_DEBUG, ("Released block %d from stream %p block %d(%lld)", + CACHE_LOG(LogLevel::Debug, ("Released block %d from stream %p block %d(%lld)", blockIndex, aStream, i, (long long)i*BLOCK_SIZE)); RemoveBlockOwner(blockIndex, aStream); } @@ -1769,7 +1769,7 @@ MediaCacheStream::NotifyDataReceived(int64_t aSize, const char* aData, int64_t size = aSize; const char* data = aData; - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p DataReceived at %lld count=%lld", + CACHE_LOG(LogLevel::Debug, ("Stream %p DataReceived at %lld count=%lld", this, (long long)mChannelOffset, (long long)aSize)); // We process the data one block (or part of a block) at a time @@ -1837,7 +1837,7 @@ MediaCacheStream::FlushPartialBlockInternal(bool aNotifyAll) int32_t blockOffset = int32_t(mChannelOffset%BLOCK_SIZE); if (blockOffset > 0) { - CACHE_LOG(PR_LOG_DEBUG, + CACHE_LOG(LogLevel::Debug, ("Stream %p writing partial block: [%d] bytes; " "mStreamOffset [%lld] mChannelOffset[%lld] mStreamLength [%lld] " "notifying: [%s]", @@ -2188,7 +2188,7 @@ MediaCacheStream::Seek(int32_t aWhence, int64_t aOffset) return NS_ERROR_FAILURE; mStreamOffset = newOffset; - CACHE_LOG(PR_LOG_DEBUG, ("Stream %p Seek to %lld", this, (long long)mStreamOffset)); + CACHE_LOG(LogLevel::Debug, ("Stream %p Seek to %lld", this, (long long)mStreamOffset)); gMediaCache->NoteSeek(this, oldOffset); gMediaCache->QueueUpdate(); @@ -2305,7 +2305,7 @@ MediaCacheStream::Read(char* aBuffer, uint32_t aCount, uint32_t* aBytes) // have changed gMediaCache->QueueUpdate(); } - CACHE_LOG(PR_LOG_DEBUG, + CACHE_LOG(LogLevel::Debug, ("Stream %p Read at %lld count=%d", this, (long long)(mStreamOffset-count), count)); *aBytes = count; return NS_OK; diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index 3fa439817e..962fd4e2d9 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -60,7 +60,7 @@ static const uint64_t ESTIMATED_DURATION_FUZZ_FACTOR_USECS = USECS_PER_S / 2; PRLogModuleInfo* gMediaDecoderLog; #define DECODER_LOG(x, ...) \ - PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("Decoder=%p " x, this, ##__VA_ARGS__)) + MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("Decoder=%p " x, this, ##__VA_ARGS__)) static const char* const gPlayStateStr[] = { "START", diff --git a/dom/media/MediaDecoderReader.cpp b/dom/media/MediaDecoderReader.cpp index 0be01ce0c3..7563912f72 100644 --- a/dom/media/MediaDecoderReader.cpp +++ b/dom/media/MediaDecoderReader.cpp @@ -22,7 +22,7 @@ namespace mozilla { extern PRLogModuleInfo* gMediaDecoderLog; #define DECODER_LOG(x, ...) \ - PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG, ("Decoder=%p " x, mDecoder, ##__VA_ARGS__)) + MOZ_LOG(gMediaDecoderLog, LogLevel::Debug, ("Decoder=%p " x, mDecoder, ##__VA_ARGS__)) // Same workaround as MediaDecoderStateMachine.cpp. #define DECODER_WARN_HELPER(a, b) NS_WARNING b diff --git a/dom/media/MediaDecoderStateMachine.cpp b/dom/media/MediaDecoderStateMachine.cpp index fbe9730867..5288f41506 100644 --- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -59,13 +59,13 @@ using namespace mozilla::media; extern PRLogModuleInfo* gMediaDecoderLog; extern PRLogModuleInfo* gMediaSampleLog; #define LOG(m, l, x, ...) \ - PR_LOG(m, l, ("Decoder=%p " x, mDecoder.get(), ##__VA_ARGS__)) + MOZ_LOG(m, l, ("Decoder=%p " x, mDecoder.get(), ##__VA_ARGS__)) #define DECODER_LOG(x, ...) \ - LOG(gMediaDecoderLog, PR_LOG_DEBUG, x, ##__VA_ARGS__) + LOG(gMediaDecoderLog, LogLevel::Debug, x, ##__VA_ARGS__) #define VERBOSE_LOG(x, ...) \ - LOG(gMediaDecoderLog, PR_LOG_DEBUG+1, x, ##__VA_ARGS__) + LOG(gMediaDecoderLog, LogLevel::Verbose, x, ##__VA_ARGS__) #define SAMPLE_LOG(x, ...) \ - LOG(gMediaSampleLog, PR_LOG_DEBUG, x, ##__VA_ARGS__) + LOG(gMediaSampleLog, LogLevel::Debug, x, ##__VA_ARGS__) // Somehow MSVC doesn't correctly delete the comma before ##__VA_ARGS__ // when __VA_ARGS__ expands to nothing. This is a workaround for it. diff --git a/dom/media/MediaFormatReader.cpp b/dom/media/MediaFormatReader.cpp index 0c7be879ee..ac0057f0b5 100644 --- a/dom/media/MediaFormatReader.cpp +++ b/dom/media/MediaFormatReader.cpp @@ -34,8 +34,8 @@ PRLogModuleInfo* GetFormatDecoderLog() { } return log; } -#define LOG(arg, ...) PR_LOG(GetFormatDecoderLog(), PR_LOG_DEBUG, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) -#define LOGV(arg, ...) PR_LOG(GetFormatDecoderLog(), PR_LOG_DEBUG+1, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define LOG(arg, ...) MOZ_LOG(GetFormatDecoderLog(), mozilla::LogLevel::Debug, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define LOGV(arg, ...) MOZ_LOG(GetFormatDecoderLog(), mozilla::LogLevel::Verbose, ("MediaFormatReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) #else #define LOG(...) #define LOGV(...) diff --git a/dom/media/MediaManager.cpp b/dom/media/MediaManager.cpp index b34762b058..ee015df306 100644 --- a/dom/media/MediaManager.cpp +++ b/dom/media/MediaManager.cpp @@ -111,7 +111,7 @@ GetMediaManagerLog() sLog = PR_NewLogModule("MediaManager"); return sLog; } -#define LOG(msg) PR_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg) +#define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) using dom::File; using dom::MediaStreamConstraints; diff --git a/dom/media/MediaManager.h b/dom/media/MediaManager.h index dd9d255500..89b7880a44 100644 --- a/dom/media/MediaManager.h +++ b/dom/media/MediaManager.h @@ -49,7 +49,7 @@ struct MediaTrackConstraintSet; } // namespace dom extern PRLogModuleInfo* GetMediaManagerLog(); -#define MM_LOG(msg) PR_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg) +#define MM_LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) /** * This class is an implementation of MediaStreamListener. This is used diff --git a/dom/media/MediaPromise.h b/dom/media/MediaPromise.h index 73a25a6846..113110f47a 100644 --- a/dom/media/MediaPromise.h +++ b/dom/media/MediaPromise.h @@ -31,7 +31,7 @@ extern PRLogModuleInfo* gMediaPromiseLog; #define PROMISE_LOG(x, ...) \ MOZ_ASSERT(gMediaPromiseLog); \ - PR_LOG(gMediaPromiseLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__)) + MOZ_LOG(gMediaPromiseLog, mozilla::LogLevel::Debug, (x, ##__VA_ARGS__)) namespace detail { template diff --git a/dom/media/MediaRecorder.cpp b/dom/media/MediaRecorder.cpp index 0de96deb5f..e1ef5f0032 100644 --- a/dom/media/MediaRecorder.cpp +++ b/dom/media/MediaRecorder.cpp @@ -32,7 +32,7 @@ #endif PRLogModuleInfo* gMediaRecorderLog; -#define LOG(type, msg) PR_LOG(gMediaRecorderLog, type, msg) +#define LOG(type, msg) MOZ_LOG(gMediaRecorderLog, type, msg) namespace mozilla { @@ -182,7 +182,7 @@ class MediaRecorder::Session: public nsIObserver NS_IMETHODIMP Run() { - LOG(PR_LOG_DEBUG, ("Session.PushBlobRunnable s=(%p)", mSession.get())); + LOG(LogLevel::Debug, ("Session.PushBlobRunnable s=(%p)", mSession.get())); MOZ_ASSERT(NS_IsMainThread()); nsRefPtr recorder = mSession->mRecorder; @@ -212,7 +212,7 @@ class MediaRecorder::Session: public nsIObserver NS_IMETHODIMP Run() { - LOG(PR_LOG_DEBUG, ("Session.ErrorNotifyRunnable s=(%p)", mSession.get())); + LOG(LogLevel::Debug, ("Session.ErrorNotifyRunnable s=(%p)", mSession.get())); MOZ_ASSERT(NS_IsMainThread()); nsRefPtr recorder = mSession->mRecorder; @@ -241,7 +241,7 @@ class MediaRecorder::Session: public nsIObserver NS_IMETHODIMP Run() { - LOG(PR_LOG_DEBUG, ("Session.DispatchStartEventRunnable s=(%p)", mSession.get())); + LOG(LogLevel::Debug, ("Session.DispatchStartEventRunnable s=(%p)", mSession.get())); MOZ_ASSERT(NS_IsMainThread()); NS_ENSURE_TRUE(mSession->mRecorder, NS_OK); @@ -273,7 +273,7 @@ class MediaRecorder::Session: public nsIObserver { MOZ_ASSERT(NS_GetCurrentThread() == mSession->mReadThread); - LOG(PR_LOG_DEBUG, ("Session.ExtractRunnable shutdown = %d", mSession->mEncoder->IsShutdown())); + LOG(LogLevel::Debug, ("Session.ExtractRunnable shutdown = %d", mSession->mEncoder->IsShutdown())); if (!mSession->mEncoder->IsShutdown()) { mSession->Extract(false); nsCOMPtr event = new ExtractRunnable(mSession); @@ -318,7 +318,7 @@ class MediaRecorder::Session: public nsIObserver trackTypes |= ContainerWriter::CREATE_VIDEO_TRACK; } - LOG(PR_LOG_DEBUG, ("Session.NotifyTracksAvailable track type = (%d)", trackTypes)); + LOG(LogLevel::Debug, ("Session.NotifyTracksAvailable track type = (%d)", trackTypes)); mSession->InitEncoder(trackTypes); } private: @@ -334,7 +334,7 @@ class MediaRecorder::Session: public nsIObserver NS_IMETHODIMP Run() { - LOG(PR_LOG_DEBUG, ("Session.DestroyRunnable session refcnt = (%d) stopIssued %d s=(%p)", + LOG(LogLevel::Debug, ("Session.DestroyRunnable session refcnt = (%d) stopIssued %d s=(%p)", (int)mSession->mRefCnt, mSession->mStopIssued, mSession.get())); MOZ_ASSERT(NS_IsMainThread() && mSession.get()); nsRefPtr recorder = mSession->mRecorder; @@ -392,7 +392,7 @@ public: void Start() { - LOG(PR_LOG_DEBUG, ("Session.Start %p", this)); + LOG(LogLevel::Debug, ("Session.Start %p", this)); MOZ_ASSERT(NS_IsMainThread()); SetupStreams(); @@ -400,7 +400,7 @@ public: void Stop() { - LOG(PR_LOG_DEBUG, ("Session.Stop %p", this)); + LOG(LogLevel::Debug, ("Session.Stop %p", this)); MOZ_ASSERT(NS_IsMainThread()); mStopIssued = true; CleanupStreams(); @@ -409,7 +409,7 @@ public: nsresult Pause() { - LOG(PR_LOG_DEBUG, ("Session.Pause")); + LOG(LogLevel::Debug, ("Session.Pause")); MOZ_ASSERT(NS_IsMainThread()); NS_ENSURE_TRUE(mTrackUnionStream, NS_ERROR_FAILURE); @@ -420,7 +420,7 @@ public: nsresult Resume() { - LOG(PR_LOG_DEBUG, ("Session.Resume")); + LOG(LogLevel::Debug, ("Session.Resume")); MOZ_ASSERT(NS_IsMainThread()); NS_ENSURE_TRUE(mTrackUnionStream, NS_ERROR_FAILURE); @@ -431,7 +431,7 @@ public: nsresult RequestData() { - LOG(PR_LOG_DEBUG, ("Session.RequestData")); + LOG(LogLevel::Debug, ("Session.RequestData")); MOZ_ASSERT(NS_IsMainThread()); if (NS_FAILED(NS_DispatchToMainThread(new EncoderErrorNotifierRunnable(this))) || @@ -470,7 +470,7 @@ private: // Only DestroyRunnable is allowed to delete Session object. virtual ~Session() { - LOG(PR_LOG_DEBUG, ("Session.~Session (%p)", this)); + LOG(LogLevel::Debug, ("Session.~Session (%p)", this)); CleanupStreams(); } // Pull encoded media data from MediaEncoder and put into EncodedBufferCache. @@ -480,7 +480,7 @@ private: void Extract(bool aForceFlush) { MOZ_ASSERT(NS_GetCurrentThread() == mReadThread); - LOG(PR_LOG_DEBUG, ("Session.Extract %p", this)); + LOG(LogLevel::Debug, ("Session.Extract %p", this)); if (!mIsRegisterProfiler) { char aLocal; @@ -583,7 +583,7 @@ private: void InitEncoder(uint8_t aTrackTypes) { - LOG(PR_LOG_DEBUG, ("Session.InitEncoder %p", this)); + LOG(LogLevel::Debug, ("Session.InitEncoder %p", this)); MOZ_ASSERT(NS_IsMainThread()); // Allocate encoder and bind with union stream. @@ -670,7 +670,7 @@ private: NS_IMETHODIMP Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) override { MOZ_ASSERT(NS_IsMainThread()); - LOG(PR_LOG_DEBUG, ("Session.Observe XPCOM_SHUTDOWN %p", this)); + LOG(LogLevel::Debug, ("Session.Observe XPCOM_SHUTDOWN %p", this)); if (strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { // Force stop Session to terminate Read Thread. mEncoder->Cancel(); @@ -736,7 +736,7 @@ MediaRecorder::~MediaRecorder() mInputPort->Destroy(); mPipeStream->Destroy(); } - LOG(PR_LOG_DEBUG, ("~MediaRecorder (%p)", this)); + LOG(LogLevel::Debug, ("~MediaRecorder (%p)", this)); UnRegisterActivityObserver(); } @@ -822,7 +822,7 @@ MediaRecorder::GetMimeType(nsString &aMimeType) void MediaRecorder::Start(const Optional& aTimeSlice, ErrorResult& aResult) { - LOG(PR_LOG_DEBUG, ("MediaRecorder.Start %p", this)); + LOG(LogLevel::Debug, ("MediaRecorder.Start %p", this)); if (mState != RecordingState::Inactive) { aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; @@ -864,7 +864,7 @@ MediaRecorder::Start(const Optional& aTimeSlice, ErrorResult& aResult) void MediaRecorder::Stop(ErrorResult& aResult) { - LOG(PR_LOG_DEBUG, ("MediaRecorder.Stop %p", this)); + LOG(LogLevel::Debug, ("MediaRecorder.Stop %p", this)); MediaRecorderReporter::RemoveMediaRecorder(this); if (mState == RecordingState::Inactive) { aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); @@ -878,7 +878,7 @@ MediaRecorder::Stop(ErrorResult& aResult) void MediaRecorder::Pause(ErrorResult& aResult) { - LOG(PR_LOG_DEBUG, ("MediaRecorder.Pause")); + LOG(LogLevel::Debug, ("MediaRecorder.Pause")); if (mState != RecordingState::Recording) { aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; @@ -896,7 +896,7 @@ MediaRecorder::Pause(ErrorResult& aResult) void MediaRecorder::Resume(ErrorResult& aResult) { - LOG(PR_LOG_DEBUG, ("MediaRecorder.Resume")); + LOG(LogLevel::Debug, ("MediaRecorder.Resume")); if (mState != RecordingState::Paused) { aResult.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return; @@ -1125,7 +1125,7 @@ bool MediaRecorder::CheckPrincipal() void MediaRecorder::RemoveSession(Session* aSession) { - LOG(PR_LOG_DEBUG, ("MediaRecorder.RemoveSession (%p)", aSession)); + LOG(LogLevel::Debug, ("MediaRecorder.RemoveSession (%p)", aSession)); mSessions.RemoveElement(aSession); } @@ -1137,7 +1137,7 @@ MediaRecorder::NotifyOwnerDocumentActivityChanged() nsIDocument* doc = window->GetExtantDoc(); NS_ENSURE_TRUE_VOID(doc); - LOG(PR_LOG_DEBUG, ("MediaRecorder %p document IsActive %d isVisible %d\n", + LOG(LogLevel::Debug, ("MediaRecorder %p document IsActive %d isVisible %d\n", this, doc->IsActive(), doc->IsVisible())); if (!doc->IsActive() || !doc->IsVisible()) { // Stop the session. diff --git a/dom/media/MediaResource.cpp b/dom/media/MediaResource.cpp index 7427b2c3b0..3f8f6b928d 100644 --- a/dom/media/MediaResource.cpp +++ b/dom/media/MediaResource.cpp @@ -36,7 +36,7 @@ using mozilla::media::TimeUnit; PRLogModuleInfo* gMediaResourceLog; -#define RESOURCE_LOG(msg, ...) PR_LOG(gMediaResourceLog, PR_LOG_DEBUG, \ +#define RESOURCE_LOG(msg, ...) MOZ_LOG(gMediaResourceLog, mozilla::LogLevel::Debug, \ (msg, ##__VA_ARGS__)) // Debug logging macro with object pointer and class name. #define CMLOG(msg, ...) \ diff --git a/dom/media/MediaShutdownManager.cpp b/dom/media/MediaShutdownManager.cpp index 6dd461cdca..5648831f3b 100644 --- a/dom/media/MediaShutdownManager.cpp +++ b/dom/media/MediaShutdownManager.cpp @@ -14,7 +14,7 @@ namespace mozilla { extern PRLogModuleInfo* gMediaDecoderLog; -#define DECODER_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) NS_IMPL_ISUPPORTS(MediaShutdownManager, nsIObserver) @@ -113,7 +113,7 @@ MediaShutdownManager::Shutdown() MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(sInstance); - DECODER_LOG(PR_LOG_DEBUG, ("MediaShutdownManager::Shutdown() start...")); + DECODER_LOG(LogLevel::Debug, ("MediaShutdownManager::Shutdown() start...")); // Mark that we're shutting down, so that Unregister(*) calls don't remove // hashtable entries. If Unregsiter(*) was to remove from the hash table, @@ -139,7 +139,7 @@ MediaShutdownManager::Shutdown() // up after it finishes its notifications. sInstance = nullptr; - DECODER_LOG(PR_LOG_DEBUG, ("MediaShutdownManager::Shutdown() end.")); + DECODER_LOG(LogLevel::Debug, ("MediaShutdownManager::Shutdown() end.")); } } // namespace mozilla diff --git a/dom/media/MediaStreamGraph.cpp b/dom/media/MediaStreamGraph.cpp index 99419778d0..4d4d1965e0 100644 --- a/dom/media/MediaStreamGraph.cpp +++ b/dom/media/MediaStreamGraph.cpp @@ -40,7 +40,7 @@ using namespace mozilla::gfx; namespace mozilla { PRLogModuleInfo* gMediaStreamGraphLog; -#define STREAM_LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg) +#define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg) // #define ENABLE_LIFECYCLE_LOG @@ -86,7 +86,7 @@ MediaStreamGraphImpl::~MediaStreamGraphImpl() { NS_ASSERTION(IsEmpty(), "All streams should have been destroyed by messages from the main thread"); - STREAM_LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p destroyed", this)); + STREAM_LOG(LogLevel::Debug, ("MediaStreamGraph %p destroyed", this)); LIFECYCLE_LOG("MediaStreamGraphImpl::~MediaStreamGraphImpl\n"); } @@ -106,7 +106,7 @@ MediaStreamGraphImpl::FinishStream(MediaStream* aStream) { if (aStream->mFinished) return; - STREAM_LOG(PR_LOG_DEBUG, ("MediaStream %p will finish", aStream)); + STREAM_LOG(LogLevel::Debug, ("MediaStream %p will finish", aStream)); aStream->mFinished = true; aStream->mBuffer.AdvanceKnownTracksTime(STREAM_TIME_MAX); // Force at least one more iteration of the control loop, since we rely @@ -136,11 +136,11 @@ MediaStreamGraphImpl::AddStream(MediaStream* aStream) if (contextSuspended) { aStream->mBufferStartTime = START_TIME_DELAYED; mSuspendedStreams.AppendElement(aStream); - STREAM_LOG(PR_LOG_DEBUG, ("Adding media stream %p to the graph, in the suspended stream array", aStream)); + STREAM_LOG(LogLevel::Debug, ("Adding media stream %p to the graph, in the suspended stream array", aStream)); } else { aStream->mBufferStartTime = IterationEnd(); mStreams.AppendElement(aStream); - STREAM_LOG(PR_LOG_DEBUG, ("Adding media stream %p to the graph", aStream)); + STREAM_LOG(LogLevel::Debug, ("Adding media stream %p to the graph", aStream)); } SetStreamOrderDirty(); @@ -169,7 +169,7 @@ MediaStreamGraphImpl::RemoveStream(MediaStream* aStream) NS_RELEASE(aStream); // probably destroying it - STREAM_LOG(PR_LOG_DEBUG, ("Removing media stream %p from the graph", aStream)); + STREAM_LOG(LogLevel::Debug, ("Removing media stream %p from the graph", aStream)); } void @@ -203,14 +203,14 @@ MediaStreamGraphImpl::ExtractPendingInput(SourceMediaStream* aStream, StreamTime t = GraphTimeToStreamTime(aStream, CurrentDriver()->StateComputedTime()) + (aDesiredUpToTime - CurrentDriver()->StateComputedTime()); - STREAM_LOG(PR_LOG_DEBUG+1, ("Calling NotifyPull aStream=%p t=%f current end=%f", aStream, + STREAM_LOG(LogLevel::Verbose, ("Calling NotifyPull aStream=%p t=%f current end=%f", aStream, MediaTimeToSeconds(t), MediaTimeToSeconds(aStream->mBuffer.GetEnd()))); if (t > aStream->mBuffer.GetEnd()) { *aEnsureNextIteration = true; #ifdef DEBUG if (aStream->mListeners.Length() == 0) { - STREAM_LOG(PR_LOG_ERROR, ("No listeners in NotifyPull aStream=%p desired=%f current end=%f", + STREAM_LOG(LogLevel::Error, ("No listeners in NotifyPull aStream=%p desired=%f current end=%f", aStream, MediaTimeToSeconds(t), MediaTimeToSeconds(aStream->mBuffer.GetEnd()))); aStream->DumpTrackInfo(); @@ -238,7 +238,7 @@ MediaStreamGraphImpl::ExtractPendingInput(SourceMediaStream* aStream, } if (data->mCommands & SourceMediaStream::TRACK_CREATE) { MediaSegment* segment = data->mData.forget(); - STREAM_LOG(PR_LOG_DEBUG, ("SourceMediaStream %p creating track %d, start %lld, initial end %lld", + STREAM_LOG(LogLevel::Debug, ("SourceMediaStream %p creating track %d, start %lld, initial end %lld", aStream, data->mID, int64_t(data->mStart), int64_t(segment->GetDuration()))); @@ -251,7 +251,7 @@ MediaStreamGraphImpl::ExtractPendingInput(SourceMediaStream* aStream, notifiedTrackCreated = true; } else if (data->mData->GetDuration() > 0) { MediaSegment* dest = aStream->mBuffer.FindTrack(data->mID)->GetSegment(); - STREAM_LOG(PR_LOG_DEBUG+1, ("SourceMediaStream %p track %d, advancing end from %lld to %lld", + STREAM_LOG(LogLevel::Verbose, ("SourceMediaStream %p track %d, advancing end from %lld to %lld", aStream, data->mID, int64_t(dest->GetDuration()), int64_t(dest->GetDuration() + data->mData->GetDuration()))); @@ -466,7 +466,7 @@ MediaStreamGraphImpl::UpdateCurrentTimeForStreams(GraphTime aPrevCurrentTime, Gr streamsReadyToFinish.AppendElement(stream); } } - STREAM_LOG(PR_LOG_DEBUG + 1, + STREAM_LOG(LogLevel::Verbose, ("MediaStream %p bufferStartTime=%f blockedTime=%f", stream, MediaTimeToSeconds(stream->mBufferStartTime), MediaTimeToSeconds(blockedTime))); @@ -519,7 +519,7 @@ MediaStreamGraphImpl::WillUnderrun(MediaStream* aStream, GraphTime aTime, INCLUDE_TRAILING_BLOCKED_INTERVAL); #ifdef DEBUG if (bufferEnd < IterationEnd()) { - STREAM_LOG(PR_LOG_ERROR, ("MediaStream %p underrun, " + STREAM_LOG(LogLevel::Error, ("MediaStream %p underrun, " "bufferEnd %f < IterationEnd() %f (%lld < %lld), Streamtime %lld", aStream, MediaTimeToSeconds(bufferEnd), MediaTimeToSeconds(IterationEnd()), bufferEnd, IterationEnd(), aStream->GetBufferEnd())); @@ -529,7 +529,7 @@ MediaStreamGraphImpl::WillUnderrun(MediaStream* aStream, GraphTime aTime, #endif // We should block after bufferEnd. if (bufferEnd <= aTime) { - STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p will block due to data underrun at %ld, " + STREAM_LOG(LogLevel::Verbose, ("MediaStream %p will block due to data underrun at %ld, " "bufferEnd %ld", aStream, aTime, bufferEnd)); return true; @@ -540,7 +540,7 @@ MediaStreamGraphImpl::WillUnderrun(MediaStream* aStream, GraphTime aTime, // but we might as well remain unblocked and play the data we've got while // we can. if (bufferEnd < aEndBlockingDecisions && aStream->mBlocked.GetBefore(aTime)) { - STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p will block due to speculative data underrun, " + STREAM_LOG(LogLevel::Verbose, ("MediaStream %p will block due to speculative data underrun, " "bufferEnd %f (end at %ld)", aStream, MediaTimeToSeconds(bufferEnd), bufferEnd)); return true; @@ -828,7 +828,7 @@ MediaStreamGraphImpl::RecomputeBlocking(GraphTime aEndBlockingDecisions) { bool blockingDecisionsWillChange = false; - STREAM_LOG(PR_LOG_DEBUG+1, ("Media graph %p computing blocking for time %f", + STREAM_LOG(LogLevel::Verbose, ("Media graph %p computing blocking for time %f", this, MediaTimeToSeconds(CurrentDriver()->StateComputedTime()))); nsTArray* runningAndSuspendedPair[2]; runningAndSuspendedPair[0] = &mStreams; @@ -862,7 +862,7 @@ MediaStreamGraphImpl::RecomputeBlocking(GraphTime aEndBlockingDecisions) } } } - STREAM_LOG(PR_LOG_DEBUG+1, ("Media graph %p computed blocking for interval %f to %f", + STREAM_LOG(LogLevel::Verbose, ("Media graph %p computed blocking for interval %f to %f", this, MediaTimeToSeconds(CurrentDriver()->StateComputedTime()), MediaTimeToSeconds(aEndBlockingDecisions))); @@ -940,13 +940,13 @@ MediaStreamGraphImpl::RecomputeBlockingAt(const nsTArray& aStreams GraphTime endTime = StreamTimeToGraphTime(stream, stream->GetStreamBuffer().GetAllTracksEnd()); if (endTime <= aTime) { - STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p is blocked due to being finished", stream)); + STREAM_LOG(LogLevel::Verbose, ("MediaStream %p is blocked due to being finished", stream)); // We'll block indefinitely MarkStreamBlocking(stream); *aEnd = std::min(*aEnd, aEndBlockingDecisions); continue; } else { - STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p is finished, but not blocked yet (end at %f, with blocking at %f)", + STREAM_LOG(LogLevel::Verbose, ("MediaStream %p is finished, but not blocked yet (end at %f, with blocking at %f)", stream, MediaTimeToSeconds(stream->GetBufferEnd()), MediaTimeToSeconds(endTime))); *aEnd = std::min(*aEnd, endTime); @@ -957,7 +957,7 @@ MediaStreamGraphImpl::RecomputeBlockingAt(const nsTArray& aStreams bool explicitBlock = stream->mExplicitBlockerCount.GetAt(aTime, &end) > 0; *aEnd = std::min(*aEnd, end); if (explicitBlock) { - STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p is blocked due to explicit blocker", stream)); + STREAM_LOG(LogLevel::Verbose, ("MediaStream %p is blocked due to explicit blocker", stream)); MarkStreamBlocking(stream); continue; } @@ -1099,7 +1099,7 @@ MediaStreamGraphImpl::PlayAudio(MediaStream* aStream, if (blocked) { output.InsertNullDataAtStart(toWrite); ticksWritten += toWrite; - STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p writing %ld blocking-silence samples for %f to %f (%ld to %ld)\n", + STREAM_LOG(LogLevel::Verbose, ("MediaStream %p writing %ld blocking-silence samples for %f to %f (%ld to %ld)\n", aStream, toWrite, MediaTimeToSeconds(t), MediaTimeToSeconds(end), offset, offset + toWrite)); } else { @@ -1107,7 +1107,7 @@ MediaStreamGraphImpl::PlayAudio(MediaStream* aStream, StreamTime endTicksAvailable = audio->GetDuration(); if (endTicksNeeded <= endTicksAvailable) { - STREAM_LOG(PR_LOG_DEBUG + 1, + STREAM_LOG(LogLevel::Verbose, ("MediaStream %p writing %ld samples for %f to %f " "(samples %ld to %ld)\n", aStream, toWrite, MediaTimeToSeconds(t), @@ -1122,7 +1122,7 @@ MediaStreamGraphImpl::PlayAudio(MediaStream* aStream, if (endTicksNeeded > endTicksAvailable && offset < endTicksAvailable) { output.AppendSlice(*audio, offset, endTicksAvailable); - STREAM_LOG(PR_LOG_DEBUG + 1, + STREAM_LOG(LogLevel::Verbose, ("MediaStream %p writing %ld samples for %f to %f " "(samples %ld to %ld)\n", aStream, toWrite, MediaTimeToSeconds(t), @@ -1133,7 +1133,7 @@ MediaStreamGraphImpl::PlayAudio(MediaStream* aStream, offset = endTicksAvailable; } output.AppendNullData(toWrite); - STREAM_LOG(PR_LOG_DEBUG + 1, + STREAM_LOG(LogLevel::Verbose, ("MediaStream %p writing %ld padding slsamples for %f to " "%f (samples %ld to %ld)\n", aStream, toWrite, MediaTimeToSeconds(t), @@ -1222,7 +1222,7 @@ MediaStreamGraphImpl::PlayVideo(MediaStream* aStream) if (!frame || *frame == aStream->mLastPlayedVideoFrame) return; - STREAM_LOG(PR_LOG_DEBUG+1, ("MediaStream %p writing video frame %p (%dx%d)", + STREAM_LOG(LogLevel::Verbose, ("MediaStream %p writing video frame %p (%dx%d)", aStream, frame->GetImage(), frame->GetIntrinsicSize().width, frame->GetIntrinsicSize().height)); GraphTime startTime = StreamTimeToGraphTime(aStream, @@ -1529,7 +1529,7 @@ MediaStreamGraphImpl::OneIteration(GraphTime aFrom, GraphTime aTo, if (finalUpdate) { // Enter shutdown mode. The stable-state handler will detect this // and complete shutdown. Destroy any streams immediately. - STREAM_LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p waiting for main thread cleanup", this)); + STREAM_LOG(LogLevel::Debug, ("MediaStreamGraph %p waiting for main thread cleanup", this)); // We'll shut down this graph object if it does not get restarted. mLifecycleState = LIFECYCLE_WAITING_FOR_MAIN_THREAD_CLEANUP; // No need to Destroy streams here. The main-thread owner of each @@ -1569,7 +1569,7 @@ void MediaStreamGraphImpl::ForceShutDown() { NS_ASSERTION(NS_IsMainThread(), "Must be called on main thread"); - STREAM_LOG(PR_LOG_DEBUG, ("MediaStreamGraph %p ForceShutdown", this)); + STREAM_LOG(LogLevel::Debug, ("MediaStreamGraph %p ForceShutdown", this)); { MonitorAutoLock lock(mMonitor); mForceShutDown = true; @@ -2732,7 +2732,7 @@ SourceMediaStream::NeedsMixing() void MediaInputPort::Init() { - STREAM_LOG(PR_LOG_DEBUG, ("Adding MediaInputPort %p (from %p to %p) to the graph", + STREAM_LOG(LogLevel::Debug, ("Adding MediaInputPort %p (from %p to %p) to the graph", this, mSource, mDest)); mSource->AddConsumer(this); mDest->AddInput(this); @@ -3011,7 +3011,7 @@ MediaStreamGraph::GetInstance(bool aStartWithAudioDriver, graph = new MediaStreamGraphImpl(true, CubebUtils::PreferredSampleRate(), aStartWithAudioDriver, aChannel); gGraphs.Put(channel, graph); - STREAM_LOG(PR_LOG_DEBUG, ("Starting up MediaStreamGraph %p", graph)); + STREAM_LOG(LogLevel::Debug, ("Starting up MediaStreamGraph %p", graph)); } return graph; @@ -3024,7 +3024,7 @@ MediaStreamGraph::CreateNonRealtimeInstance(TrackRate aSampleRate) MediaStreamGraphImpl* graph = new MediaStreamGraphImpl(false, aSampleRate); - STREAM_LOG(PR_LOG_DEBUG, ("Starting up Offline MediaStreamGraph %p", graph)); + STREAM_LOG(LogLevel::Debug, ("Starting up Offline MediaStreamGraph %p", graph)); return graph; } @@ -3329,7 +3329,7 @@ MediaStreamGraphImpl::MoveStreams(AudioContextOperation aAudioContextOperation, stream->remove(); } - STREAM_LOG(PR_LOG_DEBUG, ("Moving streams between suspended and running" + STREAM_LOG(LogLevel::Debug, ("Moving streams between suspended and running" "state: mStreams: %d, mSuspendedStreams: %d\n", mStreams.Length(), mSuspendedStreams.Length())); #ifdef DEBUG diff --git a/dom/media/MediaTimer.h b/dom/media/MediaTimer.h index bbffad01be..12b4024a08 100644 --- a/dom/media/MediaTimer.h +++ b/dom/media/MediaTimer.h @@ -23,7 +23,7 @@ extern PRLogModuleInfo* gMediaTimerLog; #define TIMER_LOG(x, ...) \ MOZ_ASSERT(gMediaTimerLog); \ - PR_LOG(gMediaTimerLog, PR_LOG_DEBUG, ("[MediaTimer=%p relative_t=%lld]" x, this, \ + MOZ_LOG(gMediaTimerLog, LogLevel::Debug, ("[MediaTimer=%p relative_t=%lld]" x, this, \ RelativeMicroseconds(TimeStamp::Now()), ##__VA_ARGS__)) // This promise type is only exclusive because so far there isn't a reason for diff --git a/dom/media/RtspMediaResource.cpp b/dom/media/RtspMediaResource.cpp index f18913ae40..3c659bd6b0 100644 --- a/dom/media/RtspMediaResource.cpp +++ b/dom/media/RtspMediaResource.cpp @@ -22,7 +22,7 @@ using namespace mozilla::net; using namespace mozilla::media; PRLogModuleInfo* gRtspMediaResourceLog; -#define RTSP_LOG(msg, ...) PR_LOG(gRtspMediaResourceLog, PR_LOG_DEBUG, \ +#define RTSP_LOG(msg, ...) MOZ_LOG(gRtspMediaResourceLog, mozilla::LogLevel::Debug, \ (msg, ##__VA_ARGS__)) // Debug logging macro with object pointer and class name. #define RTSPMLOG(msg, ...) \ diff --git a/dom/media/StateMirroring.h b/dom/media/StateMirroring.h index dddd0c1bfe..a2f44d47e5 100644 --- a/dom/media/StateMirroring.h +++ b/dom/media/StateMirroring.h @@ -50,7 +50,7 @@ namespace mozilla { // the same log module. #define MIRROR_LOG(x, ...) \ MOZ_ASSERT(gStateWatchingLog); \ - PR_LOG(gStateWatchingLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__)) + MOZ_LOG(gStateWatchingLog, LogLevel::Debug, (x, ##__VA_ARGS__)) template class AbstractMirror; diff --git a/dom/media/StateWatching.h b/dom/media/StateWatching.h index 69a8f8995f..718d10115e 100644 --- a/dom/media/StateWatching.h +++ b/dom/media/StateWatching.h @@ -60,7 +60,7 @@ extern PRLogModuleInfo* gStateWatchingLog; #define WATCH_LOG(x, ...) \ MOZ_ASSERT(gStateWatchingLog); \ - PR_LOG(gStateWatchingLog, PR_LOG_DEBUG, (x, ##__VA_ARGS__)) + MOZ_LOG(gStateWatchingLog, LogLevel::Debug, (x, ##__VA_ARGS__)) /* * AbstractWatcher is a superclass from which all watchers must inherit. diff --git a/dom/media/StreamBuffer.cpp b/dom/media/StreamBuffer.cpp index 07d5aaa6d3..668463c5ba 100644 --- a/dom/media/StreamBuffer.cpp +++ b/dom/media/StreamBuffer.cpp @@ -10,19 +10,19 @@ namespace mozilla { extern PRLogModuleInfo* gMediaStreamGraphLog; -#define STREAM_LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg) +#define STREAM_LOG(type, msg) MOZ_LOG(gMediaStreamGraphLog, type, msg) #ifdef DEBUG void StreamBuffer::DumpTrackInfo() const { - STREAM_LOG(PR_LOG_ALWAYS, ("DumpTracks: mTracksKnownTime %lld", mTracksKnownTime)); + STREAM_LOG(LogLevel::Info, ("DumpTracks: mTracksKnownTime %lld", mTracksKnownTime)); for (uint32_t i = 0; i < mTracks.Length(); ++i) { Track* track = mTracks[i]; if (track->IsEnded()) { - STREAM_LOG(PR_LOG_ALWAYS, ("Track[%d] %d: ended", i, track->GetID())); + STREAM_LOG(LogLevel::Info, ("Track[%d] %d: ended", i, track->GetID())); } else { - STREAM_LOG(PR_LOG_ALWAYS, ("Track[%d] %d: %lld", i, track->GetID(), + STREAM_LOG(LogLevel::Info, ("Track[%d] %d: %lld", i, track->GetID(), track->GetEnd())); } } diff --git a/dom/media/TrackUnionStream.cpp b/dom/media/TrackUnionStream.cpp index 9f12bbb2a2..5da55c7004 100644 --- a/dom/media/TrackUnionStream.cpp +++ b/dom/media/TrackUnionStream.cpp @@ -43,7 +43,7 @@ namespace mozilla { #endif PRLogModuleInfo* gTrackUnionStreamLog; -#define STREAM_LOG(type, msg) PR_LOG(gTrackUnionStreamLog, type, msg) +#define STREAM_LOG(type, msg) MOZ_LOG(gTrackUnionStreamLog, type, msg) TrackUnionStream::TrackUnionStream(DOMMediaStream* aWrapper) : ProcessedMediaStream(aWrapper) @@ -196,7 +196,7 @@ TrackUnionStream::TrackUnionStream(DOMMediaStream* aWrapper) : segment->AppendNullData(outputStart); StreamBuffer::Track* track = &mBuffer.AddTrack(id, outputStart, segment.forget()); - STREAM_LOG(PR_LOG_DEBUG, ("TrackUnionStream %p adding track %d for input stream %p track %d, start ticks %lld", + STREAM_LOG(LogLevel::Debug, ("TrackUnionStream %p adding track %d for input stream %p track %d, start ticks %lld", this, id, aPort->GetSource(), aTrack->GetID(), (long long)outputStart)); @@ -264,7 +264,7 @@ TrackUnionStream::TrackUnionStream(DOMMediaStream* aWrapper) : if (interval.mInputIsBlocked) { // Maybe the input track ended? segment->AppendNullData(ticks); - STREAM_LOG(PR_LOG_DEBUG+1, ("TrackUnionStream %p appending %lld ticks of null data to track %d", + STREAM_LOG(LogLevel::Verbose, ("TrackUnionStream %p appending %lld ticks of null data to track %d", this, (long long)ticks, outputTrack->GetID())); } else if (InMutedCycle()) { segment->AppendNullData(ticks); diff --git a/dom/media/WebVTTListener.cpp b/dom/media/WebVTTListener.cpp index 71d760b177..5727e8c718 100644 --- a/dom/media/WebVTTListener.cpp +++ b/dom/media/WebVTTListener.cpp @@ -29,7 +29,7 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(WebVTTListener) NS_IMPL_CYCLE_COLLECTING_RELEASE(WebVTTListener) PRLogModuleInfo* gTextTrackLog; -# define VTT_LOG(...) PR_LOG(gTextTrackLog, PR_LOG_DEBUG, (__VA_ARGS__)) +# define VTT_LOG(...) MOZ_LOG(gTextTrackLog, LogLevel::Debug, (__VA_ARGS__)) WebVTTListener::WebVTTListener(HTMLTrackElement* aElement) : mElement(aElement) diff --git a/dom/media/apple/AppleMP3Reader.cpp b/dom/media/apple/AppleMP3Reader.cpp index e51d48a2cf..a351c044e5 100644 --- a/dom/media/apple/AppleMP3Reader.cpp +++ b/dom/media/apple/AppleMP3Reader.cpp @@ -24,9 +24,9 @@ using namespace mozilla::media; namespace mozilla { extern PRLogModuleInfo* gMediaDecoderLog; -#define LOGE(...) PR_LOG(gMediaDecoderLog, PR_LOG_ERROR, (__VA_ARGS__)) -#define LOGW(...) PR_LOG(gMediaDecoderLog, PR_LOG_WARNING, (__VA_ARGS__)) -#define LOGD(...) PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOGE(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Error, (__VA_ARGS__)) +#define LOGW(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Warning, (__VA_ARGS__)) +#define LOGD(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) #define PROPERTY_ID_FORMAT "%c%c%c%c" #define PROPERTY_ID_PRINT(x) ((x) >> 24), \ diff --git a/dom/media/directshow/AudioSinkFilter.cpp b/dom/media/directshow/AudioSinkFilter.cpp index 861b2606cc..3d2b93b46b 100644 --- a/dom/media/directshow/AudioSinkFilter.cpp +++ b/dom/media/directshow/AudioSinkFilter.cpp @@ -24,7 +24,7 @@ using namespace mozilla::media; namespace mozilla { PRLogModuleInfo* GetDirectShowLog(); -#define LOG(...) PR_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) AudioSinkFilter::AudioSinkFilter(const wchar_t* aObjectName, HRESULT* aOutResult) : BaseFilter(aObjectName, CLSID_MozAudioSinkFilter), diff --git a/dom/media/directshow/AudioSinkInputPin.cpp b/dom/media/directshow/AudioSinkInputPin.cpp index 847fa0ef75..76d9d22796 100644 --- a/dom/media/directshow/AudioSinkInputPin.cpp +++ b/dom/media/directshow/AudioSinkInputPin.cpp @@ -16,7 +16,7 @@ using namespace mozilla::media; namespace mozilla { PRLogModuleInfo* GetDirectShowLog(); -#define LOG(...) PR_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) AudioSinkInputPin::AudioSinkInputPin(wchar_t* aObjectName, AudioSinkFilter* aFilter, diff --git a/dom/media/directshow/DirectShowReader.cpp b/dom/media/directshow/DirectShowReader.cpp index dbe50afa2b..41b056d502 100644 --- a/dom/media/directshow/DirectShowReader.cpp +++ b/dom/media/directshow/DirectShowReader.cpp @@ -28,7 +28,7 @@ GetDirectShowLog() { return log; } -#define LOG(...) PR_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) DirectShowReader::DirectShowReader(AbstractMediaDecoder* aDecoder) : MediaDecoderReader(aDecoder), diff --git a/dom/media/directshow/SampleSink.cpp b/dom/media/directshow/SampleSink.cpp index 56f3965776..54b62508d2 100644 --- a/dom/media/directshow/SampleSink.cpp +++ b/dom/media/directshow/SampleSink.cpp @@ -15,7 +15,7 @@ using namespace mozilla::media; namespace mozilla { PRLogModuleInfo* GetDirectShowLog(); -#define LOG(...) PR_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) SampleSink::SampleSink() : mMonitor("SampleSink"), @@ -65,7 +65,7 @@ SampleSink::Receive(IMediaSample* aSample) mon.Wait(); } - if (PR_LOG_TEST(GetDirectShowLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetDirectShowLog(), LogLevel::Debug)) { REFERENCE_TIME start = 0, end = 0; HRESULT hr = aSample->GetMediaTime(&start, &end); LOG("SampleSink::Receive() [%4.2lf-%4.2lf]", @@ -102,7 +102,7 @@ SampleSink::Extract(RefPtr& aOutSample) } aOutSample = mSample; - if (PR_LOG_TEST(GetDirectShowLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetDirectShowLog(), LogLevel::Debug)) { int64_t start = 0, end = 0; mSample->GetMediaTime(&start, &end); LOG("SampleSink::Extract() [%4.2lf-%4.2lf]", diff --git a/dom/media/directshow/SourceFilter.cpp b/dom/media/directshow/SourceFilter.cpp index 9cfaab4e40..f4dd75c8f8 100644 --- a/dom/media/directshow/SourceFilter.cpp +++ b/dom/media/directshow/SourceFilter.cpp @@ -21,7 +21,7 @@ namespace mozilla { #if defined (DEBUG_SOURCE_TRACE) PRLogModuleInfo* GetDirectShowLog(); -#define DIRECTSHOW_LOG(...) PR_LOG(GetDirectShowLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define DIRECTSHOW_LOG(...) MOZ_LOG(GetDirectShowLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #else #define DIRECTSHOW_LOG(...) #endif diff --git a/dom/media/encoder/MediaEncoder.cpp b/dom/media/encoder/MediaEncoder.cpp index 1f641af6f0..37bd1db144 100644 --- a/dom/media/encoder/MediaEncoder.cpp +++ b/dom/media/encoder/MediaEncoder.cpp @@ -32,7 +32,7 @@ #endif PRLogModuleInfo* gMediaEncoderLog; -#define LOG(type, msg) PR_LOG(gMediaEncoderLog, type, msg) +#define LOG(type, msg) MOZ_LOG(gMediaEncoderLog, type, msg) namespace mozilla { @@ -62,7 +62,7 @@ MediaEncoder::NotifyEvent(MediaStreamGraph* aGraph, MediaStreamListener::MediaStreamGraphEvent event) { // In case that MediaEncoder does not receive a TRACK_EVENT_ENDED event. - LOG(PR_LOG_DEBUG, ("NotifyRemoved in [MediaEncoder].")); + LOG(LogLevel::Debug, ("NotifyRemoved in [MediaEncoder].")); if (mAudioEncoder) { mAudioEncoder->NotifyEvent(aGraph, event); } @@ -89,7 +89,7 @@ MediaEncoder::CreateEncoder(const nsAString& aMIMEType, uint32_t aAudioBitrate, nsRefPtr encoder; nsString mimeType; if (!aTrackTypes) { - LOG(PR_LOG_ERROR, ("NO TrackTypes!!!")); + LOG(LogLevel::Error, ("NO TrackTypes!!!")); return nullptr; } #ifdef MOZ_WEBM_ENCODER @@ -140,10 +140,10 @@ MediaEncoder::CreateEncoder(const nsAString& aMIMEType, uint32_t aAudioBitrate, mimeType = NS_LITERAL_STRING(AUDIO_OGG); } else { - LOG(PR_LOG_ERROR, ("Can not find any encoder to record this media stream")); + LOG(LogLevel::Error, ("Can not find any encoder to record this media stream")); return nullptr; } - LOG(PR_LOG_DEBUG, ("Create encoder result:a[%d] v[%d] w[%d] mimeType = %s.", + LOG(LogLevel::Debug, ("Create encoder result:a[%d] v[%d] w[%d] mimeType = %s.", audioEncoder != nullptr, videoEncoder != nullptr, writer != nullptr, mimeType.get())); if (videoEncoder && aVideoBitrate != 0) { @@ -196,15 +196,15 @@ MediaEncoder::GetEncodedData(nsTArray >* aOutputBufs, while (reloop) { switch (mState) { case ENCODE_METADDATA: { - LOG(PR_LOG_DEBUG, ("ENCODE_METADDATA TimeStamp = %f", GetEncodeTimeStamp())); + LOG(LogLevel::Debug, ("ENCODE_METADDATA TimeStamp = %f", GetEncodeTimeStamp())); nsresult rv = CopyMetadataToMuxer(mAudioEncoder.get()); if (NS_FAILED(rv)) { - LOG(PR_LOG_ERROR, ("Error! Fail to Set Audio Metadata")); + LOG(LogLevel::Error, ("Error! Fail to Set Audio Metadata")); break; } rv = CopyMetadataToMuxer(mVideoEncoder.get()); if (NS_FAILED(rv)) { - LOG(PR_LOG_ERROR, ("Error! Fail to Set Video Metadata")); + LOG(LogLevel::Error, ("Error! Fail to Set Video Metadata")); break; } @@ -214,31 +214,31 @@ MediaEncoder::GetEncodedData(nsTArray >* aOutputBufs, mSizeOfBuffer = aOutputBufs->SizeOfExcludingThis(MallocSizeOf); } if (NS_FAILED(rv)) { - LOG(PR_LOG_ERROR,("Error! writer fail to generate header!")); + LOG(LogLevel::Error,("Error! writer fail to generate header!")); mState = ENCODE_ERROR; break; } - LOG(PR_LOG_DEBUG, ("Finish ENCODE_METADDATA TimeStamp = %f", GetEncodeTimeStamp())); + LOG(LogLevel::Debug, ("Finish ENCODE_METADDATA TimeStamp = %f", GetEncodeTimeStamp())); mState = ENCODE_TRACK; break; } case ENCODE_TRACK: { - LOG(PR_LOG_DEBUG, ("ENCODE_TRACK TimeStamp = %f", GetEncodeTimeStamp())); + LOG(LogLevel::Debug, ("ENCODE_TRACK TimeStamp = %f", GetEncodeTimeStamp())); EncodedFrameContainer encodedData; nsresult rv = NS_OK; rv = WriteEncodedDataToMuxer(mAudioEncoder.get()); if (NS_FAILED(rv)) { - LOG(PR_LOG_ERROR, ("Error! Fail to write audio encoder data to muxer")); + LOG(LogLevel::Error, ("Error! Fail to write audio encoder data to muxer")); break; } - LOG(PR_LOG_DEBUG, ("Audio encoded TimeStamp = %f", GetEncodeTimeStamp())); + LOG(LogLevel::Debug, ("Audio encoded TimeStamp = %f", GetEncodeTimeStamp())); rv = WriteEncodedDataToMuxer(mVideoEncoder.get()); if (NS_FAILED(rv)) { - LOG(PR_LOG_ERROR, ("Fail to write video encoder data to muxer")); + LOG(LogLevel::Error, ("Fail to write video encoder data to muxer")); break; } - LOG(PR_LOG_DEBUG, ("Video encoded TimeStamp = %f", GetEncodeTimeStamp())); + LOG(LogLevel::Debug, ("Video encoded TimeStamp = %f", GetEncodeTimeStamp())); // In audio only or video only case, let unavailable track's flag to be true. bool isAudioCompleted = (mAudioEncoder && mAudioEncoder->IsEncodingComplete()) || !mAudioEncoder; bool isVideoCompleted = (mVideoEncoder && mVideoEncoder->IsEncodingComplete()) || !mVideoEncoder; @@ -253,7 +253,7 @@ MediaEncoder::GetEncodedData(nsTArray >* aOutputBufs, reloop = false; } mState = (mWriter->IsWritingComplete()) ? ENCODE_DONE : ENCODE_TRACK; - LOG(PR_LOG_DEBUG, ("END ENCODE_TRACK TimeStamp = %f " + LOG(LogLevel::Debug, ("END ENCODE_TRACK TimeStamp = %f " "mState = %d aComplete %d vComplete %d", GetEncodeTimeStamp(), mState, isAudioCompleted, isVideoCompleted)); break; @@ -261,7 +261,7 @@ MediaEncoder::GetEncodedData(nsTArray >* aOutputBufs, case ENCODE_DONE: case ENCODE_ERROR: - LOG(PR_LOG_DEBUG, ("MediaEncoder has been shutdown.")); + LOG(LogLevel::Debug, ("MediaEncoder has been shutdown.")); mSizeOfBuffer = 0; mShutdown = true; reloop = false; @@ -289,7 +289,7 @@ MediaEncoder::WriteEncodedDataToMuxer(TrackEncoder *aTrackEncoder) nsresult rv = aTrackEncoder->GetEncodedTrack(encodedVideoData); if (NS_FAILED(rv)) { // Encoding might be canceled. - LOG(PR_LOG_ERROR, ("Error! Fail to get encoded data from video encoder.")); + LOG(LogLevel::Error, ("Error! Fail to get encoded data from video encoder.")); mState = ENCODE_ERROR; return rv; } @@ -297,7 +297,7 @@ MediaEncoder::WriteEncodedDataToMuxer(TrackEncoder *aTrackEncoder) aTrackEncoder->IsEncodingComplete() ? ContainerWriter::END_OF_STREAM : 0); if (NS_FAILED(rv)) { - LOG(PR_LOG_ERROR, ("Error! Fail to write encoded video track to the media container.")); + LOG(LogLevel::Error, ("Error! Fail to write encoded video track to the media container.")); mState = ENCODE_ERROR; } return rv; @@ -315,14 +315,14 @@ MediaEncoder::CopyMetadataToMuxer(TrackEncoder *aTrackEncoder) nsRefPtr meta = aTrackEncoder->GetMetadata(); if (meta == nullptr) { - LOG(PR_LOG_ERROR, ("Error! metadata = null")); + LOG(LogLevel::Error, ("Error! metadata = null")); mState = ENCODE_ERROR; return NS_ERROR_ABORT; } nsresult rv = mWriter->SetMetadata(meta); if (NS_FAILED(rv)) { - LOG(PR_LOG_ERROR, ("Error! SetMetadata fail")); + LOG(LogLevel::Error, ("Error! SetMetadata fail")); mState = ENCODE_ERROR; } return rv; diff --git a/dom/media/encoder/TrackEncoder.cpp b/dom/media/encoder/TrackEncoder.cpp index b7b28e925b..b00f1d0936 100644 --- a/dom/media/encoder/TrackEncoder.cpp +++ b/dom/media/encoder/TrackEncoder.cpp @@ -19,7 +19,7 @@ namespace mozilla { PRLogModuleInfo* gTrackEncoderLog; -#define TRACK_LOG(type, msg) PR_LOG(gTrackEncoderLog, type, msg) +#define TRACK_LOG(type, msg) MOZ_LOG(gTrackEncoderLog, type, msg) static const int DEFAULT_CHANNELS = 1; static const int DEFAULT_SAMPLING_RATE = 16000; @@ -58,7 +58,7 @@ AudioTrackEncoder::NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, // Check and initialize parameters for codec encoder. if (!mInitialized) { mAudioInitCounter++; - TRACK_LOG(PR_LOG_DEBUG, ("Init the audio encoder %d times", mAudioInitCounter)); + TRACK_LOG(LogLevel::Debug, ("Init the audio encoder %d times", mAudioInitCounter)); AudioSegment::ChunkIterator iter(const_cast(audio)); while (!iter.IsEnded()) { AudioChunk chunk = *iter; @@ -184,7 +184,7 @@ VideoTrackEncoder::NotifyQueuedTrackChanges(MediaStreamGraph* aGraph, // Check and initialize parameters for codec encoder. if (!mInitialized) { mVideoInitCounter++; - TRACK_LOG(PR_LOG_DEBUG, ("Init the video encoder %d times", mVideoInitCounter)); + TRACK_LOG(LogLevel::Debug, ("Init the video encoder %d times", mVideoInitCounter)); VideoSegment::ChunkIterator iter(const_cast(video)); while (!iter.IsEnded()) { VideoChunk chunk = *iter; diff --git a/dom/media/encoder/VP8TrackEncoder.cpp b/dom/media/encoder/VP8TrackEncoder.cpp index bcd5d35524..fd1c525ce8 100644 --- a/dom/media/encoder/VP8TrackEncoder.cpp +++ b/dom/media/encoder/VP8TrackEncoder.cpp @@ -16,7 +16,7 @@ namespace mozilla { PRLogModuleInfo* gVP8TrackEncoderLog; -#define VP8LOG(msg, ...) PR_LOG(gVP8TrackEncoderLog, PR_LOG_DEBUG, \ +#define VP8LOG(msg, ...) MOZ_LOG(gVP8TrackEncoderLog, mozilla::LogLevel::Debug, \ (msg, ##__VA_ARGS__)) // Debug logging macro with object pointer and class name. diff --git a/dom/media/encoder/VorbisTrackEncoder.cpp b/dom/media/encoder/VorbisTrackEncoder.cpp index ae922bbb5c..500408ef35 100644 --- a/dom/media/encoder/VorbisTrackEncoder.cpp +++ b/dom/media/encoder/VorbisTrackEncoder.cpp @@ -18,7 +18,7 @@ namespace mozilla { #undef LOG PRLogModuleInfo* gVorbisTrackEncoderLog; -#define VORBISLOG(msg, ...) PR_LOG(gVorbisTrackEncoderLog, PR_LOG_DEBUG, \ +#define VORBISLOG(msg, ...) MOZ_LOG(gVorbisTrackEncoderLog, mozilla::LogLevel::Debug, \ (msg, ##__VA_ARGS__)) VorbisTrackEncoder::VorbisTrackEncoder() diff --git a/dom/media/fmp4/MP4Reader.cpp b/dom/media/fmp4/MP4Reader.cpp index 87c6b61e93..f2822b1186 100644 --- a/dom/media/fmp4/MP4Reader.cpp +++ b/dom/media/fmp4/MP4Reader.cpp @@ -36,8 +36,8 @@ PRLogModuleInfo* GetDemuxerLog() { } return log; } -#define LOG(arg, ...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, ("MP4Reader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) -#define VLOG(arg, ...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, ("MP4Reader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define LOG(arg, ...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, ("MP4Reader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define VLOG(arg, ...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, ("MP4Reader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) using namespace mp4_demuxer; diff --git a/dom/media/gmp/GMPAudioDecoderParent.cpp b/dom/media/gmp/GMPAudioDecoderParent.cpp index eb923dd55a..b3f64491f5 100644 --- a/dom/media/gmp/GMPAudioDecoderParent.cpp +++ b/dom/media/gmp/GMPAudioDecoderParent.cpp @@ -19,8 +19,8 @@ namespace mozilla { extern PRLogModuleInfo* GetGMPLog(); -#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg) -#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg) +#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) +#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) namespace gmp { diff --git a/dom/media/gmp/GMPChild.cpp b/dom/media/gmp/GMPChild.cpp index 87da32a774..cade201dec 100644 --- a/dom/media/gmp/GMPChild.cpp +++ b/dom/media/gmp/GMPChild.cpp @@ -43,8 +43,8 @@ namespace mozilla { #undef LOGD extern PRLogModuleInfo* GetGMPLog(); -#define LOG(level, x, ...) PR_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__)) -#define LOGD(x, ...) LOG(PR_LOG_DEBUG, "GMPChild[pid=%d] " x, (int)base::GetCurrentProcId(), ##__VA_ARGS__) +#define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__)) +#define LOGD(x, ...) LOG(mozilla::LogLevel::Debug, "GMPChild[pid=%d] " x, (int)base::GetCurrentProcId(), ##__VA_ARGS__) namespace gmp { diff --git a/dom/media/gmp/GMPContentParent.cpp b/dom/media/gmp/GMPContentParent.cpp index f89b005aa6..0581984589 100644 --- a/dom/media/gmp/GMPContentParent.cpp +++ b/dom/media/gmp/GMPContentParent.cpp @@ -21,8 +21,8 @@ namespace mozilla { extern PRLogModuleInfo* GetGMPLog(); -#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg) -#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg) +#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) +#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) #ifdef __CLASS__ #undef __CLASS__ diff --git a/dom/media/gmp/GMPParent.cpp b/dom/media/gmp/GMPParent.cpp index cabe4580e6..08af177b37 100644 --- a/dom/media/gmp/GMPParent.cpp +++ b/dom/media/gmp/GMPParent.cpp @@ -35,8 +35,8 @@ namespace mozilla { #undef LOGD extern PRLogModuleInfo* GetGMPLog(); -#define LOG(level, x, ...) PR_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__)) -#define LOGD(x, ...) LOG(PR_LOG_DEBUG, "GMPParent[%p|childPid=%d] " x, this, mChildPid, ##__VA_ARGS__) +#define LOG(level, x, ...) MOZ_LOG(GetGMPLog(), (level), (x, ##__VA_ARGS__)) +#define LOGD(x, ...) LOG(mozilla::LogLevel::Debug, "GMPParent[%p|childPid=%d] " x, this, mChildPid, ##__VA_ARGS__) namespace gmp { diff --git a/dom/media/gmp/GMPService.cpp b/dom/media/gmp/GMPService.cpp index e93c2b10d3..006047f150 100644 --- a/dom/media/gmp/GMPService.cpp +++ b/dom/media/gmp/GMPService.cpp @@ -50,8 +50,8 @@ GetGMPLog() return sLog; } -#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg) -#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg) +#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) +#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) #ifdef __CLASS__ #undef __CLASS__ diff --git a/dom/media/gmp/GMPServiceChild.cpp b/dom/media/gmp/GMPServiceChild.cpp index ef4e457926..30370a1624 100644 --- a/dom/media/gmp/GMPServiceChild.cpp +++ b/dom/media/gmp/GMPServiceChild.cpp @@ -12,8 +12,8 @@ namespace mozilla { #undef LOG #endif -#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg) -#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg) +#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) +#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) #ifdef __CLASS__ #undef __CLASS__ diff --git a/dom/media/gmp/GMPServiceParent.cpp b/dom/media/gmp/GMPServiceParent.cpp index 20c738c690..f936ba84ce 100644 --- a/dom/media/gmp/GMPServiceParent.cpp +++ b/dom/media/gmp/GMPServiceParent.cpp @@ -40,8 +40,8 @@ namespace mozilla { #undef LOG #endif -#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg) -#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg) +#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) +#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) #ifdef __CLASS__ #undef __CLASS__ diff --git a/dom/media/gmp/GMPStorageParent.cpp b/dom/media/gmp/GMPStorageParent.cpp index ac5d96783d..c471214be0 100644 --- a/dom/media/gmp/GMPStorageParent.cpp +++ b/dom/media/gmp/GMPStorageParent.cpp @@ -28,8 +28,8 @@ namespace mozilla { extern PRLogModuleInfo* GetGMPLog(); -#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg) -#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg) +#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) +#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) #ifdef __CLASS__ #undef __CLASS__ diff --git a/dom/media/gmp/GMPTimerParent.cpp b/dom/media/gmp/GMPTimerParent.cpp index bac43c284e..2496564673 100644 --- a/dom/media/gmp/GMPTimerParent.cpp +++ b/dom/media/gmp/GMPTimerParent.cpp @@ -15,8 +15,8 @@ namespace mozilla { extern PRLogModuleInfo* GetGMPLog(); -#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg) -#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg) +#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) +#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) #ifdef __CLASS__ #undef __CLASS__ diff --git a/dom/media/gmp/GMPVideoDecoderParent.cpp b/dom/media/gmp/GMPVideoDecoderParent.cpp index ebad7f0828..9f9abb78e6 100644 --- a/dom/media/gmp/GMPVideoDecoderParent.cpp +++ b/dom/media/gmp/GMPVideoDecoderParent.cpp @@ -23,8 +23,8 @@ namespace mozilla { extern PRLogModuleInfo* GetGMPLog(); -#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg) -#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg) +#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) +#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) namespace gmp { @@ -241,7 +241,7 @@ GMPVideoDecoderParent::RecvDecoded(const GMPVideoi420FrameData& aDecodedFrame) } if (!GMPVideoi420FrameImpl::CheckFrameData(aDecodedFrame)) { - LOG(PR_LOG_ERROR, ("%s: Decoded frame corrupt, ignoring", __FUNCTION__)); + LOG(LogLevel::Error, ("%s: Decoded frame corrupt, ignoring", __FUNCTION__)); return false; } auto f = new GMPVideoi420FrameImpl(aDecodedFrame, &mVideoHost); @@ -357,7 +357,7 @@ GMPVideoDecoderParent::AnswerNeedShmem(const uint32_t& aFrameBufferSize, aFrameBufferSize, ipc::SharedMemory::TYPE_BASIC, &mem)) { - LOG(PR_LOG_ERROR, ("%s: Failed to get a shared mem buffer for Child! size %u", + LOG(LogLevel::Error, ("%s: Failed to get a shared mem buffer for Child! size %u", __FUNCTION__, aFrameBufferSize)); return false; } diff --git a/dom/media/gmp/GMPVideoEncoderParent.cpp b/dom/media/gmp/GMPVideoEncoderParent.cpp index a423160d4c..f473bba1cc 100644 --- a/dom/media/gmp/GMPVideoEncoderParent.cpp +++ b/dom/media/gmp/GMPVideoEncoderParent.cpp @@ -25,8 +25,8 @@ namespace mozilla { extern PRLogModuleInfo* GetGMPLog(); -#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg) -#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg) +#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) +#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) #ifdef __CLASS__ #undef __CLASS__ @@ -348,7 +348,7 @@ GMPVideoEncoderParent::AnswerNeedShmem(const uint32_t& aEncodedBufferSize, aEncodedBufferSize, ipc::SharedMemory::TYPE_BASIC, &mem)) { - LOG(PR_LOG_ERROR, ("%s::%s: Failed to get a shared mem buffer for Child! size %u", + LOG(LogLevel::Error, ("%s::%s: Failed to get a shared mem buffer for Child! size %u", __CLASS__, __FUNCTION__, aEncodedBufferSize)); return false; } diff --git a/dom/media/imagecapture/ImageCapture.h b/dom/media/imagecapture/ImageCapture.h index 492a995e1f..ea1039b3c2 100644 --- a/dom/media/imagecapture/ImageCapture.h +++ b/dom/media/imagecapture/ImageCapture.h @@ -15,7 +15,7 @@ namespace mozilla { #ifndef IC_LOG PRLogModuleInfo* GetICLog(); -#define IC_LOG(...) PR_LOG(GetICLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define IC_LOG(...) MOZ_LOG(GetICLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #endif namespace dom { diff --git a/dom/media/mediasource/ContainerParser.cpp b/dom/media/mediasource/ContainerParser.cpp index 810285a8ef..b2687e70ca 100644 --- a/dom/media/mediasource/ContainerParser.cpp +++ b/dom/media/mediasource/ContainerParser.cpp @@ -28,8 +28,8 @@ extern PRLogModuleInfo* GetMediaSourceLog(); #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) -#define MSE_DEBUG(name, arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, (TOSTRING(name) "(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) -#define MSE_DEBUGV(name, arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG + 1, (TOSTRING(name) "(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) +#define MSE_DEBUG(name, arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, (TOSTRING(name) "(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) +#define MSE_DEBUGV(name, arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, (TOSTRING(name) "(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/mediasource/MediaSource.cpp b/dom/media/mediasource/MediaSource.cpp index 8856e63075..f38f4097f3 100644 --- a/dom/media/mediasource/MediaSource.cpp +++ b/dom/media/mediasource/MediaSource.cpp @@ -49,8 +49,8 @@ PRLogModuleInfo* GetMediaSourceAPILog() return sLogModule; } -#define MSE_DEBUG(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("MediaSource(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) -#define MSE_API(arg, ...) PR_LOG(GetMediaSourceAPILog(), PR_LOG_DEBUG, ("MediaSource(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSource(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), mozilla::LogLevel::Debug, ("MediaSource(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) // Arbitrary limit. static const unsigned int MAX_SOURCE_BUFFERS = 16; diff --git a/dom/media/mediasource/MediaSourceDecoder.cpp b/dom/media/mediasource/MediaSourceDecoder.cpp index f306415931..5135378fc3 100644 --- a/dom/media/mediasource/MediaSourceDecoder.cpp +++ b/dom/media/mediasource/MediaSourceDecoder.cpp @@ -20,8 +20,8 @@ extern PRLogModuleInfo* GetMediaSourceLog(); -#define MSE_DEBUG(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) -#define MSE_DEBUGV(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG + 1, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("MediaSourceDecoder(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) using namespace mozilla::media; diff --git a/dom/media/mediasource/MediaSourceReader.cpp b/dom/media/mediasource/MediaSourceReader.cpp index f37f5ffa6c..af9cfb50be 100644 --- a/dom/media/mediasource/MediaSourceReader.cpp +++ b/dom/media/mediasource/MediaSourceReader.cpp @@ -29,8 +29,8 @@ extern PRLogModuleInfo* GetMediaSourceLog(); -#define MSE_DEBUG(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("MediaSourceReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) -#define MSE_DEBUGV(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG + 1, ("MediaSourceReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("MediaSourceReader(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) // When a stream hits EOS it needs to decide what other stream to switch to. Due // to inaccuracies is determining buffer end frames (Bug 1065207) and rounding diff --git a/dom/media/mediasource/MediaSourceResource.h b/dom/media/mediasource/MediaSourceResource.h index 529e58de72..b6736124bd 100644 --- a/dom/media/mediasource/MediaSourceResource.h +++ b/dom/media/mediasource/MediaSourceResource.h @@ -13,7 +13,7 @@ extern PRLogModuleInfo* GetMediaSourceLog(); -#define MSE_DEBUG(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("MediaSourceResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) +#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("MediaSourceResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) #define UNIMPLEMENTED() MSE_DEBUG("UNIMPLEMENTED FUNCTION at %s:%d", __FILE__, __LINE__) diff --git a/dom/media/mediasource/ResourceQueue.cpp b/dom/media/mediasource/ResourceQueue.cpp index ee4c69adbc..83f4ee0780 100644 --- a/dom/media/mediasource/ResourceQueue.cpp +++ b/dom/media/mediasource/ResourceQueue.cpp @@ -15,8 +15,8 @@ extern PRLogModuleInfo* GetSourceBufferResourceLog(); #define __func__ __FUNCTION__ #endif -#define SBR_DEBUG(arg, ...) PR_LOG(GetSourceBufferResourceLog(), PR_LOG_DEBUG, ("ResourceQueue(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) -#define SBR_DEBUGV(arg, ...) PR_LOG(GetSourceBufferResourceLog(), PR_LOG_DEBUG+1, ("ResourceQueue(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define SBR_DEBUG(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), mozilla::LogLevel::Debug, ("ResourceQueue(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define SBR_DEBUGV(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), mozilla::LogLevel::Verbose, ("ResourceQueue(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/mediasource/SourceBuffer.cpp b/dom/media/mediasource/SourceBuffer.cpp index 0535676cb7..b7d6be6697 100644 --- a/dom/media/mediasource/SourceBuffer.cpp +++ b/dom/media/mediasource/SourceBuffer.cpp @@ -29,9 +29,9 @@ class JSObject; extern PRLogModuleInfo* GetMediaSourceLog(); extern PRLogModuleInfo* GetMediaSourceAPILog(); -#define MSE_DEBUG(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) -#define MSE_DEBUGV(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG + 1, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) -#define MSE_API(arg, ...) PR_LOG(GetMediaSourceAPILog(), PR_LOG_DEBUG, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) +#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) +#define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) +#define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), mozilla::LogLevel::Debug, ("SourceBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/mediasource/SourceBufferDecoder.cpp b/dom/media/mediasource/SourceBufferDecoder.cpp index d9edcf0b55..69d1f33e92 100644 --- a/dom/media/mediasource/SourceBufferDecoder.cpp +++ b/dom/media/mediasource/SourceBufferDecoder.cpp @@ -16,7 +16,7 @@ extern PRLogModuleInfo* GetMediaSourceLog(); #define __func__ __FUNCTION__ #endif -#define MSE_DEBUG(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("SourceBufferDecoder(%p:%s)::%s: " arg, this, mResource->GetContentType().get(), __func__, ##__VA_ARGS__)) +#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("SourceBufferDecoder(%p:%s)::%s: " arg, this, mResource->GetContentType().get(), __func__, ##__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/mediasource/SourceBufferList.cpp b/dom/media/mediasource/SourceBufferList.cpp index 0b18a4f20c..71279e08e5 100644 --- a/dom/media/mediasource/SourceBufferList.cpp +++ b/dom/media/mediasource/SourceBufferList.cpp @@ -19,8 +19,8 @@ extern PRLogModuleInfo* GetMediaSourceLog(); extern PRLogModuleInfo* GetMediaSourceAPILog(); -#define MSE_API(arg, ...) PR_LOG(GetMediaSourceAPILog(), PR_LOG_DEBUG, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) -#define MSE_DEBUG(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define MSE_API(arg, ...) MOZ_LOG(GetMediaSourceAPILog(), mozilla::LogLevel::Debug, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("SourceBufferList(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) struct JSContext; class JSObject; diff --git a/dom/media/mediasource/SourceBufferResource.cpp b/dom/media/mediasource/SourceBufferResource.cpp index 04f76c2f03..797eb3fc3b 100644 --- a/dom/media/mediasource/SourceBufferResource.cpp +++ b/dom/media/mediasource/SourceBufferResource.cpp @@ -22,8 +22,8 @@ PRLogModuleInfo* GetSourceBufferResourceLog() return sLogModule; } -#define SBR_DEBUG(arg, ...) PR_LOG(GetSourceBufferResourceLog(), PR_LOG_DEBUG, ("SourceBufferResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) -#define SBR_DEBUGV(arg, ...) PR_LOG(GetSourceBufferResourceLog(), PR_LOG_DEBUG + 1, ("SourceBufferResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) +#define SBR_DEBUG(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), mozilla::LogLevel::Debug, ("SourceBufferResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) +#define SBR_DEBUGV(arg, ...) MOZ_LOG(GetSourceBufferResourceLog(), mozilla::LogLevel::Verbose, ("SourceBufferResource(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/mediasource/TrackBuffer.cpp b/dom/media/mediasource/TrackBuffer.cpp index 3cb5ac59d1..8deaed143c 100644 --- a/dom/media/mediasource/TrackBuffer.cpp +++ b/dom/media/mediasource/TrackBuffer.cpp @@ -24,7 +24,7 @@ extern PRLogModuleInfo* GetMediaSourceLog(); -#define MSE_DEBUG(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("TrackBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) +#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("TrackBuffer(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) // Time in seconds to substract from the current time when deciding the // time point to evict data before in a decoder. This is used to help diff --git a/dom/media/mediasource/TrackBuffersManager.cpp b/dom/media/mediasource/TrackBuffersManager.cpp index 5df57233c9..db85bedd2e 100644 --- a/dom/media/mediasource/TrackBuffersManager.cpp +++ b/dom/media/mediasource/TrackBuffersManager.cpp @@ -18,8 +18,8 @@ #ifdef PR_LOGGING extern PRLogModuleInfo* GetMediaSourceLog(); -#define MSE_DEBUG(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG, ("TrackBuffersManager(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) -#define MSE_DEBUGV(arg, ...) PR_LOG(GetMediaSourceLog(), PR_LOG_DEBUG + 1, ("TrackBuffersManager(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) +#define MSE_DEBUG(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Debug, ("TrackBuffersManager(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) +#define MSE_DEBUGV(arg, ...) MOZ_LOG(GetMediaSourceLog(), mozilla::LogLevel::Verbose, ("TrackBuffersManager(%p:%s)::%s: " arg, this, mType.get(), __func__, ##__VA_ARGS__)) #else #define MSE_DEBUG(...) #define MSE_DEBUGV(...) diff --git a/dom/media/ogg/OggCodecState.cpp b/dom/media/ogg/OggCodecState.cpp index dc133fb434..e0761d0fb7 100644 --- a/dom/media/ogg/OggCodecState.cpp +++ b/dom/media/ogg/OggCodecState.cpp @@ -33,7 +33,7 @@ namespace mozilla { extern PRLogModuleInfo* gMediaDecoderLog; -#define LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) /** Decoder base class for Ogg-encapsulated streams. */ OggCodecState* @@ -117,18 +117,18 @@ bool OggCodecState::AddVorbisComment(MetadataTags* aTags, { const char* div = (const char*)memchr(aComment, '=', aLength); if (!div) { - LOG(PR_LOG_DEBUG, ("Skipping comment: no separator")); + LOG(LogLevel::Debug, ("Skipping comment: no separator")); return false; } nsCString key = nsCString(aComment, div-aComment); if (!IsValidVorbisTagName(key)) { - LOG(PR_LOG_DEBUG, ("Skipping comment: invalid tag name")); + LOG(LogLevel::Debug, ("Skipping comment: invalid tag name")); return false; } uint32_t valueLength = aLength - (div-aComment); nsCString value = nsCString(div + 1, valueLength); if (!IsUTF8(value)) { - LOG(PR_LOG_DEBUG, ("Skipping comment: invalid UTF-8 in value")); + LOG(LogLevel::Debug, ("Skipping comment: invalid UTF-8 in value")); return false; } aTags->Put(key, value); @@ -835,7 +835,7 @@ nsresult OpusState::Reset(bool aStart) return NS_ERROR_FAILURE; } - LOG(PR_LOG_DEBUG, ("Opus decoder reset, to skip %d", mSkip)); + LOG(LogLevel::Debug, ("Opus decoder reset, to skip %d", mSkip)); return res; } @@ -858,7 +858,7 @@ bool OpusState::Init(void) mSkip = mParser->mPreSkip; - LOG(PR_LOG_DEBUG, ("Opus decoder init, to skip %d", mSkip)); + LOG(LogLevel::Debug, ("Opus decoder init, to skip %d", mSkip)); return error == OPUS_OK; } @@ -1187,7 +1187,7 @@ bool SkeletonState::DecodeIndex(ogg_packet* aPacket) int64_t timeDenom = LittleEndian::readInt64(aPacket->packet + INDEX_TIME_DENOM_OFFSET); if (timeDenom == 0) { - LOG(PR_LOG_DEBUG, ("Ogg Skeleton Index packet for stream %u has 0 " + LOG(LogLevel::Debug, ("Ogg Skeleton Index packet for stream %u has 0 " "timestamp denominator.", serialno)); return (mActive = false); } @@ -1230,7 +1230,7 @@ bool SkeletonState::DecodeIndex(ogg_packet* aPacket) // possibly contain as many packets as it claims to, so the numKeyPoints // field is possibly malicious. Don't try decoding this index, we may run // out of memory. - LOG(PR_LOG_DEBUG, ("Possibly malicious number of key points reported " + LOG(LogLevel::Debug, ("Possibly malicious number of key points reported " "(%lld) in index packet for stream %u.", numKeyPoints, serialno)); @@ -1278,7 +1278,7 @@ bool SkeletonState::DecodeIndex(ogg_packet* aPacket) mIndex.Put(serialno, keyPoints.forget()); } - LOG(PR_LOG_DEBUG, ("Loaded %d keypoints for Skeleton on stream %u", + LOG(LogLevel::Debug, ("Loaded %d keypoints for Skeleton on stream %u", keyPointsRead, serialno)); return true; } @@ -1342,7 +1342,7 @@ nsresult SkeletonState::IndexedSeekTarget(int64_t aTarget, if (r.IsNull()) { return NS_ERROR_FAILURE; } - LOG(PR_LOG_DEBUG, ("Indexed seek target for time %lld is offset %lld", + LOG(LogLevel::Debug, ("Indexed seek target for time %lld is offset %lld", aTarget, r.mKeyPoint.mOffset)); aResult = r; return NS_OK; @@ -1482,7 +1482,7 @@ bool SkeletonState::DecodeHeader(ogg_packet* aPacket) // Extract the segment length. mLength = LittleEndian::readInt64(aPacket->packet + SKELETON_FILE_LENGTH_OFFSET); - LOG(PR_LOG_DEBUG, ("Skeleton segment length: %lld", mLength)); + LOG(LogLevel::Debug, ("Skeleton segment length: %lld", mLength)); // Initialize the serialno-to-index map. return true; diff --git a/dom/media/ogg/OggReader.cpp b/dom/media/ogg/OggReader.cpp index 25f8a2457c..8221a3e122 100644 --- a/dom/media/ogg/OggReader.cpp +++ b/dom/media/ogg/OggReader.cpp @@ -38,9 +38,9 @@ namespace mozilla { //#define SEEK_LOGGING extern PRLogModuleInfo* gMediaDecoderLog; -#define LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) #ifdef SEEK_LOGGING -#define SEEK_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define SEEK_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) #else #define SEEK_LOG(type, msg) #endif @@ -290,7 +290,7 @@ void OggReader::SetupTargetSkeleton(SkeletonState* aSkeletonState) BuildSerialList(tracks); int64_t duration = 0; if (NS_SUCCEEDED(aSkeletonState->GetDuration(tracks, duration))) { - LOG(PR_LOG_DEBUG, ("Got duration from Skeleton index %lld", duration)); + LOG(LogLevel::Debug, ("Got duration from Skeleton index %lld", duration)); mInfo.mMetadataDuration.emplace(TimeUnit::FromMicroseconds(duration)); } } @@ -490,7 +490,7 @@ nsresult OggReader::ReadMetadata(MediaInfo* aInfo, } if (endTime != -1) { mInfo.mMetadataEndTime.emplace(TimeUnit::FromMicroseconds(endTime)); - LOG(PR_LOG_DEBUG, ("Got Ogg duration from seeking to end %lld", endTime)); + LOG(LogLevel::Debug, ("Got Ogg duration from seeking to end %lld", endTime)); } } } else { @@ -611,7 +611,7 @@ nsresult OggReader::DecodeOpus(ogg_packet* aPacket) { if (skipFrames == frames) { // discard the whole packet mOpusState->mSkip -= frames; - LOG(PR_LOG_DEBUG, ("Opus decoder skipping %d frames" + LOG(LogLevel::Debug, ("Opus decoder skipping %d frames" " (whole packet)", frames)); return NS_OK; } @@ -626,7 +626,7 @@ nsresult OggReader::DecodeOpus(ogg_packet* aPacket) { buffer = trimBuffer; mOpusState->mSkip -= skipFrames; - LOG(PR_LOG_DEBUG, ("Opus decoder skipping %d frames", skipFrames)); + LOG(LogLevel::Debug, ("Opus decoder skipping %d frames", skipFrames)); } // Save this packet's granule position in case we need to perform end // trimming on the next packet. @@ -657,7 +657,7 @@ nsresult OggReader::DecodeOpus(ogg_packet* aPacket) { return NS_ERROR_FAILURE; } - LOG(PR_LOG_DEBUG, ("Opus decoder pushing %d frames", frames)); + LOG(LogLevel::Debug, ("Opus decoder pushing %d frames", frames)); int64_t startTime = mOpusState->Time(startFrame); int64_t endTime = mOpusState->Time(endFrame); mAudioQueue.Push(new AudioData(mDecoder->GetResource()->Tell(), @@ -785,7 +785,7 @@ bool OggReader::ReadOggChain() (mVorbisState->mInfo.channels == newVorbisState->mInfo.channels)) { SetupTargetVorbis(newVorbisState); - LOG(PR_LOG_DEBUG, ("New vorbis ogg link, serial=%d\n", mVorbisSerial)); + LOG(LogLevel::Debug, ("New vorbis ogg link, serial=%d\n", mVorbisSerial)); if (msgInfo) { InitTrack(TrackInfo::kAudioTrack, msgInfo, &mInfo.mAudio, true); @@ -1290,7 +1290,7 @@ OggReader::IndexedSeekResult OggReader::SeekToKeyframeUsingIndex(int64_t aTarget // Index must be invalid. return RollbackIndexedSeek(tell); } - LOG(PR_LOG_DEBUG, ("Seeking using index to keyframe at offset %lld\n", + LOG(LogLevel::Debug, ("Seeking using index to keyframe at offset %lld\n", keyframe.mKeyPoint.mOffset)); nsresult res = resource->Seek(nsISeekableStream::NS_SEEK_SET, keyframe.mKeyPoint.mOffset); @@ -1313,7 +1313,7 @@ OggReader::IndexedSeekResult OggReader::SeekToKeyframeUsingIndex(int64_t aTarget skippedBytes); NS_ENSURE_TRUE(syncres != PAGE_SYNC_ERROR, SEEK_FATAL_ERROR); if (syncres != PAGE_SYNC_OK || skippedBytes != 0) { - LOG(PR_LOG_DEBUG, ("Indexed-seek failure: Ogg Skeleton Index is invalid " + LOG(LogLevel::Debug, ("Indexed-seek failure: Ogg Skeleton Index is invalid " "or sync error after seek")); return RollbackIndexedSeek(tell); } @@ -1342,7 +1342,7 @@ nsresult OggReader::SeekInBufferedRange(int64_t aTarget, const nsTArray& aRanges, const SeekRange& aRange) { - LOG(PR_LOG_DEBUG, ("%p Seeking in buffered data to %lld using bisection search", mDecoder, aTarget)); + LOG(LogLevel::Debug, ("%p Seeking in buffered data to %lld using bisection search", mDecoder, aTarget)); nsresult res = NS_OK; if (HasVideo() || aAdjustedTarget >= aTarget) { // We know the exact byte range in which the target must lie. It must @@ -1375,7 +1375,7 @@ nsresult OggReader::SeekInBufferedRange(int64_t aTarget, int shift = mTheoraState->mInfo.keyframe_granule_shift; int64_t keyframeGranulepos = (video->mTimecode >> shift) << shift; int64_t keyframeTime = mTheoraState->StartTime(keyframeGranulepos); - SEEK_LOG(PR_LOG_DEBUG, ("Keyframe for %lld is at %lld, seeking back to it", + SEEK_LOG(LogLevel::Debug, ("Keyframe for %lld is at %lld, seeking back to it", video->mTime, keyframeTime)); aAdjustedTarget = std::min(aAdjustedTarget, keyframeTime); } @@ -1396,7 +1396,7 @@ nsresult OggReader::SeekInUnbuffered(int64_t aTarget, int64_t aEndTime, const nsTArray& aRanges) { - LOG(PR_LOG_DEBUG, ("%p Seeking in unbuffered data to %lld using bisection search", mDecoder, aTarget)); + LOG(LogLevel::Debug, ("%p Seeking in unbuffered data to %lld using bisection search", mDecoder, aTarget)); // If we've got an active Theora bitstream, determine the maximum possible // time in usecs which a keyframe could be before a given interframe. We @@ -1441,7 +1441,7 @@ nsresult OggReader::SeekInternal(int64_t aTarget, int64_t aEndTime) MOZ_ASSERT(OnTaskQueue()); if (mIsChained) return NS_ERROR_FAILURE; - LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget)); + LOG(LogLevel::Debug, ("%p About to seek to %lld", mDecoder, aTarget)); nsresult res; MediaResource* resource = mDecoder->GetResource(); NS_ENSURE_TRUE(resource != nullptr, NS_ERROR_FAILURE); @@ -1655,7 +1655,7 @@ nsresult OggReader::SeekBisection(int64_t aTarget, // Our interval is empty, we've found the optimal seek point, as the // page at the start offset is before the seek target, and the page // at the end offset is after the seek target. - SEEK_LOG(PR_LOG_DEBUG, ("Interval narrowed, terminating bisection.")); + SEEK_LOG(LogLevel::Debug, ("Interval narrowed, terminating bisection.")); break; } @@ -1670,7 +1670,7 @@ nsresult OggReader::SeekBisection(int64_t aTarget, // probably because we ran out of data to decode. This usually happens // when we guess very close to the end offset. So reduce the guess // offset using an exponential backoff until we determine the time. - SEEK_LOG(PR_LOG_DEBUG, ("Backing off %d bytes, backsteps=%d", + SEEK_LOG(LogLevel::Debug, ("Backing off %d bytes, backsteps=%d", static_cast(PAGE_STEP * pow(2.0, backsteps)), backsteps)); guess -= PAGE_STEP * static_cast(pow(2.0, backsteps)); @@ -1693,7 +1693,7 @@ nsresult OggReader::SeekBisection(int64_t aTarget, } guess = std::max(guess, startOffset + startLength); - SEEK_LOG(PR_LOG_DEBUG, ("Seek loop start[o=%lld..%lld t=%lld] " + SEEK_LOG(LogLevel::Debug, ("Seek loop start[o=%lld..%lld t=%lld] " "end[o=%lld t=%lld] " "interval=%lld target=%lf guess=%lld", startOffset, (startOffset+startLength), startTime, @@ -1723,7 +1723,7 @@ nsresult OggReader::SeekBisection(int64_t aTarget, // page. Backoff exponentially from the end point, in case the last // page/frame/sample is huge. mustBackoff = true; - SEEK_LOG(PR_LOG_DEBUG, ("Hit the end of range, backing off")); + SEEK_LOG(LogLevel::Debug, ("Hit the end of range, backing off")); continue; } @@ -1806,7 +1806,7 @@ nsresult OggReader::SeekBisection(int64_t aTarget, if (interval == 0) { // Seek termination condition; we've found the page boundary of the // last page before the target, and the first page after the target. - SEEK_LOG(PR_LOG_DEBUG, ("Terminating seek at offset=%lld", startOffset)); + SEEK_LOG(LogLevel::Debug, ("Terminating seek at offset=%lld", startOffset)); NS_ASSERTION(startTime < aTarget, "Start time must always be less than target"); res = resource->Seek(nsISeekableStream::NS_SEEK_SET, startOffset); NS_ENSURE_SUCCESS(res,res); @@ -1816,7 +1816,7 @@ nsresult OggReader::SeekBisection(int64_t aTarget, break; } - SEEK_LOG(PR_LOG_DEBUG, ("Time at offset %lld is %lld", guess, granuleTime)); + SEEK_LOG(LogLevel::Debug, ("Time at offset %lld is %lld", guess, granuleTime)); if (granuleTime < seekTarget && granuleTime > seekLowerBound) { // We're within the fuzzy region in which we want to terminate the search. res = resource->Seek(nsISeekableStream::NS_SEEK_SET, pageOffset); @@ -1824,7 +1824,7 @@ nsresult OggReader::SeekBisection(int64_t aTarget, if (NS_FAILED(ResetDecode())) { return NS_ERROR_FAILURE; } - SEEK_LOG(PR_LOG_DEBUG, ("Terminating seek at offset=%lld", pageOffset)); + SEEK_LOG(LogLevel::Debug, ("Terminating seek at offset=%lld", pageOffset)); break; } @@ -1845,7 +1845,7 @@ nsresult OggReader::SeekBisection(int64_t aTarget, NS_ASSERTION(endTime >= seekTarget, "End must be after seek target"); } - SEEK_LOG(PR_LOG_DEBUG, ("Seek complete in %d bisections.", hops)); + SEEK_LOG(LogLevel::Debug, ("Seek complete in %d bisections.", hops)); return NS_OK; } @@ -1982,14 +1982,14 @@ VideoData* OggReader::FindStartTime(int64_t& aOutStartTime) videoData = DecodeToFirstVideoData(); if (videoData) { videoStartTime = videoData->mTime; - LOG(PR_LOG_DEBUG, ("OggReader::FindStartTime() video=%lld", videoStartTime)); + LOG(LogLevel::Debug, ("OggReader::FindStartTime() video=%lld", videoStartTime)); } } if (HasAudio()) { AudioData* audioData = DecodeToFirstAudioData(); if (audioData) { audioStartTime = audioData->mTime; - LOG(PR_LOG_DEBUG, ("OggReader::FindStartTime() audio=%lld", audioStartTime)); + LOG(LogLevel::Debug, ("OggReader::FindStartTime() audio=%lld", audioStartTime)); } } diff --git a/dom/media/ogg/OpusParser.cpp b/dom/media/ogg/OpusParser.cpp index aab3298634..8bdaf7f550 100644 --- a/dom/media/ogg/OpusParser.cpp +++ b/dom/media/ogg/OpusParser.cpp @@ -25,7 +25,7 @@ extern "C" { namespace mozilla { extern PRLogModuleInfo* gMediaDecoderLog; -#define OPUS_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define OPUS_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) OpusParser::OpusParser(): mRate(0), @@ -45,7 +45,7 @@ OpusParser::OpusParser(): bool OpusParser::DecodeHeader(unsigned char* aData, size_t aLength) { if (aLength < 19 || memcmp(aData, "OpusHead", 8)) { - OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: unrecognized header")); + OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: unrecognized header")); return false; } @@ -54,13 +54,13 @@ bool OpusParser::DecodeHeader(unsigned char* aData, size_t aLength) int version = aData[8]; // Accept file format versions 0.x. if ((version & 0xf0) != 0) { - OPUS_LOG(PR_LOG_DEBUG, ("Rejecting unknown Opus file version %d", version)); + OPUS_LOG(LogLevel::Debug, ("Rejecting unknown Opus file version %d", version)); return false; } mChannels = aData[9]; if (mChannels<1) { - OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: Number of channels %d", mChannels)); + OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: Number of channels %d", mChannels)); return false; } @@ -78,7 +78,7 @@ bool OpusParser::DecodeHeader(unsigned char* aData, size_t aLength) if (mChannelMapping == 0) { // Mapping family 0 only allows two channels if (mChannels>2) { - OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: too many channels (%d) for" + OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: too many channels (%d) for" " mapping family 0.", mChannels)); return false; } @@ -89,7 +89,7 @@ bool OpusParser::DecodeHeader(unsigned char* aData, size_t aLength) } else if (mChannelMapping == 1) { // Currently only up to 8 channels are defined for mapping family 1 if (mChannels>8) { - OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: too many channels (%d) for" + OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: too many channels (%d) for" " mapping family 1.", mChannels)); return false; } @@ -100,34 +100,34 @@ bool OpusParser::DecodeHeader(unsigned char* aData, size_t aLength) for (i=0; i mStreams) { - OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: more coupled streams (%d) than " + OPUS_LOG(LogLevel::Debug, ("Invalid Opus file: more coupled streams (%d) than " "total streams (%d)", mCoupledStreams, mStreams)); return false; } #ifdef DEBUG - OPUS_LOG(PR_LOG_DEBUG, ("Opus stream header:")); - OPUS_LOG(PR_LOG_DEBUG, (" channels: %d", mChannels)); - OPUS_LOG(PR_LOG_DEBUG, (" preskip: %d", mPreSkip)); - OPUS_LOG(PR_LOG_DEBUG, (" original: %d Hz", mNominalRate)); - OPUS_LOG(PR_LOG_DEBUG, (" gain: %.2f dB", gain_dB)); - OPUS_LOG(PR_LOG_DEBUG, ("Channel Mapping:")); - OPUS_LOG(PR_LOG_DEBUG, (" family: %d", mChannelMapping)); - OPUS_LOG(PR_LOG_DEBUG, (" streams: %d", mStreams)); + OPUS_LOG(LogLevel::Debug, ("Opus stream header:")); + OPUS_LOG(LogLevel::Debug, (" channels: %d", mChannels)); + OPUS_LOG(LogLevel::Debug, (" preskip: %d", mPreSkip)); + OPUS_LOG(LogLevel::Debug, (" original: %d Hz", mNominalRate)); + OPUS_LOG(LogLevel::Debug, (" gain: %.2f dB", gain_dB)); + OPUS_LOG(LogLevel::Debug, ("Channel Mapping:")); + OPUS_LOG(LogLevel::Debug, (" family: %d", mChannelMapping)); + OPUS_LOG(LogLevel::Debug, (" streams: %d", mStreams)); #endif return true; } @@ -180,10 +180,10 @@ bool OpusParser::DecodeTags(unsigned char* aData, size_t aLength) } #ifdef DEBUG - OPUS_LOG(PR_LOG_DEBUG, ("Opus metadata header:")); - OPUS_LOG(PR_LOG_DEBUG, (" vendor: %s", mVendorString.get())); + OPUS_LOG(LogLevel::Debug, ("Opus metadata header:")); + OPUS_LOG(LogLevel::Debug, (" vendor: %s", mVendorString.get())); for (uint32_t i = 0; i < mTags.Length(); i++) { - OPUS_LOG(PR_LOG_DEBUG, (" %s", mTags[i].get())); + OPUS_LOG(LogLevel::Debug, (" %s", mTags[i].get())); } #endif return true; diff --git a/dom/media/omx/AudioOffloadPlayer.cpp b/dom/media/omx/AudioOffloadPlayer.cpp index f4f948210e..7409ebb77e 100644 --- a/dom/media/omx/AudioOffloadPlayer.cpp +++ b/dom/media/omx/AudioOffloadPlayer.cpp @@ -44,7 +44,7 @@ namespace mozilla { PRLogModuleInfo* gAudioOffloadPlayerLog; #define AUDIO_OFFLOAD_LOG(type, msg) \ - PR_LOG(gAudioOffloadPlayerLog, type, msg) + MOZ_LOG(gAudioOffloadPlayerLog, type, msg) // maximum time in paused state when offloading audio decompression. // When elapsed, the GonkAudioSink is destroyed to allow the audio DSP to power down. @@ -135,7 +135,7 @@ status_t AudioOffloadPlayer::Start(bool aSourceAlreadyStarted) } if (mapMimeToAudioFormat(audioFormat, mime) != OK) { - AUDIO_OFFLOAD_LOG(PR_LOG_ERROR, ("Couldn't map mime type \"%s\" to a valid " + AUDIO_OFFLOAD_LOG(LogLevel::Error, ("Couldn't map mime type \"%s\" to a valid " "AudioSystem::audio_format", mime)); audioFormat = AUDIO_FORMAT_INVALID; } @@ -149,7 +149,7 @@ status_t AudioOffloadPlayer::Start(bool aSourceAlreadyStarted) offloadInfo.has_video = false; offloadInfo.is_streaming = false; - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("isOffloadSupported: SR=%u, CM=0x%x, " + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("isOffloadSupported: SR=%u, CM=0x%x, " "Format=0x%x, StreamType=%d, BitRate=%u, duration=%lld us, has_video=%d", offloadInfo.sample_rate, offloadInfo.channel_mask, offloadInfo.format, offloadInfo.stream_type, offloadInfo.bit_rate, offloadInfo.duration_us, @@ -210,7 +210,7 @@ status_t AudioOffloadPlayer::ChangeState(MediaDecoder::PlayState aState) static void ResetCallback(nsITimer* aTimer, void* aClosure) { - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __FUNCTION__)); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("%s", __FUNCTION__)); AudioOffloadPlayer* player = static_cast(aClosure); if (player) { player->Reset(); @@ -291,7 +291,7 @@ void AudioOffloadPlayer::Reset() CHECK(mAudioSink.get()); - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("reset: mPlaying=%d mReachedEOS=%d", + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("reset: mPlaying=%d mReachedEOS=%d", mPlaying, mReachedEOS)); mAudioSink->Stop(); @@ -313,7 +313,7 @@ void AudioOffloadPlayer::Reset() // source is able to stop(). if (mInputBuffer) { - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Releasing input buffer")); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Releasing input buffer")); mInputBuffer->release(); mInputBuffer = nullptr; @@ -349,7 +349,7 @@ status_t AudioOffloadPlayer::DoSeek() MOZ_ASSERT(mSeekTarget.IsValid()); CHECK(mAudioSink.get()); - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("DoSeek ( %lld )", mSeekTarget.mTime)); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("DoSeek ( %lld )", mSeekTarget.mTime)); mReachedEOS = false; mPositionTimeMediaUs = -1; @@ -375,7 +375,7 @@ status_t AudioOffloadPlayer::DoSeek() } if (!mSeekPromise.IsEmpty()) { - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Fake seek complete during pause")); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Fake seek complete during pause")); // We do not reset mSeekTarget here. MediaDecoder::SeekResolveValue val(mReachedEOS, mSeekTarget.mEventVisibility); mSeekPromise.Resolve(val, __func__); @@ -475,23 +475,23 @@ size_t AudioOffloadPlayer::AudioSinkCallback(GonkAudioSink* aAudioSink, switch (aEvent) { case GonkAudioSink::CB_EVENT_FILL_BUFFER: - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Notify Audio position changed")); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Notify Audio position changed")); me->NotifyPositionChanged(); return me->FillBuffer(aBuffer, aSize); case GonkAudioSink::CB_EVENT_STREAM_END: - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Notify Audio EOS")); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Notify Audio EOS")); me->mReachedEOS = true; me->NotifyAudioEOS(); break; case GonkAudioSink::CB_EVENT_TEAR_DOWN: - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Notify Tear down event")); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Notify Tear down event")); me->NotifyAudioTearDown(); break; default: - AUDIO_OFFLOAD_LOG(PR_LOG_ERROR, ("Unknown event %d from audio sink", + AUDIO_OFFLOAD_LOG(LogLevel::Error, ("Unknown event %d from audio sink", aEvent)); break; } @@ -541,7 +541,7 @@ size_t AudioOffloadPlayer::FillBuffer(void* aData, size_t aSize) if (mSeekTarget.IsValid()) { mSeekTarget.Reset(); } - AUDIO_OFFLOAD_LOG(PR_LOG_ERROR, ("Error while reading media source %d " + AUDIO_OFFLOAD_LOG(LogLevel::Error, ("Error while reading media source %d " "Ok to receive EOS error at end", err)); if (!mReachedEOS) { // After seek there is a possible race condition if @@ -553,8 +553,8 @@ size_t AudioOffloadPlayer::FillBuffer(void* aData, size_t aSize) // there will be an unnecessary call to the parser // after parser signalled EOS. if (sizeDone > 0) { - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("send Partial buffer down")); - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("skip calling stop till next" + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("send Partial buffer down")); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("skip calling stop till next" " fillBuffer")); break; } @@ -574,12 +574,12 @@ size_t AudioOffloadPlayer::FillBuffer(void* aData, size_t aSize) MOZ_ASSERT(mSeekTarget.IsValid()); mSeekTarget.Reset(); if (!mSeekPromise.IsEmpty()) { - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("FillBuffer posting SEEK_COMPLETE")); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("FillBuffer posting SEEK_COMPLETE")); MediaDecoder::SeekResolveValue val(mReachedEOS, mSeekTarget.mEventVisibility); mSeekPromise.Resolve(val, __func__); } } else if (mSeekTarget.IsValid()) { - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("seek is updated during unlocking mLock")); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("seek is updated during unlocking mLock")); } if (refreshSeekTime) { @@ -588,7 +588,7 @@ size_t AudioOffloadPlayer::FillBuffer(void* aData, size_t aSize) // need to adjust the mStartPosUs for offload decoding since parser // might not be able to get the exact seek time requested. mStartPosUs = mPositionTimeMediaUs; - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Adjust seek time to: %.2f", + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Adjust seek time to: %.2f", mStartPosUs / 1E6)); } } @@ -622,7 +622,7 @@ void AudioOffloadPlayer::SetElementVisibility(bool aIsVisible) MOZ_ASSERT(NS_IsMainThread()); mIsElementVisible = aIsVisible; if (mIsElementVisible) { - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Element is visible. Start time update")); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Element is visible. Start time update")); StartTimeUpdate(); } } @@ -718,7 +718,7 @@ void AudioOffloadPlayer::SendMetaDataToHal(sp& aSink, param.addInt(String8(AUDIO_OFFLOAD_CODEC_PADDING_SAMPLES), paddingSamples); } - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("SendMetaDataToHal: bitRate %d," + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("SendMetaDataToHal: bitRate %d," " sampleRate %d, chanMask %d, delaySample %d, paddingSample %d", bitRate, sampleRate, channelMask, delaySamples, paddingSamples)); @@ -736,7 +736,7 @@ void AudioOffloadPlayer::SetVolume(double aVolume) void AudioOffloadPlayer::WakeLockCreate() { MOZ_ASSERT(NS_IsMainThread()); - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __FUNCTION__)); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("%s", __FUNCTION__)); if (!mWakeLock) { nsRefPtr pmService = dom::power::PowerManagerService::GetInstance(); @@ -750,7 +750,7 @@ void AudioOffloadPlayer::WakeLockCreate() void AudioOffloadPlayer::WakeLockRelease() { MOZ_ASSERT(NS_IsMainThread()); - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __FUNCTION__)); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("%s", __FUNCTION__)); if (mWakeLock) { ErrorResult rv; mWakeLock->Unlock(rv); diff --git a/dom/media/omx/AudioOutput.cpp b/dom/media/omx/AudioOutput.cpp index f11935a5b9..9754da32b3 100644 --- a/dom/media/omx/AudioOutput.cpp +++ b/dom/media/omx/AudioOutput.cpp @@ -20,13 +20,13 @@ #include #include "AudioOutput.h" -#include "prlog.h" +#include "mozilla/Logging.h" namespace mozilla { extern PRLogModuleInfo* gAudioOffloadPlayerLog; #define AUDIO_OFFLOAD_LOG(type, msg) \ - PR_LOG(gAudioOffloadPlayerLog, type, msg) + MOZ_LOG(gAudioOffloadPlayerLog, type, msg) using namespace android; @@ -96,13 +96,13 @@ status_t AudioOutput::Open(uint32_t aSampleRate, return BAD_VALUE; } - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("open(%u, %d, 0x%x, 0x%x, %d 0x%x)", + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("open(%u, %d, 0x%x, 0x%x, %d 0x%x)", aSampleRate, aChannelCount, aChannelMask, aFormat, mSessionId, aFlags)); if (aChannelMask == CHANNEL_MASK_USE_CHANNEL_ORDER) { aChannelMask = audio_channel_out_mask_from_count(aChannelCount); if (0 == aChannelMask) { - AUDIO_OFFLOAD_LOG(PR_LOG_ERROR, ("open() error, can\'t derive mask for" + AUDIO_OFFLOAD_LOG(LogLevel::Error, ("open() error, can\'t derive mask for" " %d audio channels", aChannelCount)); return NO_INIT; } @@ -127,7 +127,7 @@ status_t AudioOutput::Open(uint32_t aSampleRate, mUid); if ((!t.get()) || (t->initCheck() != NO_ERROR)) { - AUDIO_OFFLOAD_LOG(PR_LOG_ERROR, ("Unable to create audio track")); + AUDIO_OFFLOAD_LOG(LogLevel::Error, ("Unable to create audio track")); delete newcbd; return NO_INIT; } @@ -141,7 +141,7 @@ status_t AudioOutput::Open(uint32_t aSampleRate, status_t AudioOutput::Start() { - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __PRETTY_FUNCTION__)); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("%s", __PRETTY_FUNCTION__)); if (!mTrack.get()) { return NO_INIT; } @@ -151,7 +151,7 @@ status_t AudioOutput::Start() void AudioOutput::Stop() { - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __PRETTY_FUNCTION__)); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("%s", __PRETTY_FUNCTION__)); if (mTrack.get()) { mTrack->stop(); } @@ -173,7 +173,7 @@ void AudioOutput::Pause() void AudioOutput::Close() { - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("%s", __PRETTY_FUNCTION__)); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("%s", __PRETTY_FUNCTION__)); mTrack.clear(); delete mCallbackData; @@ -215,19 +215,19 @@ void AudioOutput::CallbackWrapper(int aEvent, void* aCookie, void* aInfo) } break; case AudioTrack::EVENT_STREAM_END: - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Callback wrapper: EVENT_STREAM_END")); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Callback wrapper: EVENT_STREAM_END")); (*me->mCallback)(me, nullptr /* buffer */, 0 /* size */, me->mCallbackCookie, CB_EVENT_STREAM_END); break; case AudioTrack::EVENT_NEW_IAUDIOTRACK : - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("Callback wrapper: EVENT_TEAR_DOWN")); + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("Callback wrapper: EVENT_TEAR_DOWN")); (*me->mCallback)(me, nullptr /* buffer */, 0 /* size */, me->mCallbackCookie, CB_EVENT_TEAR_DOWN); break; default: - AUDIO_OFFLOAD_LOG(PR_LOG_DEBUG, ("received unknown event type: %d in" + AUDIO_OFFLOAD_LOG(LogLevel::Debug, ("received unknown event type: %d in" " Callback wrapper!", aEvent)); break; } diff --git a/dom/media/omx/I420ColorConverterHelper.cpp b/dom/media/omx/I420ColorConverterHelper.cpp index 2ea6bef8ca..8afcbc4cb0 100644 --- a/dom/media/omx/I420ColorConverterHelper.cpp +++ b/dom/media/omx/I420ColorConverterHelper.cpp @@ -11,7 +11,7 @@ #include "mozilla/Logging.h" PRLogModuleInfo *gI420ColorConverterHelperLog; -#define LOG(msg...) PR_LOG(gI420ColorConverterHelperLog, PR_LOG_WARNING, (msg)) +#define LOG(msg...) MOZ_LOG(gI420ColorConverterHelperLog, mozilla::LogLevel::Warning, (msg)) namespace android { diff --git a/dom/media/omx/MediaOmxCommonDecoder.cpp b/dom/media/omx/MediaOmxCommonDecoder.cpp index 3293ce2360..7e5311e61b 100644 --- a/dom/media/omx/MediaOmxCommonDecoder.cpp +++ b/dom/media/omx/MediaOmxCommonDecoder.cpp @@ -21,7 +21,7 @@ using namespace android; namespace mozilla { extern PRLogModuleInfo* gMediaDecoderLog; -#define DECODER_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) MediaOmxCommonDecoder::MediaOmxCommonDecoder() : MediaDecoder() @@ -65,7 +65,7 @@ MediaOmxCommonDecoder::FirstFrameLoaded(nsAutoPtr aInfo, ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); if (!CheckDecoderCanOffloadAudio()) { - DECODER_LOG(PR_LOG_DEBUG, ("In %s Offload Audio check failed", + DECODER_LOG(LogLevel::Debug, ("In %s Offload Audio check failed", __PRETTY_FUNCTION__)); return; } @@ -82,7 +82,7 @@ MediaOmxCommonDecoder::FirstFrameLoaded(nsAutoPtr aInfo, if (err != OK) { mAudioOffloadPlayer = nullptr; mFallbackToStateMachine = true; - DECODER_LOG(PR_LOG_DEBUG, ("In %s Unable to start offload audio %d." + DECODER_LOG(LogLevel::Debug, ("In %s Unable to start offload audio %d." "Switching to normal mode", __PRETTY_FUNCTION__, err)); return; } @@ -106,7 +106,7 @@ MediaOmxCommonDecoder::PauseStateMachine() { MOZ_ASSERT(NS_IsMainThread()); GetReentrantMonitor().AssertCurrentThreadIn(); - DECODER_LOG(PR_LOG_DEBUG, ("%s", __PRETTY_FUNCTION__)); + DECODER_LOG(LogLevel::Debug, ("%s", __PRETTY_FUNCTION__)); if (mShuttingDown) { return; @@ -129,7 +129,7 @@ MediaOmxCommonDecoder::ResumeStateMachine() { MOZ_ASSERT(NS_IsMainThread()); ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); - DECODER_LOG(PR_LOG_DEBUG, ("%s current time %f", __PRETTY_FUNCTION__, mLogicalPosition)); + DECODER_LOG(LogLevel::Debug, ("%s current time %f", __PRETTY_FUNCTION__, mLogicalPosition)); if (mShuttingDown) { return; @@ -160,7 +160,7 @@ void MediaOmxCommonDecoder::AudioOffloadTearDown() { MOZ_ASSERT(NS_IsMainThread()); - DECODER_LOG(PR_LOG_DEBUG, ("%s", __PRETTY_FUNCTION__)); + DECODER_LOG(LogLevel::Debug, ("%s", __PRETTY_FUNCTION__)); // mAudioOffloadPlayer can be null here if ResumeStateMachine was called // just before because of some other error. diff --git a/dom/media/omx/MediaOmxCommonReader.cpp b/dom/media/omx/MediaOmxCommonReader.cpp index f40591de85..ce4d6d0ae3 100644 --- a/dom/media/omx/MediaOmxCommonReader.cpp +++ b/dom/media/omx/MediaOmxCommonReader.cpp @@ -23,7 +23,7 @@ using namespace android; namespace mozilla { extern PRLogModuleInfo* gMediaDecoderLog; -#define DECODER_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) MediaOmxCommonReader::MediaOmxCommonReader(AbstractMediaDecoder *aDecoder) : MediaDecoderReader(aDecoder) @@ -60,13 +60,13 @@ void MediaOmxCommonReader::CheckAudioOffload() // aren't supported and also duration would be less than a minute bool isTypeMusic = mAudioChannel == dom::AudioChannel::Content; - DECODER_LOG(PR_LOG_DEBUG, ("%s meta %p, no video %d, no streaming %d," + DECODER_LOG(LogLevel::Debug, ("%s meta %p, no video %d, no streaming %d," " channel type %d", __FUNCTION__, meta.get(), hasNoVideo, isNotStreaming, mAudioChannel)); if ((meta.get()) && hasNoVideo && isNotStreaming && isTypeMusic && canOffloadStream(meta, false, false, AUDIO_STREAM_MUSIC)) { - DECODER_LOG(PR_LOG_DEBUG, ("Can offload this audio stream")); + DECODER_LOG(LogLevel::Debug, ("Can offload this audio stream")); mDecoder->SetPlatformCanOffloadAudio(true); } } diff --git a/dom/media/omx/MediaOmxReader.cpp b/dom/media/omx/MediaOmxReader.cpp index 95d80bff02..77b8a27261 100644 --- a/dom/media/omx/MediaOmxReader.cpp +++ b/dom/media/omx/MediaOmxReader.cpp @@ -29,7 +29,7 @@ using namespace android; namespace mozilla { extern PRLogModuleInfo* gMediaDecoderLog; -#define DECODER_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define DECODER_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) class OmxReaderProcessCachedDataTask : public Task { diff --git a/dom/media/omx/OmxDecoder.cpp b/dom/media/omx/OmxDecoder.cpp index 839bde91ca..b22647ee56 100644 --- a/dom/media/omx/OmxDecoder.cpp +++ b/dom/media/omx/OmxDecoder.cpp @@ -38,7 +38,7 @@ #undef LOG PRLogModuleInfo *gOmxDecoderLog; -#define LOG(type, msg...) PR_LOG(gOmxDecoderLog, type, (msg)) +#define LOG(type, msg...) MOZ_LOG(gOmxDecoderLog, type, (msg)) using namespace MPAPI; using namespace mozilla; @@ -431,7 +431,7 @@ bool OmxDecoder::SetVideoFormat() { NS_WARNING("rotation not available, assuming 0"); } - LOG(PR_LOG_DEBUG, "display width: %d display height %d width: %d height: %d component: %s format: %d stride: %d sliceHeight: %d rotation: %d", + LOG(LogLevel::Debug, "display width: %d display height %d width: %d height: %d component: %s format: %d stride: %d sliceHeight: %d rotation: %d", mDisplayWidth, mDisplayHeight, mVideoWidth, mVideoHeight, componentName, mVideoColorFormat, mVideoStride, mVideoSliceHeight, mVideoRotation); @@ -445,7 +445,7 @@ bool OmxDecoder::SetAudioFormat() { return false; } - LOG(PR_LOG_DEBUG, "channelCount: %d sampleRate: %d", + LOG(LogLevel::Debug, "channelCount: %d sampleRate: %d", mAudioChannels, mAudioSampleRate); return true; @@ -526,7 +526,7 @@ bool OmxDecoder::ToVideoFrame(VideoFrame *aFrame, int64_t aTimeUs, void *aData, SemiPlanarYVU420Frame(aFrame, aTimeUs, aData, aSize, aKeyFrame); break; default: - LOG(PR_LOG_DEBUG, "Unknown video color format %08x", mVideoColorFormat); + LOG(LogLevel::Debug, "Unknown video color format %08x", mVideoColorFormat); return false; } return true; @@ -658,7 +658,7 @@ bool OmxDecoder::ReadVideo(VideoFrame *aFrame, int64_t aTimeUs, char *data = static_cast(mVideoBuffer->data()) + mVideoBuffer->range_offset(); if (unreadable) { - LOG(PR_LOG_DEBUG, "video frame is unreadable"); + LOG(LogLevel::Debug, "video frame is unreadable"); } if (!ToVideoFrame(aFrame, timeUs, data, length, keyFrame)) { @@ -683,13 +683,13 @@ bool OmxDecoder::ReadVideo(VideoFrame *aFrame, int64_t aTimeUs, return false; } else if (err == -ETIMEDOUT) { - LOG(PR_LOG_DEBUG, "OmxDecoder::ReadVideo timed out, will retry"); + LOG(LogLevel::Debug, "OmxDecoder::ReadVideo timed out, will retry"); return true; } else { // UNKNOWN_ERROR is sometimes is used to mean "out of memory", but // regardless, don't keep trying to decode if the decoder doesn't want to. - LOG(PR_LOG_DEBUG, "OmxDecoder::ReadVideo failed, err=%d", err); + LOG(LogLevel::Debug, "OmxDecoder::ReadVideo failed, err=%d", err); return false; } @@ -744,11 +744,11 @@ bool OmxDecoder::ReadAudio(AudioFrame *aFrame, int64_t aSeekTimeUs) } } else if (err == -ETIMEDOUT) { - LOG(PR_LOG_DEBUG, "OmxDecoder::ReadAudio timed out, will retry"); + LOG(LogLevel::Debug, "OmxDecoder::ReadAudio timed out, will retry"); return true; } else if (err != OK) { - LOG(PR_LOG_DEBUG, "OmxDecoder::ReadAudio failed, err=%d", err); + LOG(LogLevel::Debug, "OmxDecoder::ReadAudio failed, err=%d", err); return false; } diff --git a/dom/media/platforms/apple/AppleATDecoder.cpp b/dom/media/platforms/apple/AppleATDecoder.cpp index 44a0b33a63..89f31d5bb0 100644 --- a/dom/media/platforms/apple/AppleATDecoder.cpp +++ b/dom/media/platforms/apple/AppleATDecoder.cpp @@ -13,7 +13,7 @@ #include "mozilla/Logging.h" PRLogModuleInfo* GetAppleMediaLog(); -#define LOG(...) PR_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetAppleMediaLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #define FourCC2Str(n) ((char[5]){(char)(n >> 24), (char)(n >> 16), (char)(n >> 8), (char)(n), 0}) namespace mozilla { diff --git a/dom/media/platforms/apple/AppleCMLinker.cpp b/dom/media/platforms/apple/AppleCMLinker.cpp index c88bf171f6..473c4439ee 100644 --- a/dom/media/platforms/apple/AppleCMLinker.cpp +++ b/dom/media/platforms/apple/AppleCMLinker.cpp @@ -13,7 +13,7 @@ #include "nsDebug.h" PRLogModuleInfo* GetAppleMediaLog(); -#define LOG(...) PR_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetAppleMediaLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/apple/AppleVDADecoder.cpp b/dom/media/platforms/apple/AppleVDADecoder.cpp index 277f9be313..5d67576bae 100644 --- a/dom/media/platforms/apple/AppleVDADecoder.cpp +++ b/dom/media/platforms/apple/AppleVDADecoder.cpp @@ -23,7 +23,7 @@ #include PRLogModuleInfo* GetAppleMediaLog(); -#define LOG(...) PR_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetAppleMediaLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) //#define LOG_MEDIA_SHA1 namespace mozilla { diff --git a/dom/media/platforms/apple/AppleVDALinker.cpp b/dom/media/platforms/apple/AppleVDALinker.cpp index 578fc56612..c89c4adbd2 100644 --- a/dom/media/platforms/apple/AppleVDALinker.cpp +++ b/dom/media/platforms/apple/AppleVDALinker.cpp @@ -11,7 +11,7 @@ #include "nsDebug.h" PRLogModuleInfo* GetAppleMediaLog(); -#define LOG(...) PR_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetAppleMediaLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/apple/AppleVTDecoder.cpp b/dom/media/platforms/apple/AppleVTDecoder.cpp index 0e408c5d03..b9fd871f89 100644 --- a/dom/media/platforms/apple/AppleVTDecoder.cpp +++ b/dom/media/platforms/apple/AppleVTDecoder.cpp @@ -20,7 +20,7 @@ #include "VideoUtils.h" PRLogModuleInfo* GetAppleMediaLog(); -#define LOG(...) PR_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetAppleMediaLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) //#define LOG_MEDIA_SHA1 #ifdef LOG_MEDIA_SHA1 diff --git a/dom/media/platforms/apple/AppleVTLinker.cpp b/dom/media/platforms/apple/AppleVTLinker.cpp index 1f548ab7e6..63ef392c1f 100644 --- a/dom/media/platforms/apple/AppleVTLinker.cpp +++ b/dom/media/platforms/apple/AppleVTLinker.cpp @@ -12,7 +12,7 @@ #include "nsDebug.h" PRLogModuleInfo* GetAppleMediaLog(); -#define LOG(...) PR_LOG(GetAppleMediaLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetAppleMediaLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/ffmpeg/FFmpegLog.h b/dom/media/platforms/ffmpeg/FFmpegLog.h index 1e42b56fec..920ab3f053 100644 --- a/dom/media/platforms/ffmpeg/FFmpegLog.h +++ b/dom/media/platforms/ffmpeg/FFmpegLog.h @@ -8,6 +8,6 @@ #define __FFmpegLog_h__ extern PRLogModuleInfo* GetFFmpegDecoderLog(); -#define FFMPEG_LOG(...) PR_LOG(GetFFmpegDecoderLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define FFMPEG_LOG(...) MOZ_LOG(GetFFmpegDecoderLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #endif // __FFmpegLog_h__ diff --git a/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp b/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp index 2b4197fb20..dc84a88c28 100644 --- a/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp +++ b/dom/media/platforms/gonk/GonkAudioDecoderManager.cpp @@ -26,7 +26,7 @@ #define GADM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkAudioDecoderManager", __VA_ARGS__) PRLogModuleInfo* GetDemuxerLog(); -#define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #define READ_OUTPUT_BUFFER_TIMEOUT_US 3000 using namespace android; diff --git a/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp b/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp index a33a6f1bb3..3d6cd5dbb7 100644 --- a/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp +++ b/dom/media/platforms/gonk/GonkMediaDataDecoder.cpp @@ -14,7 +14,7 @@ #define GMDD_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkMediaDataDecoder", __VA_ARGS__) PRLogModuleInfo* GetDemuxerLog(); -#define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) using namespace android; diff --git a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp b/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp index d08dafcf16..679d8cd5b3 100644 --- a/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp +++ b/dom/media/platforms/gonk/GonkVideoDecoderManager.cpp @@ -32,7 +32,7 @@ #define GVDM_LOG(...) __android_log_print(ANDROID_LOG_DEBUG, "GonkVideoDecoderManager", __VA_ARGS__) PRLogModuleInfo* GetDemuxerLog(); -#define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) using namespace mozilla::layers; using namespace android; typedef android::MediaCodecProxy MediaCodecProxy; diff --git a/dom/media/platforms/wmf/MFTDecoder.cpp b/dom/media/platforms/wmf/MFTDecoder.cpp index cb56d9b293..7a433fd7d3 100644 --- a/dom/media/platforms/wmf/MFTDecoder.cpp +++ b/dom/media/platforms/wmf/MFTDecoder.cpp @@ -10,7 +10,7 @@ #include "mozilla/Logging.h" PRLogModuleInfo* GetDemuxerLog(); -#define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp index ba4a02e870..69b20f5f75 100644 --- a/dom/media/platforms/wmf/WMFAudioMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFAudioMFTManager.cpp @@ -13,7 +13,7 @@ #include "mozilla/Logging.h" PRLogModuleInfo* GetDemuxerLog(); -#define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp index 90bf35a9f9..a4b0f1eab9 100644 --- a/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp +++ b/dom/media/platforms/wmf/WMFMediaDataDecoder.cpp @@ -12,7 +12,7 @@ #include "mozilla/Logging.h" PRLogModuleInfo* GetDemuxerLog(); -#define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) namespace mozilla { diff --git a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp index 4b80c83d8d..ab54a0b750 100644 --- a/dom/media/platforms/wmf/WMFVideoMFTManager.cpp +++ b/dom/media/platforms/wmf/WMFVideoMFTManager.cpp @@ -22,7 +22,7 @@ #include "mozilla/WindowsVersion.h" PRLogModuleInfo* GetDemuxerLog(); -#define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) using mozilla::layers::Image; using mozilla::layers::IMFYCbCrImage; diff --git a/dom/media/systemservices/LoadManager.cpp b/dom/media/systemservices/LoadManager.cpp index 636ed96588..cbafae34dd 100644 --- a/dom/media/systemservices/LoadManager.cpp +++ b/dom/media/systemservices/LoadManager.cpp @@ -21,8 +21,8 @@ PRLogModuleInfo *gLoadManagerLog = nullptr; #undef LOG #undef LOG_ENABLED -#define LOG(args) PR_LOG(gLoadManagerLog, PR_LOG_DEBUG, args) -#define LOG_ENABLED() PR_LOG_TEST(gLoadManagerLog, 5) +#define LOG(args) MOZ_LOG(gLoadManagerLog, mozilla::LogLevel::Debug, args) +#define LOG_ENABLED() MOZ_LOG_TEST(gLoadManagerLog, mozilla::LogLevel::Verbose) namespace mozilla { diff --git a/dom/media/systemservices/LoadMonitor.cpp b/dom/media/systemservices/LoadMonitor.cpp index f9fb724093..d5ba1174b7 100644 --- a/dom/media/systemservices/LoadMonitor.cpp +++ b/dom/media/systemservices/LoadMonitor.cpp @@ -56,9 +56,9 @@ // NSPR_LOG_MODULES=LoadManager:5 #undef LOG #undef LOG_ENABLED -#define LOG(args) PR_LOG(gLoadManagerLog, PR_LOG_DEBUG, args) -#define LOG_ENABLED() PR_LOG_TEST(gLoadManagerLog, 4) -#define LOG_MANY_ENABLED() PR_LOG_TEST(gLoadManagerLog, 5) +#define LOG(args) MOZ_LOG(gLoadManagerLog, mozilla::LogLevel::Debug, args) +#define LOG_ENABLED() MOZ_LOG_TEST(gLoadManagerLog, mozilla::LogLevel::Debug) +#define LOG_MANY_ENABLED() MOZ_LOG_TEST(gLoadManagerLog, mozilla::LogLevel::Verbose) namespace mozilla { diff --git a/dom/media/systemservices/MediaChild.cpp b/dom/media/systemservices/MediaChild.cpp index 3e38d56774..d6e5fd8b49 100644 --- a/dom/media/systemservices/MediaChild.cpp +++ b/dom/media/systemservices/MediaChild.cpp @@ -15,7 +15,7 @@ #undef LOG PRLogModuleInfo *gMediaChildLog; -#define LOG(args) PR_LOG(gMediaChildLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gMediaChildLog, mozilla::LogLevel::Debug, args) namespace mozilla { namespace media { diff --git a/dom/media/systemservices/MediaParent.cpp b/dom/media/systemservices/MediaParent.cpp index 8fd22b3f79..a48252fb15 100644 --- a/dom/media/systemservices/MediaParent.cpp +++ b/dom/media/systemservices/MediaParent.cpp @@ -21,7 +21,7 @@ #undef LOG PRLogModuleInfo *gMediaParentLog; -#define LOG(args) PR_LOG(gMediaParentLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gMediaParentLog, mozilla::LogLevel::Debug, args) // A file in the profile dir is used to persist mOriginKeys used to anonymize // deviceIds to be unique per origin, to avoid them being supercookies. diff --git a/dom/media/systemservices/OpenSLESProvider.cpp b/dom/media/systemservices/OpenSLESProvider.cpp index e18e95abfb..c15d71a22f 100644 --- a/dom/media/systemservices/OpenSLESProvider.cpp +++ b/dom/media/systemservices/OpenSLESProvider.cpp @@ -15,8 +15,8 @@ #undef LOG #undef LOG_ENABLED PRLogModuleInfo *gOpenSLESProviderLog; -#define LOG(args) PR_LOG(gOpenSLESProviderLog, PR_LOG_DEBUG, args) -#define LOG_ENABLED() PR_LOG_TEST(gOpenSLESProviderLog, PR_LOG_DEBUG) +#define LOG(args) MOZ_LOG(gOpenSLESProviderLog, mozilla::LogLevel::Debug, args) +#define LOG_ENABLED() MOZ_LOG_TEST(gOpenSLESProviderLog, mozilla::LogLevel::Debug) namespace mozilla { diff --git a/dom/media/wave/WaveReader.cpp b/dom/media/wave/WaveReader.cpp index c33c838abc..b740035ea7 100644 --- a/dom/media/wave/WaveReader.cpp +++ b/dom/media/wave/WaveReader.cpp @@ -25,9 +25,9 @@ namespace mozilla { //#define SEEK_LOGGING extern PRLogModuleInfo* gMediaDecoderLog; -#define LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) #ifdef SEEK_LOGGING -#define SEEK_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define SEEK_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) #else #define SEEK_LOG(type, msg) #endif @@ -252,7 +252,7 @@ nsRefPtr WaveReader::Seek(int64_t aTarget, int64_t aEndTime) { MOZ_ASSERT(OnTaskQueue()); - LOG(PR_LOG_DEBUG, ("%p About to seek to %lld", mDecoder, aTarget)); + LOG(LogLevel::Debug, ("%p About to seek to %lld", mDecoder, aTarget)); if (NS_FAILED(ResetDecode())) { return SeekPromise::CreateAndReject(NS_ERROR_FAILURE, __func__); diff --git a/dom/media/webm/AudioDecoder.cpp b/dom/media/webm/AudioDecoder.cpp index a68541cd5b..c629728c16 100644 --- a/dom/media/webm/AudioDecoder.cpp +++ b/dom/media/webm/AudioDecoder.cpp @@ -21,7 +21,7 @@ #ifdef PR_LOGGING #include "prprf.h" -#define LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) #else #define LOG(type, msg) #endif @@ -328,7 +328,7 @@ OpusDecoder::FinishInit(AudioInfo& aInfo) if (int64_t(mReader->GetCodecDelay()) != FramesToUsecs(mOpusParser->mPreSkip, mOpusParser->mRate).value()) { - LOG(PR_LOG_WARNING, + LOG(LogLevel::Warning, ("Invalid Opus header: CodecDelay and pre-skip do not match!")); return NS_ERROR_FAILURE; } @@ -353,7 +353,7 @@ OpusDecoder::Decode(const unsigned char* aData, size_t aLength, if (mPaddingDiscarded) { // Discard padding should be used only on the final packet, so // decoding after a padding discard is invalid. - LOG(PR_LOG_DEBUG, ("Opus error, discard padding on interstitial packet")); + LOG(LogLevel::Debug, ("Opus error, discard padding on interstitial packet")); return false; } @@ -392,7 +392,7 @@ OpusDecoder::Decode(const unsigned char* aData, size_t aLength, if (mSkip > 0) { int32_t skipFrames = std::min(mSkip, frames); int32_t keepFrames = frames - skipFrames; - LOG(PR_LOG_DEBUG, ("Opus decoder skipping %d of %d frames", + LOG(LogLevel::Debug, ("Opus decoder skipping %d of %d frames", skipFrames, frames)); PodMove(buffer.get(), buffer.get() + skipFrames * channels, @@ -404,7 +404,7 @@ OpusDecoder::Decode(const unsigned char* aData, size_t aLength, if (aDiscardPadding < 0) { // Negative discard padding is invalid. - LOG(PR_LOG_DEBUG, ("Opus error, negative discard padding")); + LOG(LogLevel::Debug, ("Opus error, negative discard padding")); return false; } if (aDiscardPadding > 0) { @@ -416,10 +416,10 @@ OpusDecoder::Decode(const unsigned char* aData, size_t aLength, } if (discardFrames.value() > frames) { // Discarding more than the entire packet is invalid. - LOG(PR_LOG_DEBUG, ("Opus error, discard padding larger than packet")); + LOG(LogLevel::Debug, ("Opus error, discard padding larger than packet")); return false; } - LOG(PR_LOG_DEBUG, ("Opus decoder discarding %d of %d frames", + LOG(LogLevel::Debug, ("Opus decoder discarding %d of %d frames", int32_t(discardFrames.value()), frames)); // Padding discard is only supposed to happen on the final packet. // Record the discard so we can return an error if another packet is diff --git a/dom/media/webm/IntelWebMVideoDecoder.cpp b/dom/media/webm/IntelWebMVideoDecoder.cpp index 41bb3f32b9..064dcaedbb 100644 --- a/dom/media/webm/IntelWebMVideoDecoder.cpp +++ b/dom/media/webm/IntelWebMVideoDecoder.cpp @@ -21,7 +21,7 @@ #undef LOG PRLogModuleInfo* GetDemuxerLog(); -#define LOG(...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) using namespace mp4_demuxer; diff --git a/dom/media/webm/WebMReader.cpp b/dom/media/webm/WebMReader.cpp index 092bb35dea..ecf6f699b1 100644 --- a/dom/media/webm/WebMReader.cpp +++ b/dom/media/webm/WebMReader.cpp @@ -32,9 +32,9 @@ #undef LOG #include "prprf.h" -#define LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) #ifdef SEEK_LOGGING -#define SEEK_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg) +#define SEEK_LOG(type, msg) MOZ_LOG(gMediaDecoderLog, type, msg) #else #define SEEK_LOG(type, msg) #endif @@ -102,7 +102,7 @@ static void webm_log(nestegg * context, unsigned int severity, char const * format, ...) { - if (!PR_LOG_TEST(gNesteggLog, PR_LOG_DEBUG)) { + if (!MOZ_LOG_TEST(gNesteggLog, LogLevel::Debug)) { return; } @@ -135,7 +135,7 @@ static void webm_log(nestegg * context, PR_snprintf(msg, sizeof(msg), "%p [Nestegg-%s] ", context, sevStr); PR_vsnprintf(msg+strlen(msg), sizeof(msg)-strlen(msg), format, args); - PR_LOG(gNesteggLog, PR_LOG_DEBUG, (msg)); + MOZ_LOG(gNesteggLog, LogLevel::Debug, (msg)); va_end(args); } @@ -508,7 +508,7 @@ bool WebMReader::DecodeAudioPacket(NesteggPacketHolder* aHolder) #ifdef DEBUG int64_t gap_frames = tstamp_frames.value() - decoded_frames.value(); CheckedInt64 usecs = FramesToUsecs(gap_frames, mInfo.mAudio.mRate); - LOG(PR_LOG_DEBUG, ("WebMReader detected gap of %lld, %lld frames, in audio", + LOG(LogLevel::Debug, ("WebMReader detected gap of %lld, %lld frames, in audio", usecs.isValid() ? usecs.value() : -1, gap_frames)); #endif @@ -711,7 +711,7 @@ bool WebMReader::ShouldSkipVideoFrame(int64_t aTimeThreshold) bool WebMReader::DecodeVideoFrame(bool &aKeyframeSkip, int64_t aTimeThreshold) { if (!(aKeyframeSkip && ShouldSkipVideoFrame(aTimeThreshold))) { - LOG(PR_LOG_DEBUG+1, ("Reader [%p]: set the aKeyframeSkip to false.",this)); + LOG(LogLevel::Verbose, ("Reader [%p]: set the aKeyframeSkip to false.",this)); aKeyframeSkip = false; } return mVideoDecoder->DecodeVideoFrame(aKeyframeSkip, aTimeThreshold); @@ -741,7 +741,7 @@ nsresult WebMReader::SeekInternal(int64_t aTarget) NS_ENSURE_SUCCESS(rv, rv); } - LOG(PR_LOG_DEBUG, ("Reader [%p] for Decoder [%p]: About to seek to %fs", + LOG(LogLevel::Debug, ("Reader [%p] for Decoder [%p]: About to seek to %fs", this, mDecoder, double(aTarget) / USECS_PER_S)); if (NS_FAILED(ResetDecode())) { return NS_ERROR_FAILURE; @@ -755,7 +755,7 @@ nsresult WebMReader::SeekInternal(int64_t aTarget) } int r = nestegg_track_seek(mContext, trackToSeek, target); if (r != 0) { - LOG(PR_LOG_DEBUG, ("Reader [%p]: track_seek for track %u failed, r=%d", + LOG(LogLevel::Debug, ("Reader [%p]: track_seek for track %u failed, r=%d", this, trackToSeek, r)); // Try seeking directly based on cluster information in memory. @@ -766,7 +766,7 @@ nsresult WebMReader::SeekInternal(int64_t aTarget) } r = nestegg_offset_seek(mContext, offset); - LOG(PR_LOG_DEBUG, ("Reader [%p]: attempted offset_seek to %lld r=%d", + LOG(LogLevel::Debug, ("Reader [%p]: attempted offset_seek to %lld r=%d", this, offset, r)); if (r != 0) { return NS_ERROR_FAILURE; diff --git a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp index d8b86dc1c8..8226ba727d 100644 --- a/dom/media/webrtc/MediaEngineCameraVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineCameraVideoSource.cpp @@ -16,8 +16,8 @@ using dom::ConstrainDoubleRange; using dom::MediaTrackConstraintSet; extern PRLogModuleInfo* GetMediaManagerLog(); -#define LOG(msg) PR_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg) -#define LOGFRAME(msg) PR_LOG(GetMediaManagerLog(), 6, msg) +#define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) +#define LOGFRAME(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) // guts for appending data to the MSG track bool MediaEngineCameraVideoSource::AppendToTrack(SourceMediaStream* aSource, @@ -218,7 +218,7 @@ MediaEngineCameraVideoSource::ChooseCapability( const dom::MediaTrackConstraints &aConstraints, const MediaEnginePrefs &aPrefs) { - if (PR_LOG_TEST(GetMediaManagerLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetMediaManagerLog(), LogLevel::Debug)) { LOG(("ChooseCapability: prefs: %dx%d @%d-%dfps", aPrefs.GetWidth(), aPrefs.GetHeight(), aPrefs.mFPS, aPrefs.mMinFPS)); diff --git a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp index 4dec467375..828ac71c16 100644 --- a/dom/media/webrtc/MediaEngineGonkVideoSource.cpp +++ b/dom/media/webrtc/MediaEngineGonkVideoSource.cpp @@ -26,8 +26,8 @@ using namespace android; #undef LOG extern PRLogModuleInfo* GetMediaManagerLog(); -#define LOG(msg) PR_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg) -#define LOGFRAME(msg) PR_LOG(GetMediaManagerLog(), 6, msg) +#define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) +#define LOGFRAME(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) class MediaBufferListener : public GonkCameraSource::DirectBufferListener { public: diff --git a/dom/media/webrtc/MediaEngineWebRTC.cpp b/dom/media/webrtc/MediaEngineWebRTC.cpp index 2e3069ca3d..2a9ab6e3cb 100644 --- a/dom/media/webrtc/MediaEngineWebRTC.cpp +++ b/dom/media/webrtc/MediaEngineWebRTC.cpp @@ -8,6 +8,8 @@ #include "CSFLog.h" #include "prenv.h" +#include "mozilla/Logging.h" + static PRLogModuleInfo* GetUserMediaLog() { @@ -35,7 +37,7 @@ GetUserMediaLog() #endif #undef LOG -#define LOG(args) PR_LOG(GetUserMediaLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(GetUserMediaLog(), mozilla::LogLevel::Debug, args) namespace mozilla { diff --git a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp index 77ccc87f27..ddf2fa3197 100644 --- a/dom/media/webrtc/MediaEngineWebRTCAudio.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCAudio.cpp @@ -37,8 +37,8 @@ namespace mozilla { #endif extern PRLogModuleInfo* GetMediaManagerLog(); -#define LOG(msg) PR_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg) -#define LOG_FRAMES(msg) PR_LOG(GetMediaManagerLog(), 6, msg) +#define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) +#define LOG_FRAMES(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) /** * Webrtc audio source. @@ -275,7 +275,7 @@ MediaEngineWebRTCAudioSource::Allocate(const dom::MediaTrackConstraints &aConstr LOG(("Audio device is not initalized")); return NS_ERROR_FAILURE; } - } else if (PR_LOG_TEST(GetMediaManagerLog(), PR_LOG_DEBUG)) { + } else if (MOZ_LOG_TEST(GetMediaManagerLog(), LogLevel::Debug)) { MonitorAutoLock lock(mMonitor); if (mSources.IsEmpty()) { LOG(("Audio device %d reallocated", mCapIndex)); diff --git a/dom/media/webrtc/MediaEngineWebRTCVideo.cpp b/dom/media/webrtc/MediaEngineWebRTCVideo.cpp index 72dd343f91..b947a7b23f 100644 --- a/dom/media/webrtc/MediaEngineWebRTCVideo.cpp +++ b/dom/media/webrtc/MediaEngineWebRTCVideo.cpp @@ -19,8 +19,8 @@ using dom::ConstrainDoubleRange; using dom::MediaTrackConstraintSet; extern PRLogModuleInfo* GetMediaManagerLog(); -#define LOG(msg) PR_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg) -#define LOGFRAME(msg) PR_LOG(GetMediaManagerLog(), 6, msg) +#define LOG(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Debug, msg) +#define LOGFRAME(msg) MOZ_LOG(GetMediaManagerLog(), mozilla::LogLevel::Verbose, msg) /** * Webrtc video source. @@ -227,7 +227,7 @@ MediaEngineWebRTCVideoSource::Allocate(const dom::MediaTrackConstraints &aConstr } mState = kAllocated; LOG(("Video device %d allocated", mCaptureIndex)); - } else if (PR_LOG_TEST(GetMediaManagerLog(), PR_LOG_DEBUG)) { + } else if (MOZ_LOG_TEST(GetMediaManagerLog(), LogLevel::Debug)) { MonitorAutoLock lock(mMonitor); if (mSources.IsEmpty()) { LOG(("Video device %d reallocated", mCaptureIndex)); diff --git a/dom/media/webspeech/recognition/SpeechRecognition.cpp b/dom/media/webspeech/recognition/SpeechRecognition.cpp index 3a6f062e85..2001e2e9ae 100644 --- a/dom/media/webspeech/recognition/SpeechRecognition.cpp +++ b/dom/media/webspeech/recognition/SpeechRecognition.cpp @@ -58,7 +58,7 @@ GetSpeechRecognitionLog() return sLog; } -#define SR_LOG(...) PR_LOG(GetSpeechRecognitionLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define SR_LOG(...) MOZ_LOG(GetSpeechRecognitionLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) already_AddRefed GetSpeechRecognitionService() diff --git a/dom/media/webspeech/recognition/SpeechRecognition.h b/dom/media/webspeech/recognition/SpeechRecognition.h index f5b11c3c79..a359f2d79c 100644 --- a/dom/media/webspeech/recognition/SpeechRecognition.h +++ b/dom/media/webspeech/recognition/SpeechRecognition.h @@ -45,7 +45,7 @@ class GlobalObject; class SpeechEvent; PRLogModuleInfo* GetSpeechRecognitionLog(); -#define SR_LOG(...) PR_LOG(GetSpeechRecognitionLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define SR_LOG(...) MOZ_LOG(GetSpeechRecognitionLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) already_AddRefed GetSpeechRecognitionService(); diff --git a/dom/media/webspeech/synth/SpeechSynthesis.cpp b/dom/media/webspeech/synth/SpeechSynthesis.cpp index 87a65d0eee..4601c09267 100644 --- a/dom/media/webspeech/synth/SpeechSynthesis.cpp +++ b/dom/media/webspeech/synth/SpeechSynthesis.cpp @@ -27,7 +27,7 @@ GetSpeechSynthLog() return sLog; } -#define LOG(type, msg) PR_LOG(GetSpeechSynthLog(), type, msg) +#define LOG(type, msg) MOZ_LOG(GetSpeechSynthLog(), type, msg) namespace mozilla { namespace dom { @@ -145,7 +145,7 @@ SpeechSynthesis::Speak(SpeechSynthesisUtterance& aUtterance) void SpeechSynthesis::AdvanceQueue() { - LOG(PR_LOG_DEBUG, + LOG(LogLevel::Debug, ("SpeechSynthesis::AdvanceQueue length=%d", mSpeechQueue.Length())); if (mSpeechQueue.IsEmpty()) { diff --git a/dom/media/webspeech/synth/nsSpeechTask.cpp b/dom/media/webspeech/synth/nsSpeechTask.cpp index 2ed52f7b9e..a923b48aae 100644 --- a/dom/media/webspeech/synth/nsSpeechTask.cpp +++ b/dom/media/webspeech/synth/nsSpeechTask.cpp @@ -16,7 +16,7 @@ #undef LOG extern PRLogModuleInfo* GetSpeechSynthLog(); -#define LOG(type, msg) PR_LOG(GetSpeechSynthLog(), type, msg) +#define LOG(type, msg) MOZ_LOG(GetSpeechSynthLog(), type, msg) namespace mozilla { namespace dom { @@ -114,7 +114,7 @@ nsSpeechTask::nsSpeechTask(float aVolume, const nsAString& aText) nsSpeechTask::~nsSpeechTask() { - LOG(PR_LOG_DEBUG, ("~nsSpeechTask")); + LOG(LogLevel::Debug, ("~nsSpeechTask")); if (mStream) { if (!mStream->IsDestroyed()) { mStream->Destroy(); @@ -148,7 +148,7 @@ nsSpeechTask::Setup(nsISpeechTaskCallback* aCallback, { MOZ_ASSERT(XRE_IsParentProcess()); - LOG(PR_LOG_DEBUG, ("nsSpeechTask::Setup")); + LOG(LogLevel::Debug, ("nsSpeechTask::Setup")); mCallback = aCallback; @@ -306,7 +306,7 @@ nsSpeechTask::DispatchStartImpl() nsresult nsSpeechTask::DispatchStartImpl(const nsAString& aUri) { - LOG(PR_LOG_DEBUG, ("nsSpeechTask::DispatchStart")); + LOG(LogLevel::Debug, ("nsSpeechTask::DispatchStart")); MOZ_ASSERT(mUtterance); if(NS_WARN_IF(!(mUtterance->mState == SpeechSynthesisUtterance::STATE_PENDING))) { @@ -335,7 +335,7 @@ nsSpeechTask::DispatchEnd(float aElapsedTime, uint32_t aCharIndex) nsresult nsSpeechTask::DispatchEndImpl(float aElapsedTime, uint32_t aCharIndex) { - LOG(PR_LOG_DEBUG, ("nsSpeechTask::DispatchEnd\n")); + LOG(LogLevel::Debug, ("nsSpeechTask::DispatchEnd\n")); MOZ_ASSERT(mUtterance); if(NS_WARN_IF(mUtterance->mState == SpeechSynthesisUtterance::STATE_ENDED)) { @@ -379,7 +379,7 @@ nsSpeechTask::DispatchPause(float aElapsedTime, uint32_t aCharIndex) nsresult nsSpeechTask::DispatchPauseImpl(float aElapsedTime, uint32_t aCharIndex) { - LOG(PR_LOG_DEBUG, ("nsSpeechTask::DispatchPause")); + LOG(LogLevel::Debug, ("nsSpeechTask::DispatchPause")); MOZ_ASSERT(mUtterance); if(NS_WARN_IF(mUtterance->mPaused)) { return NS_ERROR_NOT_AVAILABLE; @@ -409,7 +409,7 @@ nsSpeechTask::DispatchResume(float aElapsedTime, uint32_t aCharIndex) nsresult nsSpeechTask::DispatchResumeImpl(float aElapsedTime, uint32_t aCharIndex) { - LOG(PR_LOG_DEBUG, ("nsSpeechTask::DispatchResume")); + LOG(LogLevel::Debug, ("nsSpeechTask::DispatchResume")); MOZ_ASSERT(mUtterance); if(NS_WARN_IF(!(mUtterance->mPaused))) { return NS_ERROR_NOT_AVAILABLE; @@ -542,7 +542,7 @@ nsSpeechTask::Cancel() { MOZ_ASSERT(XRE_IsParentProcess()); - LOG(PR_LOG_DEBUG, ("nsSpeechTask::Cancel")); + LOG(LogLevel::Debug, ("nsSpeechTask::Cancel")); if (mCallback) { DebugOnly rv = mCallback->OnCancel(); diff --git a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp index 338fda5b7b..f6c610b009 100644 --- a/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp +++ b/dom/media/webspeech/synth/nsSynthVoiceRegistry.cpp @@ -24,7 +24,7 @@ #undef LOG extern PRLogModuleInfo* GetSpeechSynthLog(); -#define LOG(type, msg) PR_LOG(GetSpeechSynthLog(), type, msg) +#define LOG(type, msg) MOZ_LOG(GetSpeechSynthLog(), type, msg) namespace { @@ -126,7 +126,7 @@ nsSynthVoiceRegistry::nsSynthVoiceRegistry() nsSynthVoiceRegistry::~nsSynthVoiceRegistry() { - LOG(PR_LOG_DEBUG, ("~nsSynthVoiceRegistry")); + LOG(LogLevel::Debug, ("~nsSynthVoiceRegistry")); // mSpeechSynthChild's lifecycle is managed by the Content protocol. mSpeechSynthChild = nullptr; @@ -165,7 +165,7 @@ nsSynthVoiceRegistry::GetInstanceForService() void nsSynthVoiceRegistry::Shutdown() { - LOG(PR_LOG_DEBUG, ("[%s] nsSynthVoiceRegistry::Shutdown()", + LOG(LogLevel::Debug, ("[%s] nsSynthVoiceRegistry::Shutdown()", (XRE_IsContentProcess()) ? "Content" : "Default")); gSynthVoiceRegistry = nullptr; } @@ -231,7 +231,7 @@ nsSynthVoiceRegistry::AddVoice(nsISpeechService* aService, const nsAString& aLang, bool aLocalService) { - LOG(PR_LOG_DEBUG, + LOG(LogLevel::Debug, ("nsSynthVoiceRegistry::AddVoice uri='%s' name='%s' lang='%s' local=%s", NS_ConvertUTF16toUTF8(aUri).get(), NS_ConvertUTF16toUTF8(aName).get(), NS_ConvertUTF16toUTF8(aLang).get(), @@ -249,7 +249,7 @@ NS_IMETHODIMP nsSynthVoiceRegistry::RemoveVoice(nsISpeechService* aService, const nsAString& aUri) { - LOG(PR_LOG_DEBUG, + LOG(LogLevel::Debug, ("nsSynthVoiceRegistry::RemoveVoice uri='%s' (%s)", NS_ConvertUTF16toUTF8(aUri).get(), (XRE_IsContentProcess()) ? "child" : "parent")); @@ -289,7 +289,7 @@ nsSynthVoiceRegistry::SetDefaultVoice(const nsAString& aUri, mDefaultVoices.RemoveElement(retval); - LOG(PR_LOG_DEBUG, ("nsSynthVoiceRegistry::SetDefaultVoice %s %s", + LOG(LogLevel::Debug, ("nsSynthVoiceRegistry::SetDefaultVoice %s %s", NS_ConvertUTF16toUTF8(aUri).get(), aIsDefault ? "true" : "false")); @@ -478,14 +478,14 @@ nsSynthVoiceRegistry::FindBestMatch(const nsAString& aUri, VoiceData* retval = mUriVoiceMap.GetWeak(aUri, &found); if (found) { - LOG(PR_LOG_DEBUG, ("nsSynthVoiceRegistry::FindBestMatch - Matched URI")); + LOG(LogLevel::Debug, ("nsSynthVoiceRegistry::FindBestMatch - Matched URI")); return retval; } // Try finding a match for given voice. if (!aLang.IsVoid() && !aLang.IsEmpty()) { if (FindVoiceByLang(aLang, &retval)) { - LOG(PR_LOG_DEBUG, + LOG(LogLevel::Debug, ("nsSynthVoiceRegistry::FindBestMatch - Matched language (%s ~= %s)", NS_ConvertUTF16toUTF8(aLang).get(), NS_ConvertUTF16toUTF8(retval->mLang).get())); @@ -508,7 +508,7 @@ nsSynthVoiceRegistry::FindBestMatch(const nsAString& aUri, } if (FindVoiceByLang(uiLang, &retval)) { - LOG(PR_LOG_DEBUG, + LOG(LogLevel::Debug, ("nsSynthVoiceRegistry::FindBestMatch - Matched UI language (%s ~= %s)", NS_ConvertUTF16toUTF8(uiLang).get(), NS_ConvertUTF16toUTF8(retval->mLang).get())); @@ -518,7 +518,7 @@ nsSynthVoiceRegistry::FindBestMatch(const nsAString& aUri, // Try en-US, the language of locale "C" if (FindVoiceByLang(NS_LITERAL_STRING("en-US"), &retval)) { - LOG(PR_LOG_DEBUG, + LOG(LogLevel::Debug, ("nsSynthVoiceRegistry::FindBestMatch - Matched C locale language (en-US ~= %s)", NS_ConvertUTF16toUTF8(retval->mLang).get())); @@ -574,7 +574,7 @@ nsSynthVoiceRegistry::Speak(const nsAString& aText, const float& aPitch, nsSpeechTask* aTask) { - LOG(PR_LOG_DEBUG, + LOG(LogLevel::Debug, ("nsSynthVoiceRegistry::Speak text='%s' lang='%s' uri='%s' rate=%f pitch=%f", NS_ConvertUTF16toUTF8(aText).get(), NS_ConvertUTF16toUTF8(aLang).get(), NS_ConvertUTF16toUTF8(aUri).get(), aRate, aPitch)); @@ -589,7 +589,7 @@ nsSynthVoiceRegistry::Speak(const nsAString& aText, aTask->SetChosenVoiceURI(voice->mUri); - LOG(PR_LOG_DEBUG, ("nsSynthVoiceRegistry::Speak - Using voice URI: %s", + LOG(LogLevel::Debug, ("nsSynthVoiceRegistry::Speak - Using voice URI: %s", NS_ConvertUTF16toUTF8(voice->mUri).get())); SpeechServiceType serviceType; diff --git a/dom/media/wmf/WMFByteStream.cpp b/dom/media/wmf/WMFByteStream.cpp index dea0582940..1fa3b311cb 100644 --- a/dom/media/wmf/WMFByteStream.cpp +++ b/dom/media/wmf/WMFByteStream.cpp @@ -26,7 +26,7 @@ namespace mozilla { PRLogModuleInfo* gWMFByteStreamLog = nullptr; -#define WMF_BS_LOG(...) PR_LOG(gWMFByteStreamLog, PR_LOG_DEBUG, (__VA_ARGS__)) +#define WMF_BS_LOG(...) MOZ_LOG(gWMFByteStreamLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) WMFByteStream::WMFByteStream(MediaResource* aResource, WMFSourceReaderCallback* aSourceReaderCallback) diff --git a/dom/media/wmf/WMFReader.cpp b/dom/media/wmf/WMFReader.cpp index f2373d9d9a..bb27e5d9a8 100644 --- a/dom/media/wmf/WMFReader.cpp +++ b/dom/media/wmf/WMFReader.cpp @@ -35,7 +35,7 @@ using mozilla::layers::LayersBackend; namespace mozilla { extern PRLogModuleInfo* gMediaDecoderLog; -#define DECODER_LOG(...) PR_LOG(gMediaDecoderLog, PR_LOG_DEBUG, (__VA_ARGS__)) +#define DECODER_LOG(...) MOZ_LOG(gMediaDecoderLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) // Uncomment to enable verbose per-sample logging. //#define LOG_SAMPLE_DECODE 1 diff --git a/dom/media/wmf/WMFSourceReaderCallback.cpp b/dom/media/wmf/WMFSourceReaderCallback.cpp index 7974bc4453..29651df8b1 100644 --- a/dom/media/wmf/WMFSourceReaderCallback.cpp +++ b/dom/media/wmf/WMFSourceReaderCallback.cpp @@ -10,7 +10,7 @@ namespace mozilla { static PRLogModuleInfo* gWMFSourceReaderCallbackLog = nullptr; -#define WMF_CB_LOG(...) PR_LOG(gWMFSourceReaderCallbackLog, PR_LOG_DEBUG, (__VA_ARGS__)) +#define WMF_CB_LOG(...) MOZ_LOG(gWMFSourceReaderCallbackLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) // IUnknown Methods STDMETHODIMP diff --git a/dom/network/UDPSocket.h b/dom/network/UDPSocket.h index d706dd4d34..3c363daa34 100644 --- a/dom/network/UDPSocket.h +++ b/dom/network/UDPSocket.h @@ -24,8 +24,8 @@ struct JSContext; // extern PRLogModuleInfo *gUDPSocketLog; #endif -#define UDPSOCKET_LOG(args) PR_LOG(gUDPSocketLog, PR_LOG_DEBUG, args) -#define UDPSOCKET_LOG_ENABLED() PR_LOG_TEST(gUDPSocketLog, PR_LOG_DEBUG) +#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, mozilla::LogLevel::Debug, args) +#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, mozilla::LogLevel::Debug) namespace mozilla { namespace dom { diff --git a/dom/network/UDPSocketChild.cpp b/dom/network/UDPSocketChild.cpp index a3fdc8f321..1249ecce23 100644 --- a/dom/network/UDPSocketChild.cpp +++ b/dom/network/UDPSocketChild.cpp @@ -23,8 +23,8 @@ using mozilla::net::gNeckoChild; // extern PRLogModuleInfo *gUDPSocketLog; #endif -#define UDPSOCKET_LOG(args) PR_LOG(gUDPSocketLog, PR_LOG_DEBUG, args) -#define UDPSOCKET_LOG_ENABLED() PR_LOG_TEST(gUDPSocketLog, PR_LOG_DEBUG) +#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, mozilla::LogLevel::Debug, args) +#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, mozilla::LogLevel::Debug) namespace mozilla { namespace dom { diff --git a/dom/network/UDPSocketParent.cpp b/dom/network/UDPSocketParent.cpp index 5465a38f82..adee8f2984 100644 --- a/dom/network/UDPSocketParent.cpp +++ b/dom/network/UDPSocketParent.cpp @@ -28,8 +28,8 @@ // extern PRLogModuleInfo *gUDPSocketLog; #endif -#define UDPSOCKET_LOG(args) PR_LOG(gUDPSocketLog, PR_LOG_DEBUG, args) -#define UDPSOCKET_LOG_ENABLED() PR_LOG_TEST(gUDPSocketLog, PR_LOG_DEBUG) +#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, mozilla::LogLevel::Debug, args) +#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, mozilla::LogLevel::Debug) namespace mozilla { namespace dom { diff --git a/dom/plugins/base/nsNPAPIPlugin.cpp b/dom/plugins/base/nsNPAPIPlugin.cpp index c24be0570d..51e1b0760d 100644 --- a/dom/plugins/base/nsNPAPIPlugin.cpp +++ b/dom/plugins/base/nsNPAPIPlugin.cpp @@ -2474,10 +2474,10 @@ _requestread(NPStream *pstream, NPByteRange *rangeList) #ifdef PLUGIN_LOGGING for(NPByteRange * range = rangeList; range != nullptr; range = range->next) - PR_LOG(nsPluginLogging::gNPNLog,PLUGIN_LOG_NOISY, + MOZ_LOG(nsPluginLogging::gNPNLog,PLUGIN_LOG_NOISY, ("%i-%i", range->offset, range->offset + range->length - 1)); - PR_LOG(nsPluginLogging::gNPNLog,PLUGIN_LOG_NOISY, ("\n\n")); + MOZ_LOG(nsPluginLogging::gNPNLog,PLUGIN_LOG_NOISY, ("\n\n")); PR_LogFlush(); #endif diff --git a/dom/plugins/base/nsPluginHost.cpp b/dom/plugins/base/nsPluginHost.cpp index f28654a5eb..252f611cc8 100644 --- a/dom/plugins/base/nsPluginHost.cpp +++ b/dom/plugins/base/nsPluginHost.cpp @@ -280,9 +280,9 @@ nsPluginHost::nsPluginHost() nsPluginLogging::gNPPLog = PR_NewLogModule(NPP_LOG_NAME); nsPluginLogging::gPluginLog = PR_NewLogModule(PLUGIN_LOG_NAME); - PR_LOG(nsPluginLogging::gNPNLog, PLUGIN_LOG_ALWAYS,("NPN Logging Active!\n")); - PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_ALWAYS,("General Plugin Logging Active! (nsPluginHost::ctor)\n")); - PR_LOG(nsPluginLogging::gNPPLog, PLUGIN_LOG_ALWAYS,("NPP Logging Active!\n")); + MOZ_LOG(nsPluginLogging::gNPNLog, PLUGIN_LOG_ALWAYS,("NPN Logging Active!\n")); + MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_ALWAYS,("General Plugin Logging Active! (nsPluginHost::ctor)\n")); + MOZ_LOG(nsPluginLogging::gNPPLog, PLUGIN_LOG_ALWAYS,("NPP Logging Active!\n")); PLUGIN_LOG(PLUGIN_LOG_ALWAYS,("nsPluginHost::ctor\n")); PR_LogFlush(); @@ -785,7 +785,7 @@ nsPluginHost::InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aUR if (aURL) aURL->GetAsciiSpec(urlSpec); - PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL, + MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL, ("nsPluginHost::InstantiatePlugin Begin mime=%s, url=%s\n", PromiseFlatCString(aMimeType).get(), urlSpec.get())); @@ -848,7 +848,7 @@ nsPluginHost::InstantiatePluginInstance(const nsACString& aMimeType, nsIURI* aUR nsAutoCString urlSpec2; if (aURL != nullptr) aURL->GetAsciiSpec(urlSpec2); - PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL, + MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL, ("nsPluginHost::InstantiatePlugin Finished mime=%s, rv=%d, url=%s\n", PromiseFlatCString(aMimeType).get(), rv, urlSpec2.get())); @@ -926,7 +926,7 @@ nsPluginHost::TrySetUpPluginInstance(const nsACString &aMimeType, nsAutoCString urlSpec; if (aURL != nullptr) aURL->GetSpec(urlSpec); - PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL, + MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL, ("nsPluginHost::TrySetupPluginInstance Begin mime=%s, owner=%p, url=%s\n", PromiseFlatCString(aMimeType).get(), aOwner, urlSpec.get())); @@ -983,7 +983,7 @@ nsPluginHost::TrySetUpPluginInstance(const nsACString &aMimeType, if (aURL) aURL->GetSpec(urlSpec2); - PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_BASIC, + MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_BASIC, ("nsPluginHost::TrySetupPluginInstance Finished mime=%s, rv=%d, owner=%p, url=%s\n", PromiseFlatCString(aMimeType).get(), rv, aOwner, urlSpec2.get())); @@ -2954,7 +2954,7 @@ nsPluginHost::ReadPluginInfo() tag->ImportFlagsToPrefs(tagflag); } - PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_BASIC, + MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_BASIC, ("LoadCachedPluginsInfo : Loading Cached plugininfo for %s\n", tag->mFileName.get())); tag->mNext = mCachedPlugins; mCachedPlugins = tag; diff --git a/dom/plugins/base/nsPluginLogging.h b/dom/plugins/base/nsPluginLogging.h index 93a59eee94..85014c3889 100644 --- a/dom/plugins/base/nsPluginLogging.h +++ b/dom/plugins/base/nsPluginLogging.h @@ -29,11 +29,10 @@ #define PLUGIN_LOG_NAME "Plugin" // Levels -#define PLUGIN_LOG_ALWAYS 1 -#define PLUGIN_LOG_BASIC 3 -#define PLUGIN_LOG_NORMAL 5 -#define PLUGIN_LOG_NOISY 7 -#define PLUGIN_LOG_MAX 9 +#define PLUGIN_LOG_ALWAYS mozilla::LogLevel::Error +#define PLUGIN_LOG_BASIC mozilla::LogLevel::Info +#define PLUGIN_LOG_NORMAL mozilla::LogLevel::Debug +#define PLUGIN_LOG_NOISY mozilla::LogLevel::Verbose // 2. You can combine logs and levels by separating them with a comma: // My favorite Win32 Example: SET NSPR_LOG_MODULES=Plugin:5,PluginNPP:5,PluginNPN:5 @@ -64,7 +63,7 @@ public: #ifdef PLUGIN_LOGGING #define NPN_PLUGIN_LOG(a, b) \ PR_BEGIN_MACRO \ - PR_LOG(nsPluginLogging::gNPNLog, a, b); \ + MOZ_LOG(nsPluginLogging::gNPNLog, a, b); \ PR_LogFlush(); \ PR_END_MACRO #else @@ -74,7 +73,7 @@ public: #ifdef PLUGIN_LOGGING #define NPP_PLUGIN_LOG(a, b) \ PR_BEGIN_MACRO \ - PR_LOG(nsPluginLogging::gNPPLog, a, b); \ + MOZ_LOG(nsPluginLogging::gNPPLog, a, b); \ PR_LogFlush(); \ PR_END_MACRO #else @@ -84,7 +83,7 @@ public: #ifdef PLUGIN_LOGGING #define PLUGIN_LOG(a, b) \ PR_BEGIN_MACRO \ - PR_LOG(nsPluginLogging::gPluginLog, a, b); \ + MOZ_LOG(nsPluginLogging::gPluginLog, a, b); \ PR_LogFlush(); \ PR_END_MACRO #else diff --git a/dom/plugins/base/nsPluginStreamListenerPeer.cpp b/dom/plugins/base/nsPluginStreamListenerPeer.cpp index 623db2d1d2..0af36cb5df 100644 --- a/dom/plugins/base/nsPluginStreamListenerPeer.cpp +++ b/dom/plugins/base/nsPluginStreamListenerPeer.cpp @@ -280,7 +280,7 @@ nsPluginStreamListenerPeer::nsPluginStreamListenerPeer() nsPluginStreamListenerPeer::~nsPluginStreamListenerPeer() { #ifdef PLUGIN_LOGGING - PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL, + MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL, ("nsPluginStreamListenerPeer::dtor this=%p, url=%s\n",this, mURLSpec.get())); #endif @@ -309,7 +309,7 @@ nsresult nsPluginStreamListenerPeer::Initialize(nsIURI *aURL, nsAutoCString urlSpec; if (aURL != nullptr) aURL->GetSpec(urlSpec); - PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL, + MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NORMAL, ("nsPluginStreamListenerPeer::Initialize instance=%p, url=%s\n", aInstance, urlSpec.get())); PR_LogFlush(); @@ -555,7 +555,7 @@ nsPluginStreamListenerPeer::OnStartRequest(nsIRequest *request, mContentType = contentType; #ifdef PLUGIN_LOGGING - PR_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NOISY, + MOZ_LOG(nsPluginLogging::gPluginLog, PLUGIN_LOG_NOISY, ("nsPluginStreamListenerPeer::OnStartRequest this=%p request=%p mime=%s, url=%s\n", this, request, contentType.get(), mURLSpec.get())); diff --git a/dom/plugins/ipc/PluginInstanceChild.cpp b/dom/plugins/ipc/PluginInstanceChild.cpp index 6d28027f12..797ca91ae5 100644 --- a/dom/plugins/ipc/PluginInstanceChild.cpp +++ b/dom/plugins/ipc/PluginInstanceChild.cpp @@ -507,7 +507,7 @@ PluginInstanceChild::NPN_GetValue(NPNVariable aVar, #endif default: - PR_LOG(GetPluginLog(), PR_LOG_WARNING, + MOZ_LOG(GetPluginLog(), LogLevel::Warning, ("In PluginInstanceChild::NPN_GetValue: Unhandled NPNVariable %i (%s)", (int) aVar, NPNVariableToString(aVar))); return NPERR_GENERIC_ERROR; @@ -536,7 +536,7 @@ PluginInstanceChild::Invalidate() NPError PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue) { - PR_LOG(GetPluginLog(), PR_LOG_DEBUG, ("%s (aVar=%i, aValue=%p)", + MOZ_LOG(GetPluginLog(), LogLevel::Debug, ("%s (aVar=%i, aValue=%p)", FULLFUNCTION, (int) aVar, aValue)); AssertPluginThread(); @@ -625,7 +625,7 @@ PluginInstanceChild::NPN_SetValue(NPPVariable aVar, void* aValue) #endif default: - PR_LOG(GetPluginLog(), PR_LOG_WARNING, + MOZ_LOG(GetPluginLog(), LogLevel::Warning, ("In PluginInstanceChild::NPN_SetValue: Unhandled NPPVariable %i (%s)", (int) aVar, NPPVariableToString(aVar))); return NPERR_GENERIC_ERROR; @@ -2350,7 +2350,7 @@ PluginInstanceChild::FlashThrottleMessage(HWND aWnd, bool PluginInstanceChild::AnswerSetPluginFocus() { - PR_LOG(GetPluginLog(), PR_LOG_DEBUG, ("%s", FULLFUNCTION)); + MOZ_LOG(GetPluginLog(), LogLevel::Debug, ("%s", FULLFUNCTION)); #if defined(OS_WIN) // Parent is letting us know the dom set focus to the plugin. Note, @@ -2373,7 +2373,7 @@ PluginInstanceChild::AnswerSetPluginFocus() bool PluginInstanceChild::AnswerUpdateWindow() { - PR_LOG(GetPluginLog(), PR_LOG_DEBUG, ("%s", FULLFUNCTION)); + MOZ_LOG(GetPluginLog(), LogLevel::Debug, ("%s", FULLFUNCTION)); #if defined(OS_WIN) if (mPluginWindowHWND) { diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp index 8f0bfad3bf..671dc6387a 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -1143,7 +1143,7 @@ PluginInstanceParent::NPP_GetValue(NPPVariable aVariable, #endif default: - PR_LOG(GetPluginLog(), PR_LOG_WARNING, + MOZ_LOG(GetPluginLog(), LogLevel::Warning, ("In PluginInstanceParent::NPP_GetValue: Unhandled NPPVariable %i (%s)", (int) aVariable, NPPVariableToString(aVariable))); return NPERR_GENERIC_ERROR; @@ -1164,7 +1164,7 @@ PluginInstanceParent::NPP_SetValue(NPNVariable variable, void* value) default: NS_ERROR("Unhandled NPNVariable in NPP_SetValue"); - PR_LOG(GetPluginLog(), PR_LOG_WARNING, + MOZ_LOG(GetPluginLog(), LogLevel::Warning, ("In PluginInstanceParent::NPP_SetValue: Unhandled NPNVariable %i (%s)", (int) variable, NPNVariableToString(variable))); return NPERR_GENERIC_ERROR; diff --git a/dom/plugins/ipc/PluginMessageUtils.h b/dom/plugins/ipc/PluginMessageUtils.h index ec5b6d80ee..4d86ad0b6d 100644 --- a/dom/plugins/ipc/PluginMessageUtils.h +++ b/dom/plugins/ipc/PluginMessageUtils.h @@ -59,9 +59,9 @@ extern PRLogModuleInfo* GetPluginLog(); #define FULLFUNCTION __FUNCTION__ #endif -#define PLUGIN_LOG_DEBUG(args) PR_LOG(GetPluginLog(), PR_LOG_DEBUG, args) -#define PLUGIN_LOG_DEBUG_FUNCTION PR_LOG(GetPluginLog(), PR_LOG_DEBUG, ("%s", FULLFUNCTION)) -#define PLUGIN_LOG_DEBUG_METHOD PR_LOG(GetPluginLog(), PR_LOG_DEBUG, ("%s [%p]", FULLFUNCTION, (void*) this)) +#define PLUGIN_LOG_DEBUG(args) MOZ_LOG(GetPluginLog(), mozilla::LogLevel::Debug, args) +#define PLUGIN_LOG_DEBUG_FUNCTION MOZ_LOG(GetPluginLog(), mozilla::LogLevel::Debug, ("%s", FULLFUNCTION)) +#define PLUGIN_LOG_DEBUG_METHOD MOZ_LOG(GetPluginLog(), mozilla::LogLevel::Debug, ("%s [%p]", FULLFUNCTION, (void*) this)) /** * This is NPByteRange without the linked list. diff --git a/dom/plugins/ipc/PluginModuleParent.cpp b/dom/plugins/ipc/PluginModuleParent.cpp index b73f0308a5..5217dd629f 100755 --- a/dom/plugins/ipc/PluginModuleParent.cpp +++ b/dom/plugins/ipc/PluginModuleParent.cpp @@ -2095,7 +2095,7 @@ nsresult PluginModuleParent::NP_GetValue(void *future, NPPVariable aVariable, void *aValue, NPError* error) { - PR_LOG(GetPluginLog(), PR_LOG_WARNING, ("%s Not implemented, requested variable %i", __FUNCTION__, + MOZ_LOG(GetPluginLog(), LogLevel::Warning, ("%s Not implemented, requested variable %i", __FUNCTION__, (int) aVariable)); //TODO: implement this correctly diff --git a/dom/presentation/provider/MulticastDNSDeviceProvider.cpp b/dom/presentation/provider/MulticastDNSDeviceProvider.cpp index d71f4da38c..0b6dba6d81 100644 --- a/dom/presentation/provider/MulticastDNSDeviceProvider.cpp +++ b/dom/presentation/provider/MulticastDNSDeviceProvider.cpp @@ -17,9 +17,9 @@ GetProviderLog() return log; } #undef LOG_I -#define LOG_I(...) PR_LOG(GetProviderLog(), PR_LOG_NOTICE, (__VA_ARGS__)) +#define LOG_I(...) MOZ_LOG(GetProviderLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #undef LOG_E -#define LOG_E(...) PR_LOG(GetProviderLog(), PR_LOG_ERROR, (__VA_ARGS__)) +#define LOG_E(...) MOZ_LOG(GetProviderLog(), mozilla::LogLevel::Error, (__VA_ARGS__)) #define SERVICE_TYPE "_mozilla_papi._tcp." diff --git a/dom/security/nsCSPContext.cpp b/dom/security/nsCSPContext.cpp index 60d80d3264..0f46e7d220 100644 --- a/dom/security/nsCSPContext.cpp +++ b/dom/security/nsCSPContext.cpp @@ -52,8 +52,8 @@ GetCspContextLog() return gCspContextPRLog; } -#define CSPCONTEXTLOG(args) PR_LOG(GetCspContextLog(), PR_LOG_DEBUG, args) -#define CSPCONTEXTLOGENABLED() PR_LOG_TEST(GetCspContextLog(), PR_LOG_DEBUG) +#define CSPCONTEXTLOG(args) MOZ_LOG(GetCspContextLog(), mozilla::LogLevel::Debug, args) +#define CSPCONTEXTLOGENABLED() MOZ_LOG_TEST(GetCspContextLog(), mozilla::LogLevel::Debug) static const uint32_t CSP_CACHE_URI_CUTOFF_SIZE = 512; diff --git a/dom/security/nsCSPParser.cpp b/dom/security/nsCSPParser.cpp index c2b286271e..0eb96b88ac 100644 --- a/dom/security/nsCSPParser.cpp +++ b/dom/security/nsCSPParser.cpp @@ -28,8 +28,8 @@ GetCspParserLog() return gCspParserPRLog; } -#define CSPPARSERLOG(args) PR_LOG(GetCspParserLog(), PR_LOG_DEBUG, args) -#define CSPPARSERLOGENABLED() PR_LOG_TEST(GetCspParserLog(), PR_LOG_DEBUG) +#define CSPPARSERLOG(args) MOZ_LOG(GetCspParserLog(), mozilla::LogLevel::Debug, args) +#define CSPPARSERLOGENABLED() MOZ_LOG_TEST(GetCspParserLog(), mozilla::LogLevel::Debug) static const char16_t COLON = ':'; static const char16_t SEMICOLON = ';'; diff --git a/dom/security/nsCSPService.cpp b/dom/security/nsCSPService.cpp index de78e907d1..0a135cdb66 100644 --- a/dom/security/nsCSPService.cpp +++ b/dom/security/nsCSPService.cpp @@ -109,10 +109,10 @@ CSPService::ShouldLoad(uint32_t aContentType, return NS_ERROR_FAILURE; } - if (PR_LOG_TEST(gCspPRLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gCspPRLog, LogLevel::Debug)) { nsAutoCString location; aContentLocation->GetSpec(location); - PR_LOG(gCspPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("CSPService::ShouldLoad called for %s", location.get())); } @@ -202,14 +202,14 @@ CSPService::ShouldLoad(uint32_t aContentType, principal->GetCsp(getter_AddRefs(csp)); if (csp) { - if (PR_LOG_TEST(gCspPRLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gCspPRLog, LogLevel::Debug)) { uint32_t numPolicies = 0; nsresult rv = csp->GetPolicyCount(&numPolicies); if (NS_SUCCEEDED(rv)) { for (uint32_t i=0; iGetPolicy(i, policy); - PR_LOG(gCspPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("Document has CSP[%d]: %s", i, NS_ConvertUTF16toUTF8(policy).get())); } @@ -226,10 +226,10 @@ CSPService::ShouldLoad(uint32_t aContentType, aDecision); } } - else if (PR_LOG_TEST(gCspPRLog, PR_LOG_DEBUG)) { + else if (MOZ_LOG_TEST(gCspPRLog, LogLevel::Debug)) { nsAutoCString uriSpec; aContentLocation->GetSpec(uriSpec); - PR_LOG(gCspPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("COULD NOT get nsINode for location: %s", uriSpec.get())); } @@ -314,19 +314,19 @@ CSPService::AsyncOnChannelRedirect(nsIChannel *oldChannel, originalUri, // aMimeTypeGuess &aDecision); - if (newUri && PR_LOG_TEST(gCspPRLog, PR_LOG_DEBUG)) { + if (newUri && MOZ_LOG_TEST(gCspPRLog, LogLevel::Debug)) { nsAutoCString newUriSpec("None"); newUri->GetSpec(newUriSpec); - PR_LOG(gCspPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("CSPService::AsyncOnChannelRedirect called for %s", newUriSpec.get())); } if (aDecision == 1) { - PR_LOG(gCspPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("CSPService::AsyncOnChannelRedirect ALLOWING request.")); } else { - PR_LOG(gCspPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCspPRLog, LogLevel::Debug, ("CSPService::AsyncOnChannelRedirect CANCELLING request.")); } diff --git a/dom/security/nsCSPUtils.cpp b/dom/security/nsCSPUtils.cpp index 7d9928b954..b807234384 100644 --- a/dom/security/nsCSPUtils.cpp +++ b/dom/security/nsCSPUtils.cpp @@ -25,8 +25,8 @@ GetCspUtilsLog() return gCspUtilsPRLog; } -#define CSPUTILSLOG(args) PR_LOG(GetCspUtilsLog(), PR_LOG_DEBUG, args) -#define CSPUTILSLOGENABLED() PR_LOG_TEST(GetCspUtilsLog(), PR_LOG_DEBUG) +#define CSPUTILSLOG(args) MOZ_LOG(GetCspUtilsLog(), mozilla::LogLevel::Debug, args) +#define CSPUTILSLOGENABLED() MOZ_LOG_TEST(GetCspUtilsLog(), mozilla::LogLevel::Debug) void CSP_GetLocalizedStr(const char16_t* aName, diff --git a/dom/xslt/xslt/txExecutionState.cpp b/dom/xslt/xslt/txExecutionState.cpp index 0a55f79f39..aa4a679468 100644 --- a/dom/xslt/xslt/txExecutionState.cpp +++ b/dom/xslt/xslt/txExecutionState.cpp @@ -418,7 +418,7 @@ txExecutionState::retrieveDocument(const nsAString& aUri) return nullptr; } - PR_LOG(txLog::xslt, PR_LOG_DEBUG, + MOZ_LOG(txLog::xslt, LogLevel::Debug, ("Retrieve Document %s", NS_LossyConvertUTF16toASCII(aUri).get())); // try to get already loaded document diff --git a/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp b/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp index a4ae887839..eeefcff180 100644 --- a/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp +++ b/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp @@ -519,7 +519,7 @@ TX_LoadSheet(nsIURI* aUri, txMozillaXSLTProcessor* aProcessor, nsAutoCString spec; aUri->GetSpec(spec); - PR_LOG(txLog::xslt, PR_LOG_ALWAYS, ("TX_LoadSheet: %s\n", spec.get())); + MOZ_LOG(txLog::xslt, LogLevel::Info, ("TX_LoadSheet: %s\n", spec.get())); // Content Policy int16_t shouldLoad = nsIContentPolicy::ACCEPT; diff --git a/dom/xslt/xslt/txMozillaXMLOutput.cpp b/dom/xslt/xslt/txMozillaXMLOutput.cpp index 03a3c58e35..ef40b66694 100644 --- a/dom/xslt/xslt/txMozillaXMLOutput.cpp +++ b/dom/xslt/xslt/txMozillaXMLOutput.cpp @@ -264,7 +264,7 @@ txMozillaXMLOutput::endElement() if (mBadChildLevel) { --mBadChildLevel; - PR_LOG(txLog::xslt, PR_LOG_DEBUG, + MOZ_LOG(txLog::xslt, LogLevel::Debug, ("endElement, mBadChildLevel = %d\n", mBadChildLevel)); return NS_OK; } @@ -493,7 +493,7 @@ txMozillaXMLOutput::startElementInternal(nsIAtom* aPrefix, if (mBadChildLevel) { ++mBadChildLevel; - PR_LOG(txLog::xslt, PR_LOG_DEBUG, + MOZ_LOG(txLog::xslt, LogLevel::Debug, ("startElement, mBadChildLevel = %d\n", mBadChildLevel)); return NS_OK; } @@ -506,7 +506,7 @@ txMozillaXMLOutput::startElementInternal(nsIAtom* aPrefix, // eCloseElement couldn't add the parent so we fail as well or we've // reached the limit of the depth of the tree that we allow. ++mBadChildLevel; - PR_LOG(txLog::xslt, PR_LOG_DEBUG, + MOZ_LOG(txLog::xslt, LogLevel::Debug, ("startElement, mBadChildLevel = %d\n", mBadChildLevel)); return NS_OK; } diff --git a/dom/xslt/xslt/txStylesheet.cpp b/dom/xslt/xslt/txStylesheet.cpp index 6f75b63598..1c29ecd15c 100644 --- a/dom/xslt/xslt/txStylesheet.cpp +++ b/dom/xslt/xslt/txStylesheet.cpp @@ -16,6 +16,7 @@ #include "txKey.h" #include "txXPathTreeWalker.h" +using mozilla::LogLevel; using mozilla::Move; txStylesheet::txStylesheet() @@ -157,7 +158,7 @@ txStylesheet::findTemplate(const txXPathNode& aNode, } } - if (PR_LOG_TEST(txLog::xslt, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(txLog::xslt, LogLevel::Debug)) { nsAutoString mode, nodeName; if (aMode.mLocalName) { aMode.mLocalName->ToString(mode); @@ -168,14 +169,14 @@ txStylesheet::findTemplate(const txXPathNode& aNode, #ifdef TX_TO_STRING match->toString(matchAttr); #endif - PR_LOG(txLog::xslt, PR_LOG_DEBUG, + MOZ_LOG(txLog::xslt, LogLevel::Debug, ("MatchTemplate, Pattern %s, Mode %s, Node %s\n", NS_LossyConvertUTF16toASCII(matchAttr).get(), NS_LossyConvertUTF16toASCII(mode).get(), NS_LossyConvertUTF16toASCII(nodeName).get())); } else { - PR_LOG(txLog::xslt, PR_LOG_DEBUG, + MOZ_LOG(txLog::xslt, LogLevel::Debug, ("No match, Node %s, Mode %s\n", NS_LossyConvertUTF16toASCII(nodeName).get(), NS_LossyConvertUTF16toASCII(mode).get())); diff --git a/dom/xslt/xslt/txStylesheetCompiler.cpp b/dom/xslt/xslt/txStylesheetCompiler.cpp index b0925e6631..6195e95263 100644 --- a/dom/xslt/xslt/txStylesheetCompiler.cpp +++ b/dom/xslt/xslt/txStylesheetCompiler.cpp @@ -377,7 +377,7 @@ txStylesheetCompiler::characters(const nsAString& aStr) nsresult txStylesheetCompiler::doneLoading() { - PR_LOG(txLog::xslt, PR_LOG_ALWAYS, + MOZ_LOG(txLog::xslt, LogLevel::Info, ("Compiler::doneLoading: %s\n", NS_LossyConvertUTF16toASCII(mStylesheetURI).get())); if (NS_FAILED(mStatus)) { @@ -393,7 +393,7 @@ void txStylesheetCompiler::cancel(nsresult aError, const char16_t *aErrorText, const char16_t *aParam) { - PR_LOG(txLog::xslt, PR_LOG_ALWAYS, + MOZ_LOG(txLog::xslt, LogLevel::Info, ("Compiler::cancel: %s, module: %d, code %d\n", NS_LossyConvertUTF16toASCII(mStylesheetURI).get(), NS_ERROR_GET_MODULE(aError), @@ -422,7 +422,7 @@ txStylesheetCompiler::loadURI(const nsAString& aUri, ReferrerPolicy aReferrerPolicy, txStylesheetCompiler* aCompiler) { - PR_LOG(txLog::xslt, PR_LOG_ALWAYS, + MOZ_LOG(txLog::xslt, LogLevel::Info, ("Compiler::loadURI forwards %s thru %s\n", NS_LossyConvertUTF16toASCII(aUri).get(), NS_LossyConvertUTF16toASCII(mStylesheetURI).get())); @@ -676,7 +676,7 @@ nsresult txStylesheetCompilerState::pushPtr(void* aPtr, enumStackType aType) { #ifdef TX_DEBUG_STACK - PR_LOG(txLog::xslt, PR_LOG_DEBUG, ("pushPtr: 0x%x type %u\n", aPtr, aType)); + MOZ_LOG(txLog::xslt, LogLevel::Debug, ("pushPtr: 0x%x type %u\n", aPtr, aType)); #endif mTypeStack.AppendElement(aType); return mOtherStack.push(aPtr); @@ -695,7 +695,7 @@ txStylesheetCompilerState::popPtr(enumStackType aType) void* value = mOtherStack.pop(); #ifdef TX_DEBUG_STACK - PR_LOG(txLog::xslt, PR_LOG_DEBUG, ("popPtr: 0x%x type %u requested %u\n", value, type, aType)); + MOZ_LOG(txLog::xslt, LogLevel::Debug, ("popPtr: 0x%x type %u requested %u\n", value, type, aType)); #endif if (type != aType) { @@ -750,7 +750,7 @@ txStylesheetCompilerState::addInstruction(nsAutoPtr&& aInstructio nsresult txStylesheetCompilerState::loadIncludedStylesheet(const nsAString& aURI) { - PR_LOG(txLog::xslt, PR_LOG_ALWAYS, + MOZ_LOG(txLog::xslt, LogLevel::Info, ("CompilerState::loadIncludedStylesheet: %s\n", NS_LossyConvertUTF16toASCII(aURI).get())); if (mStylesheetURI.Equals(aURI)) { @@ -795,7 +795,7 @@ nsresult txStylesheetCompilerState::loadImportedStylesheet(const nsAString& aURI, txStylesheet::ImportFrame* aFrame) { - PR_LOG(txLog::xslt, PR_LOG_ALWAYS, + MOZ_LOG(txLog::xslt, LogLevel::Info, ("CompilerState::loadImportedStylesheet: %s\n", NS_LossyConvertUTF16toASCII(aURI).get())); if (mStylesheetURI.Equals(aURI)) { diff --git a/dom/xul/XULDocument.cpp b/dom/xul/XULDocument.cpp index 8dd90c4f49..e919c9b4d3 100644 --- a/dom/xul/XULDocument.cpp +++ b/dom/xul/XULDocument.cpp @@ -375,7 +375,7 @@ XULDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsIStreamListener **aDocListener, bool aReset, nsIContentSink* aSink) { - if (PR_LOG_TEST(gXULLog, PR_LOG_WARNING)) { + if (MOZ_LOG_TEST(gXULLog, LogLevel::Warning)) { nsCOMPtr uri; nsresult rv = aChannel->GetOriginalURI(getter_AddRefs(uri)); @@ -383,7 +383,7 @@ XULDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel, nsAutoCString urlspec; rv = uri->GetSpec(urlspec); if (NS_SUCCEEDED(rv)) { - PR_LOG(gXULLog, PR_LOG_WARNING, + MOZ_LOG(gXULLog, LogLevel::Warning, ("xul: load document '%s'", urlspec.get())); } } @@ -559,11 +559,11 @@ XULDocument::EndLoad() } OnPrototypeLoadDone(true); - if (PR_LOG_TEST(gXULLog, PR_LOG_WARNING)) { + if (MOZ_LOG_TEST(gXULLog, LogLevel::Warning)) { nsAutoCString urlspec; rv = uri->GetSpec(urlspec); if (NS_SUCCEEDED(rv)) { - PR_LOG(gXULLog, PR_LOG_WARNING, + MOZ_LOG(gXULLog, LogLevel::Warning, ("xul: Finished loading document '%s'", urlspec.get())); } } @@ -2271,14 +2271,14 @@ XULDocument::PrepareToWalk() nsXULPrototypeElement* proto = mCurrentPrototype->GetRootElement(); if (! proto) { - if (PR_LOG_TEST(gXULLog, PR_LOG_ERROR)) { + if (MOZ_LOG_TEST(gXULLog, LogLevel::Error)) { nsCOMPtr url = mCurrentPrototype->GetURI(); nsAutoCString urlspec; rv = url->GetSpec(urlspec); if (NS_FAILED(rv)) return rv; - PR_LOG(gXULLog, PR_LOG_ERROR, + MOZ_LOG(gXULLog, LogLevel::Error, ("xul: error parsing '%s'", urlspec.get())); } @@ -2542,7 +2542,7 @@ XULDocument::LoadOverlayInternal(nsIURI* aURI, bool aIsDynamic, *aShouldReturn = false; *aFailureFromContent = false; - if (PR_LOG_TEST(gXULLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULLog, LogLevel::Debug)) { nsAutoCString urlspec; aURI->GetSpec(urlspec); nsAutoCString parentDoc; @@ -2553,7 +2553,7 @@ XULDocument::LoadOverlayInternal(nsIURI* aURI, bool aIsDynamic, if (!(parentDoc.get())) parentDoc = ""; - PR_LOG(gXULLog, PR_LOG_DEBUG, + MOZ_LOG(gXULLog, LogLevel::Debug, ("xul: %s loading overlay %s", parentDoc.get(), urlspec.get())); } @@ -2613,7 +2613,7 @@ XULDocument::LoadOverlayInternal(nsIURI* aURI, bool aIsDynamic, return NS_OK; } - PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul: overlay was cached")); + MOZ_LOG(gXULLog, LogLevel::Debug, ("xul: overlay was cached")); // Found the overlay's prototype in the cache, fully loaded. If // this is a dynamic overlay, this will call ResumeWalk. @@ -2622,10 +2622,10 @@ XULDocument::LoadOverlayInternal(nsIURI* aURI, bool aIsDynamic, } else { // Not there. Initiate a load. - PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul: overlay was not cached")); + MOZ_LOG(gXULLog, LogLevel::Debug, ("xul: overlay was not cached")); if (mIsGoingAway) { - PR_LOG(gXULLog, PR_LOG_DEBUG, ("xul: ...and document already destroyed")); + MOZ_LOG(gXULLog, LogLevel::Debug, ("xul: ...and document already destroyed")); return NS_ERROR_NOT_AVAILABLE; } @@ -3578,8 +3578,8 @@ XULDocument::CreateElementFromPrototype(nsXULPrototypeElement* aPrototype, *aResult = nullptr; nsresult rv = NS_OK; - if (PR_LOG_TEST(gXULLog, PR_LOG_NOTICE)) { - PR_LOG(gXULLog, PR_LOG_NOTICE, + if (MOZ_LOG_TEST(gXULLog, LogLevel::Debug)) { + MOZ_LOG(gXULLog, LogLevel::Debug, ("xul: creating <%s> from prototype", NS_ConvertUTF16toUTF8(aPrototype->mNodeInfo->QualifiedName()).get())); } @@ -3848,10 +3848,10 @@ XULDocument::OverlayForwardReference::Resolve() if (NS_FAILED(rv)) return eResolve_Error; } - if (PR_LOG_TEST(gXULLog, PR_LOG_NOTICE)) { + if (MOZ_LOG_TEST(gXULLog, LogLevel::Debug)) { nsAutoCString idC; idC.AssignWithConversion(id); - PR_LOG(gXULLog, PR_LOG_NOTICE, + MOZ_LOG(gXULLog, LogLevel::Debug, ("xul: overlay resolved '%s'", idC.get())); } @@ -4017,7 +4017,7 @@ XULDocument::OverlayForwardReference::Merge(nsIContent* aTargetNode, XULDocument::OverlayForwardReference::~OverlayForwardReference() { - if (PR_LOG_TEST(gXULLog, PR_LOG_WARNING) && !mResolved) { + if (MOZ_LOG_TEST(gXULLog, LogLevel::Warning) && !mResolved) { nsAutoString id; mOverlay->GetAttr(kNameSpaceID_None, nsGkAtoms::id, id); @@ -4033,7 +4033,7 @@ XULDocument::OverlayForwardReference::~OverlayForwardReference() nsresult rv = mDocument->mChannel->GetOriginalURI(getter_AddRefs(docURI)); if (NS_SUCCEEDED(rv)) docURI->GetSpec(parentDoc); - PR_LOG(gXULLog, PR_LOG_WARNING, + MOZ_LOG(gXULLog, LogLevel::Warning, ("xul: %s overlay failed to resolve '%s' in %s", urlspec.get(), idC.get(), parentDoc.get())); } @@ -4060,7 +4060,7 @@ XULDocument::BroadcasterHookup::Resolve() XULDocument::BroadcasterHookup::~BroadcasterHookup() { - if (PR_LOG_TEST(gXULLog, PR_LOG_WARNING) && !mResolved) { + if (MOZ_LOG_TEST(gXULLog, LogLevel::Warning) && !mResolved) { // Tell the world we failed nsAutoString broadcasterID; @@ -4078,7 +4078,7 @@ XULDocument::BroadcasterHookup::~BroadcasterHookup() nsAutoCString attributeC,broadcasteridC; attributeC.AssignWithConversion(attribute); broadcasteridC.AssignWithConversion(broadcasterID); - PR_LOG(gXULLog, PR_LOG_WARNING, + MOZ_LOG(gXULLog, LogLevel::Warning, ("xul: broadcaster hookup failed <%s attribute='%s'> to %s", nsAtomCString(mObservesElement->NodeInfo()->NameAtom()).get(), attributeC.get(), @@ -4279,7 +4279,7 @@ XULDocument::CheckBroadcasterHookup(Element* aElement, } // Tell the world we succeeded - if (PR_LOG_TEST(gXULLog, PR_LOG_NOTICE)) { + if (MOZ_LOG_TEST(gXULLog, LogLevel::Debug)) { nsCOMPtr content = do_QueryInterface(listener); @@ -4290,7 +4290,7 @@ XULDocument::CheckBroadcasterHookup(Element* aElement, nsAutoCString attributeC,broadcasteridC; attributeC.AssignWithConversion(attribute); broadcasteridC.AssignWithConversion(broadcasterID); - PR_LOG(gXULLog, PR_LOG_NOTICE, + MOZ_LOG(gXULLog, LogLevel::Debug, ("xul: broadcaster hookup <%s attribute='%s'> to %s", nsAtomCString(content->NodeInfo()->NameAtom()).get(), attributeC.get(), diff --git a/dom/xul/nsXULCommandDispatcher.cpp b/dom/xul/nsXULCommandDispatcher.cpp index a29fb840a4..e91ab66766 100644 --- a/dom/xul/nsXULCommandDispatcher.cpp +++ b/dom/xul/nsXULCommandDispatcher.cpp @@ -268,13 +268,13 @@ nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement, if (updater->mElement == aElement) { #ifdef DEBUG - if (PR_LOG_TEST(gCommandLog, PR_LOG_NOTICE)) { + if (MOZ_LOG_TEST(gCommandLog, LogLevel::Debug)) { nsAutoCString eventsC, targetsC, aeventsC, atargetsC; eventsC.AssignWithConversion(updater->mEvents); targetsC.AssignWithConversion(updater->mTargets); CopyUTF16toUTF8(aEvents, aeventsC); CopyUTF16toUTF8(aTargets, atargetsC); - PR_LOG(gCommandLog, PR_LOG_NOTICE, + MOZ_LOG(gCommandLog, LogLevel::Debug, ("xulcmd[%p] replace %p(events=%s targets=%s) with (events=%s targets=%s)", this, aElement, eventsC.get(), @@ -296,12 +296,12 @@ nsXULCommandDispatcher::AddCommandUpdater(nsIDOMElement* aElement, updater = updater->mNext; } #ifdef DEBUG - if (PR_LOG_TEST(gCommandLog, PR_LOG_NOTICE)) { + if (MOZ_LOG_TEST(gCommandLog, LogLevel::Debug)) { nsAutoCString aeventsC, atargetsC; CopyUTF16toUTF8(aEvents, aeventsC); CopyUTF16toUTF8(aTargets, atargetsC); - PR_LOG(gCommandLog, PR_LOG_NOTICE, + MOZ_LOG(gCommandLog, LogLevel::Debug, ("xulcmd[%p] add %p(events=%s targets=%s)", this, aElement, aeventsC.get(), @@ -331,11 +331,11 @@ nsXULCommandDispatcher::RemoveCommandUpdater(nsIDOMElement* aElement) while (updater) { if (updater->mElement == aElement) { #ifdef DEBUG - if (PR_LOG_TEST(gCommandLog, PR_LOG_NOTICE)) { + if (MOZ_LOG_TEST(gCommandLog, LogLevel::Debug)) { nsAutoCString eventsC, targetsC; eventsC.AssignWithConversion(updater->mEvents); targetsC.AssignWithConversion(updater->mTargets); - PR_LOG(gCommandLog, PR_LOG_NOTICE, + MOZ_LOG(gCommandLog, LogLevel::Debug, ("xulcmd[%p] remove %p(events=%s targets=%s)", this, aElement, eventsC.get(), @@ -391,10 +391,10 @@ nsXULCommandDispatcher::UpdateCommands(const nsAString& aEventName) nsIContent* content = updaters[u]; #ifdef DEBUG - if (PR_LOG_TEST(gCommandLog, PR_LOG_NOTICE)) { + if (MOZ_LOG_TEST(gCommandLog, LogLevel::Debug)) { nsAutoCString aeventnameC; CopyUTF16toUTF8(aEventName, aeventnameC); - PR_LOG(gCommandLog, PR_LOG_NOTICE, + MOZ_LOG(gCommandLog, LogLevel::Debug, ("xulcmd[%p] update %p event=%s", this, content, aeventnameC.get())); diff --git a/dom/xul/nsXULContentSink.cpp b/dom/xul/nsXULContentSink.cpp index 4abb7ea075..f10f9ffbd4 100644 --- a/dom/xul/nsXULContentSink.cpp +++ b/dom/xul/nsXULContentSink.cpp @@ -491,7 +491,7 @@ XULContentSinkImpl::HandleStartElement(const char16_t *aName, case eInEpilog: case eInScript: - PR_LOG(gContentSinkLog, PR_LOG_WARNING, + MOZ_LOG(gContentSinkLog, LogLevel::Warning, ("xul: warning: unexpected tags in epilog at line %d", aLineNumber)); rv = NS_ERROR_UNEXPECTED; // XXX @@ -751,7 +751,7 @@ XULContentSinkImpl::OpenRoot(const char16_t** aAttributes, if (aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XHTML) || aNodeInfo->Equals(nsGkAtoms::script, kNameSpaceID_XUL)) { - PR_LOG(gContentSinkLog, PR_LOG_ERROR, + MOZ_LOG(gContentSinkLog, LogLevel::Error, ("xul: script tag not allowed as root content element")); return NS_ERROR_UNEXPECTED; @@ -762,10 +762,10 @@ XULContentSinkImpl::OpenRoot(const char16_t** aAttributes, rv = CreateElement(aNodeInfo, &element); if (NS_FAILED(rv)) { - if (PR_LOG_TEST(gContentSinkLog, PR_LOG_ERROR)) { + if (MOZ_LOG_TEST(gContentSinkLog, LogLevel::Error)) { nsAutoString anodeC; aNodeInfo->GetName(anodeC); - PR_LOG(gContentSinkLog, PR_LOG_ERROR, + MOZ_LOG(gContentSinkLog, LogLevel::Error, ("xul: unable to create element '%s' at line %d", NS_ConvertUTF16toUTF8(anodeC).get(), -1)); // XXX pass in line number @@ -803,10 +803,10 @@ XULContentSinkImpl::OpenTag(const char16_t** aAttributes, rv = CreateElement(aNodeInfo, &element); if (NS_FAILED(rv)) { - if (PR_LOG_TEST(gContentSinkLog, PR_LOG_ERROR)) { + if (MOZ_LOG_TEST(gContentSinkLog, LogLevel::Error)) { nsAutoString anodeC; aNodeInfo->GetName(anodeC); - PR_LOG(gContentSinkLog, PR_LOG_ERROR, + MOZ_LOG(gContentSinkLog, LogLevel::Error, ("xul: unable to create element '%s' at line %d", NS_ConvertUTF16toUTF8(anodeC).get(), aLineNumber)); @@ -1021,7 +1021,7 @@ XULContentSinkImpl::AddAttributes(const char16_t** aAttributes, mDocumentURL); NS_ENSURE_SUCCESS(rv, rv); - if (PR_LOG_TEST(gContentSinkLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gContentSinkLog, LogLevel::Debug)) { nsAutoString extraWhiteSpace; int32_t cnt = mContextStack.Depth(); while (--cnt >= 0) @@ -1029,7 +1029,7 @@ XULContentSinkImpl::AddAttributes(const char16_t** aAttributes, nsAutoString qnameC,valueC; qnameC.Assign(aAttributes[0]); valueC.Assign(aAttributes[1]); - PR_LOG(gContentSinkLog, PR_LOG_DEBUG, + MOZ_LOG(gContentSinkLog, LogLevel::Debug, ("xul: %.5d. %s %s=%s", -1, // XXX pass in line number NS_ConvertUTF16toUTF8(extraWhiteSpace).get(), diff --git a/dom/xul/templates/nsContentTestNode.cpp b/dom/xul/templates/nsContentTestNode.cpp index 1609f62492..215fc5e410 100644 --- a/dom/xul/templates/nsContentTestNode.cpp +++ b/dom/xul/templates/nsContentTestNode.cpp @@ -13,6 +13,9 @@ #include "nsXULTemplateQueryProcessorRDF.h" #include "mozilla/Logging.h" + +using mozilla::LogLevel; + extern PRLogModuleInfo* gXULTemplateLog; nsContentTestNode::nsContentTestNode(nsXULTemplateQueryProcessorRDF* aProcessor, @@ -23,7 +26,7 @@ nsContentTestNode::nsContentTestNode(nsXULTemplateQueryProcessorRDF* aProcessor, mRefVariable(aRefVariable), mTag(nullptr) { - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { nsAutoString tag(NS_LITERAL_STRING("(none)")); if (mTag) mTag->ToString(tag); @@ -32,7 +35,7 @@ nsContentTestNode::nsContentTestNode(nsXULTemplateQueryProcessorRDF* aProcessor, if (aRefVariable) aRefVariable->ToString(refvar); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsContentTestNode[%p]: ref-var=%s tag=%s", this, NS_ConvertUTF16toUTF8(refvar).get(), NS_ConvertUTF16toUTF8(tag).get())); diff --git a/dom/xul/templates/nsInstantiationNode.cpp b/dom/xul/templates/nsInstantiationNode.cpp index cac5d18f7e..ad6c621066 100644 --- a/dom/xul/templates/nsInstantiationNode.cpp +++ b/dom/xul/templates/nsInstantiationNode.cpp @@ -15,7 +15,7 @@ nsInstantiationNode::nsInstantiationNode(nsXULTemplateQueryProcessorRDF* aProces : mProcessor(aProcessor), mQuery(aQuery) { - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsInstantiationNode[%p] query=%p", this, aQuery)); MOZ_COUNT_CTOR(nsInstantiationNode); diff --git a/dom/xul/templates/nsRDFConInstanceTestNode.cpp b/dom/xul/templates/nsRDFConInstanceTestNode.cpp index c8f1eb1e0f..4e41d40489 100644 --- a/dom/xul/templates/nsRDFConInstanceTestNode.cpp +++ b/dom/xul/templates/nsRDFConInstanceTestNode.cpp @@ -13,6 +13,9 @@ #include "mozilla/Logging.h" #include "nsXULContentUtils.h" + +using mozilla::LogLevel; + extern PRLogModuleInfo* gXULTemplateLog; static const char* @@ -36,7 +39,7 @@ nsRDFConInstanceTestNode::nsRDFConInstanceTestNode(TestNode* aParent, mContainer(aContainer), mEmpty(aEmpty) { - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { nsAutoCString props; nsResourceSet& containmentProps = aProcessor->ContainmentProperties(); @@ -58,7 +61,7 @@ nsRDFConInstanceTestNode::nsRDFConInstanceTestNode(TestNode* aParent, if (mContainerVariable) mContainerVariable->ToString(cvar); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsRDFConInstanceTestNode[%p]: parent=%p member-props=(%s) container-var=%s container=%s empty=%s", this, aParent, @@ -100,11 +103,11 @@ nsRDFConInstanceTestNode::FilterInstantiations(InstantiationSet& aInstantiations continue; } - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* container = "(unbound)"; valueres->GetValueConst(&container); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsRDFConInstanceTestNode[%p]::FilterInstantiations() container=[%s]", this, container)); } @@ -192,11 +195,11 @@ nsRDFConInstanceTestNode::FilterInstantiations(InstantiationSet& aInstantiations } } - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, (" empty => %s", (empty == mEmpty) ? "consistent" : "inconsistent")); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, (" container => %s", (container == mContainer) ? "consistent" : "inconsistent")); @@ -245,7 +248,7 @@ nsRDFConInstanceTestNode::CanPropagate(nsIRDFResource* aSource, canpropagate = mProcessor->ContainmentProperties().Contains(aProperty); } - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* source; aSource->GetValueConst(&source); @@ -255,7 +258,7 @@ nsRDFConInstanceTestNode::CanPropagate(nsIRDFResource* aSource, nsAutoString target; nsXULContentUtils::GetTextForNode(aTarget, target); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsRDFConInstanceTestNode[%p]: CanPropagate([%s]==[%s]=>[%s]) => %s", this, source, property, NS_ConvertUTF16toUTF8(target).get(), canpropagate ? "true" : "false")); diff --git a/dom/xul/templates/nsRDFConMemberTestNode.cpp b/dom/xul/templates/nsRDFConMemberTestNode.cpp index a2f074449e..d6389b0e17 100644 --- a/dom/xul/templates/nsRDFConMemberTestNode.cpp +++ b/dom/xul/templates/nsRDFConMemberTestNode.cpp @@ -13,6 +13,9 @@ #include "nsXULContentUtils.h" #include "mozilla/Logging.h" + +using mozilla::LogLevel; + extern PRLogModuleInfo* gXULTemplateLog; nsRDFConMemberTestNode::nsRDFConMemberTestNode(TestNode* aParent, @@ -24,7 +27,7 @@ nsRDFConMemberTestNode::nsRDFConMemberTestNode(TestNode* aParent, mContainerVariable(aContainerVariable), mMemberVariable(aMemberVariable) { - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { nsAutoCString props; nsResourceSet& containmentProps = aProcessor->ContainmentProperties(); @@ -50,7 +53,7 @@ nsRDFConMemberTestNode::nsRDFConMemberTestNode(TestNode* aParent, if (mMemberVariable) mMemberVariable->ToString(mvar); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsRDFConMemberTestNode[%p]: parent=%p member-props=(%s) container-var=%s member-var=%s", this, aParent, @@ -111,7 +114,7 @@ nsRDFConMemberTestNode::FilterInstantiations(InstantiationSet& aInstantiations, hasMemberBinding = inst->mAssignments.GetAssignmentFor(mMemberVariable, getter_AddRefs(memberValue)); - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* container = "(unbound)"; if (hasContainerBinding) containerRes->GetValueConst(&container); @@ -120,7 +123,7 @@ nsRDFConMemberTestNode::FilterInstantiations(InstantiationSet& aInstantiations, if (hasMemberBinding) nsXULContentUtils::GetTextForNode(memberValue, member); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsRDFConMemberTestNode[%p]: FilterInstantiations() container=[%s] member=[%s]", this, container, NS_ConvertUTF16toUTF8(member).get())); } @@ -168,7 +171,7 @@ nsRDFConMemberTestNode::FilterInstantiations(InstantiationSet& aInstantiations, } } - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, (" consistency check => %s", isconsistent ? "passed" : "failed")); if (isconsistent) { @@ -215,11 +218,11 @@ nsRDFConMemberTestNode::FilterInstantiations(InstantiationSet& aInstantiations, if (! node) return NS_ERROR_UNEXPECTED; - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { nsAutoString member; nsXULContentUtils::GetTextForNode(node, member); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, (" member => %s", NS_ConvertUTF16toUTF8(member).get())); } @@ -302,11 +305,11 @@ nsRDFConMemberTestNode::FilterInstantiations(InstantiationSet& aInstantiations, if (! source) return NS_ERROR_UNEXPECTED; - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* container; source->GetValueConst(&container); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, (" container => %s", container)); } @@ -372,11 +375,11 @@ nsRDFConMemberTestNode::FilterInstantiations(InstantiationSet& aInstantiations, NS_ASSERTION(value != nullptr, "member is not an nsIRDFNode"); if (! value) continue; - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { nsAutoString s; nsXULContentUtils::GetTextForNode(value, s); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, (" member => %s", NS_ConvertUTF16toUTF8(s).get())); } } @@ -389,11 +392,11 @@ nsRDFConMemberTestNode::FilterInstantiations(InstantiationSet& aInstantiations, value = valueRes; - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* s; valueRes->GetValueConst(&s); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, (" container => %s", s)); } } @@ -466,7 +469,7 @@ nsRDFConMemberTestNode::CanPropagate(nsIRDFResource* aSource, canpropagate = mProcessor->ContainmentProperties().Contains(aProperty); } - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* source; aSource->GetValueConst(&source); @@ -476,7 +479,7 @@ nsRDFConMemberTestNode::CanPropagate(nsIRDFResource* aSource, nsAutoString target; nsXULContentUtils::GetTextForNode(aTarget, target); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsRDFConMemberTestNode[%p]: CanPropagate([%s]==[%s]=>[%s]) => %s", this, source, property, NS_ConvertUTF16toUTF8(target).get(), canpropagate ? "true" : "false")); diff --git a/dom/xul/templates/nsRDFPropertyTestNode.cpp b/dom/xul/templates/nsRDFPropertyTestNode.cpp index 3a68afb462..7f8e3891af 100644 --- a/dom/xul/templates/nsRDFPropertyTestNode.cpp +++ b/dom/xul/templates/nsRDFPropertyTestNode.cpp @@ -8,6 +8,9 @@ #include "nsXULContentUtils.h" #include "mozilla/Logging.h" + +using mozilla::LogLevel; + extern PRLogModuleInfo* gXULTemplateLog; #include "nsIRDFLiteral.h" @@ -24,7 +27,7 @@ nsRDFPropertyTestNode::nsRDFPropertyTestNode(TestNode* aParent, mTargetVariable(aTargetVariable), mTarget(nullptr) { - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* prop = "(null)"; if (aProperty) aProperty->GetValueConst(&prop); @@ -37,7 +40,7 @@ nsRDFPropertyTestNode::nsRDFPropertyTestNode(TestNode* aParent, if (mTargetVariable) mTargetVariable->ToString(tvar); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsRDFPropertyTestNode[%p]: parent=%p source=%s property=%s target=%s", this, aParent, NS_ConvertUTF16toUTF8(svar).get(), prop, NS_ConvertUTF16toUTF8(tvar).get())); } @@ -57,7 +60,7 @@ nsRDFPropertyTestNode::nsRDFPropertyTestNode(TestNode* aParent, mTargetVariable(aTargetVariable), mTarget(nullptr) { - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* source = "(null)"; if (aSource) aSource->GetValueConst(&source); @@ -70,7 +73,7 @@ nsRDFPropertyTestNode::nsRDFPropertyTestNode(TestNode* aParent, if (mTargetVariable) mTargetVariable->ToString(tvar); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsRDFPropertyTestNode[%p]: parent=%p source=%s property=%s target=%s", this, aParent, source, prop, NS_ConvertUTF16toUTF8(tvar).get())); } @@ -90,7 +93,7 @@ nsRDFPropertyTestNode::nsRDFPropertyTestNode(TestNode* aParent, mTargetVariable(0), mTarget(aTarget) { - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { nsAutoString svar(NS_LITERAL_STRING("(none)")); if (mSourceVariable) mSourceVariable->ToString(svar); @@ -102,7 +105,7 @@ nsRDFPropertyTestNode::nsRDFPropertyTestNode(TestNode* aParent, nsAutoString target; nsXULContentUtils::GetTextForNode(aTarget, target); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsRDFPropertyTestNode[%p]: parent=%p source=%s property=%s target=%s", this, aParent, NS_ConvertUTF16toUTF8(svar).get(), prop, NS_ConvertUTF16toUTF8(target).get())); } @@ -148,7 +151,7 @@ nsRDFPropertyTestNode::FilterInstantiations(InstantiationSet& aInstantiations, getter_AddRefs(targetValue)); } - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* source = "(unbound)"; if (hasSourceBinding) sourceRes->GetValueConst(&source); @@ -157,7 +160,7 @@ nsRDFPropertyTestNode::FilterInstantiations(InstantiationSet& aInstantiations, if (hasTargetBinding) nsXULContentUtils::GetTextForNode(targetValue, target); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsRDFPropertyTestNode[%p]: FilterInstantiations() source=[%s] target=[%s]", this, source, NS_ConvertUTF16toUTF8(target).get())); } @@ -169,7 +172,7 @@ nsRDFPropertyTestNode::FilterInstantiations(InstantiationSet& aInstantiations, true, &hasAssertion); if (NS_FAILED(rv)) return rv; - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, (" consistency check => %s", hasAssertion ? "passed" : "failed")); if (hasAssertion) { @@ -229,12 +232,12 @@ nsRDFPropertyTestNode::FilterInstantiations(InstantiationSet& aInstantiations, value = do_QueryInterface(isupports); NS_ASSERTION(value != nullptr, "target is not an nsIRDFNode"); - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { nsAutoString s(NS_LITERAL_STRING("(none found)")); if (value) nsXULContentUtils::GetTextForNode(value, s); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, (" target => %s", NS_ConvertUTF16toUTF8(s).get())); } @@ -248,12 +251,12 @@ nsRDFPropertyTestNode::FilterInstantiations(InstantiationSet& aInstantiations, nsCOMPtr source = do_QueryInterface(isupports); NS_ASSERTION(source != nullptr, "source is not an nsIRDFResource"); - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* s = "(none found)"; if (source) source->GetValueConst(&s); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, (" source => %s", s)); } @@ -321,7 +324,7 @@ nsRDFPropertyTestNode::CanPropagate(nsIRDFResource* aSource, result = true; } - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* source; aSource->GetValueConst(&source); @@ -331,7 +334,7 @@ nsRDFPropertyTestNode::CanPropagate(nsIRDFResource* aSource, nsAutoString target; nsXULContentUtils::GetTextForNode(aTarget, target); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsRDFPropertyTestNode[%p]: CanPropagate([%s]==[%s]=>[%s]) => %s", this, source, property, NS_ConvertUTF16toUTF8(target).get(), result ? "true" : "false")); @@ -346,7 +349,7 @@ nsRDFPropertyTestNode::Retract(nsIRDFResource* aSource, nsIRDFNode* aTarget) const { if (aProperty == mProperty.get()) { - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* source; aSource->GetValueConst(&source); @@ -356,7 +359,7 @@ nsRDFPropertyTestNode::Retract(nsIRDFResource* aSource, nsAutoString target; nsXULContentUtils::GetTextForNode(aTarget, target); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsRDFPropertyTestNode[%p]: Retract([%s]==[%s]=>[%s])", this, source, property, NS_ConvertUTF16toUTF8(target).get())); } diff --git a/dom/xul/templates/nsRuleNetwork.cpp b/dom/xul/templates/nsRuleNetwork.cpp index 80331026d3..4354768d9e 100644 --- a/dom/xul/templates/nsRuleNetwork.cpp +++ b/dom/xul/templates/nsRuleNetwork.cpp @@ -294,7 +294,7 @@ nsresult TestNode::Propagate(InstantiationSet& aInstantiations, bool aIsUpdate, bool& aTakenInstantiations) { - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("TestNode[%p]: Propagate() begin", this)); aTakenInstantiations = false; @@ -313,7 +313,7 @@ TestNode::Propagate(InstantiationSet& aInstantiations, if (! aInstantiations.Empty()) { ReteNodeSet::Iterator last = mKids.Last(); for (ReteNodeSet::Iterator kid = mKids.First(); kid != last; ++kid) { - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("TestNode[%p]: Propagate() passing to child %p", this, kid.operator->())); // create a copy of the instantiations @@ -337,7 +337,7 @@ TestNode::Propagate(InstantiationSet& aInstantiations, } } - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("TestNode[%p]: Propagate() end", this)); return NS_OK; @@ -349,7 +349,7 @@ TestNode::Constrain(InstantiationSet& aInstantiations) { nsresult rv; - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("TestNode[%p]: Constrain() begin", this)); // if the cantHandleYet flag is set by FilterInstantiations, @@ -366,7 +366,7 @@ TestNode::Constrain(InstantiationSet& aInstantiations) // could not be filled in yet, then ride 'em on up to the // parent to narrow them. - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("TestNode[%p]: Constrain() passing to parent %p", this, mParent)); rv = mParent->Constrain(aInstantiations); @@ -375,13 +375,13 @@ TestNode::Constrain(InstantiationSet& aInstantiations) rv = FilterInstantiations(aInstantiations, nullptr); } else { - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("TestNode[%p]: Constrain() failed", this)); rv = NS_OK; } - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("TestNode[%p]: Constrain() end", this)); return rv; diff --git a/dom/xul/templates/nsXULContentBuilder.cpp b/dom/xul/templates/nsXULContentBuilder.cpp index 8434bdc01e..e6e3e050f1 100644 --- a/dom/xul/templates/nsXULContentBuilder.cpp +++ b/dom/xul/templates/nsXULContentBuilder.cpp @@ -446,15 +446,15 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode, nsresult rv; - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { - PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS, + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsXULContentBuilder::BuildContentFromTemplate (is unique: %d)", aIsUnique)); nsAutoString id; aChild->GetId(id); - PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("Tags: [Template: %s Resource: %s Real: %s] for id %s", nsAtomCString(aTemplateNode->NodeInfo()->NameAtom()).get(), nsAtomCString(aResourceNode->NodeInfo()->NameAtom()).get(), @@ -523,8 +523,8 @@ nsXULContentBuilder::BuildContentFromTemplate(nsIContent *aTemplateNode, nsIAtom *tag = tmplKid->NodeInfo()->NameAtom(); - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("xultemplate[%p] building %s %s %s", this, nsAtomCString(tag).get(), (isGenerationElement ? "[resource]" : ""), @@ -939,7 +939,7 @@ nsXULContentBuilder::CreateTemplateAndContainerContents(nsIContent* aElement, // and 2) recursive subcontent (if the current element refers to a // container result). - PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS, + MOZ_LOG(gXULTemplateLog, LogLevel::Info, ("nsXULContentBuilder::CreateTemplateAndContainerContents start - flags: %d", mFlags)); @@ -975,7 +975,7 @@ nsXULContentBuilder::CreateTemplateAndContainerContents(nsIContent* aElement, false, true); } - PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS, + MOZ_LOG(gXULTemplateLog, LogLevel::Info, ("nsXULContentBuilder::CreateTemplateAndContainerContents end")); return NS_OK; @@ -1073,10 +1073,10 @@ nsXULContentBuilder::CreateContainerContentsForQuerySet(nsIContent* aElement, nsIContent** aContainer, int32_t* aNewIndexInContainer) { - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { nsAutoString id; aResult->GetId(id); - PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsXULContentBuilder::CreateContainerContentsForQuerySet start for ref %s\n", NS_ConvertUTF16toUTF8(id).get())); } diff --git a/dom/xul/templates/nsXULContentUtils.cpp b/dom/xul/templates/nsXULContentUtils.cpp index 415397ed12..b563f6d684 100644 --- a/dom/xul/templates/nsXULContentUtils.cpp +++ b/dom/xul/templates/nsXULContentUtils.cpp @@ -363,6 +363,6 @@ nsXULContentUtils::LogTemplateError(const char* aStr) nsCOMPtr cs = do_GetService(NS_CONSOLESERVICE_CONTRACTID); if (cs) { cs->LogStringMessage(message.get()); - PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS, ("Error parsing template: %s", aStr)); + MOZ_LOG(gXULTemplateLog, LogLevel::Info, ("Error parsing template: %s", aStr)); } } diff --git a/dom/xul/templates/nsXULTemplateBuilder.cpp b/dom/xul/templates/nsXULTemplateBuilder.cpp index cf3cd0cc7f..82e7fcfe7e 100644 --- a/dom/xul/templates/nsXULTemplateBuilder.cpp +++ b/dom/xul/templates/nsXULTemplateBuilder.cpp @@ -502,7 +502,7 @@ nsXULTemplateBuilder::UpdateResult(nsIXULTemplateResult* aOldResult, nsIXULTemplateResult* aNewResult, nsIDOMNode* aQueryNode) { - PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS, + MOZ_LOG(gXULTemplateLog, LogLevel::Info, ("nsXULTemplateBuilder::UpdateResult %p %p %p", aOldResult, aNewResult, aQueryNode)); @@ -1711,7 +1711,7 @@ nsXULTemplateBuilder::CompileQueries() } // always enable logging if the debug setting is used - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) mFlags |= eLoggingEnabled; nsCOMPtr rootnode = do_QueryInterface(mRoot); diff --git a/dom/xul/templates/nsXULTemplateQueryProcessorRDF.cpp b/dom/xul/templates/nsXULTemplateQueryProcessorRDF.cpp index 4914dd1751..dddaef2826 100644 --- a/dom/xul/templates/nsXULTemplateQueryProcessorRDF.cpp +++ b/dom/xul/templates/nsXULTemplateQueryProcessorRDF.cpp @@ -483,7 +483,7 @@ nsXULTemplateQueryProcessorRDF::GenerateResults(nsISupports* aDatasource, mLastRef = aRef; } - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { nsAutoString id; aRef->GetId(id); @@ -492,7 +492,7 @@ nsXULTemplateQueryProcessorRDF::GenerateResults(nsISupports* aDatasource, nsAutoString mvar; query->mMemberVariable->ToString(mvar); - PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("QueryProcessor::GenerateResults using ref %s and vars [ ref: %s member: %s]", NS_ConvertUTF16toUTF8(id).get(), NS_ConvertUTF16toUTF8(rvar).get(), @@ -863,7 +863,7 @@ nsXULTemplateQueryProcessorRDF::Propagate(nsIRDFResource* aSource, ReteNodeSet livenodes; - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* sourceStr; aSource->GetValueConst(&sourceStr); const char* propertyStr; @@ -871,7 +871,7 @@ nsXULTemplateQueryProcessorRDF::Propagate(nsIRDFResource* aSource, nsAutoString targetStr; nsXULContentUtils::GetTextForNode(aTarget, targetStr); - PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsXULTemplateQueryProcessorRDF::Propagate: [%s] -> [%s] -> [%s]\n", sourceStr, propertyStr, NS_ConvertUTF16toUTF8(targetStr).get())); } @@ -950,7 +950,7 @@ nsXULTemplateQueryProcessorRDF::Retract(nsIRDFResource* aSource, nsIRDFNode* aTarget) { - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { const char* sourceStr; aSource->GetValueConst(&sourceStr); const char* propertyStr; @@ -958,7 +958,7 @@ nsXULTemplateQueryProcessorRDF::Retract(nsIRDFResource* aSource, nsAutoString targetStr; nsXULContentUtils::GetTextForNode(aTarget, targetStr); - PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("nsXULTemplateQueryProcessorRDF::Retract: [%s] -> [%s] -> [%s]\n", sourceStr, propertyStr, NS_ConvertUTF16toUTF8(targetStr).get())); } @@ -1023,7 +1023,7 @@ nsXULTemplateQueryProcessorRDF::Log(const char* aOperation, nsIRDFResource* aProperty, nsIRDFNode* aTarget) { - if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Debug)) { nsresult rv; const char* sourceStr; @@ -1031,7 +1031,7 @@ nsXULTemplateQueryProcessorRDF::Log(const char* aOperation, if (NS_FAILED(rv)) return rv; - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("xultemplate[%p] %8s [%s]--", this, aOperation, sourceStr)); const char* propertyStr; @@ -1046,7 +1046,7 @@ nsXULTemplateQueryProcessorRDF::Log(const char* aOperation, nsAutoCString targetstrC; targetstrC.AssignWithConversion(targetStr); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, (" --[%s]-->[%s]", propertyStr, targetstrC.get())); @@ -1269,13 +1269,13 @@ nsXULTemplateQueryProcessorRDF::CompileQueryChild(nsIAtom* aTag, else if (aTag == nsGkAtoms::member) { rv = CompileMemberCondition(aQuery, aCondition, aParentNode, aResult); } - else if (PR_LOG_TEST(gXULTemplateLog, PR_LOG_ALWAYS)) { + else if (MOZ_LOG_TEST(gXULTemplateLog, LogLevel::Info)) { nsAutoString tagstr; aTag->ToString(tagstr); nsAutoCString tagstrC; tagstrC.AssignWithConversion(tagstr); - PR_LOG(gXULTemplateLog, PR_LOG_ALWAYS, + MOZ_LOG(gXULTemplateLog, LogLevel::Info, ("xultemplate[%p] unrecognized condition test <%s>", this, tagstrC.get())); } diff --git a/dom/xul/templates/nsXULTreeBuilder.cpp b/dom/xul/templates/nsXULTreeBuilder.cpp index c482050bf5..f94fbd9d1c 100644 --- a/dom/xul/templates/nsXULTreeBuilder.cpp +++ b/dom/xul/templates/nsXULTreeBuilder.cpp @@ -1230,7 +1230,7 @@ nsXULTreeBuilder::SynchronizeResult(nsIXULTemplateResult* aResult) if (row >= 0) mBoxObject->InvalidateRow(row); - PR_LOG(gXULTemplateLog, PR_LOG_DEBUG, + MOZ_LOG(gXULTemplateLog, LogLevel::Debug, ("xultemplate[%p] => row %d", this, row)); } diff --git a/extensions/auth/nsAuth.h b/extensions/auth/nsAuth.h index 1d60de84c9..6abee650e2 100644 --- a/extensions/auth/nsAuth.h +++ b/extensions/auth/nsAuth.h @@ -22,6 +22,6 @@ enum pType { // extern PRLogModuleInfo* gNegotiateLog; -#define LOG(args) PR_LOG(gNegotiateLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gNegotiateLog, mozilla::LogLevel::Debug, args) #endif /* !defined( nsAuth_h__ ) */ diff --git a/extensions/auth/nsAuthGSSAPI.cpp b/extensions/auth/nsAuthGSSAPI.cpp index d734f36819..bc4a8e4a0f 100644 --- a/extensions/auth/nsAuthGSSAPI.cpp +++ b/extensions/auth/nsAuthGSSAPI.cpp @@ -231,7 +231,7 @@ gssInit() void LogGssError(OM_uint32 maj_stat, OM_uint32 min_stat, const char *prefix) { - if (!PR_LOG_TEST(gNegotiateLog, PR_LOG_DEBUG)) { + if (!MOZ_LOG_TEST(gNegotiateLog, LogLevel::Debug)) { return; } diff --git a/extensions/gio/nsGIOProtocolHandler.cpp b/extensions/gio/nsGIOProtocolHandler.cpp index 1867e9c55e..8172090f35 100644 --- a/extensions/gio/nsGIOProtocolHandler.cpp +++ b/extensions/gio/nsGIOProtocolHandler.cpp @@ -29,7 +29,7 @@ // NSPR_LOG_MODULES=gio:5 static PRLogModuleInfo *sGIOLog; -#define LOG(args) PR_LOG(sGIOLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(sGIOLog, mozilla::LogLevel::Debug, args) //----------------------------------------------------------------------------- diff --git a/extensions/pref/autoconfig/src/nsAutoConfig.cpp b/extensions/pref/autoconfig/src/nsAutoConfig.cpp index 63368902df..f890977910 100644 --- a/extensions/pref/autoconfig/src/nsAutoConfig.cpp +++ b/extensions/pref/autoconfig/src/nsAutoConfig.cpp @@ -20,6 +20,10 @@ #include "nspr.h" #include +#include "mozilla/Logging.h" + +using mozilla::LogLevel; + PRLogModuleInfo *MCD; extern nsresult EvaluateAdminConfigScript(const char *js_buffer, size_t length, @@ -120,7 +124,7 @@ nsAutoConfig::OnStopRequest(nsIRequest *request, nsISupports *context, // If the request is failed, go read the failover.jsc file if (NS_FAILED(aStatus)) { - PR_LOG(MCD, PR_LOG_DEBUG, ("mcd request failed with status %x\n", aStatus)); + MOZ_LOG(MCD, LogLevel::Debug, ("mcd request failed with status %x\n", aStatus)); return readOfflineFile(); } @@ -131,7 +135,7 @@ nsAutoConfig::OnStopRequest(nsIRequest *request, nsISupports *context, pHTTPCon->GetResponseStatus(&httpStatus); if (httpStatus != 200) { - PR_LOG(MCD, PR_LOG_DEBUG, ("mcd http request failed with status %x\n", httpStatus)); + MOZ_LOG(MCD, LogLevel::Debug, ("mcd http request failed with status %x\n", httpStatus)); return readOfflineFile(); } } @@ -196,7 +200,7 @@ nsresult nsAutoConfig::downloadAutoConfig() static bool firstTime = true; if (mConfigURL.IsEmpty()) { - PR_LOG(MCD, PR_LOG_DEBUG, ("global config url is empty - did you set autoadmin.global_config_url?\n")); + MOZ_LOG(MCD, LogLevel::Debug, ("global config url is empty - did you set autoadmin.global_config_url?\n")); NS_WARNING("AutoConfig called without global_config_url"); return NS_OK; } @@ -270,11 +274,11 @@ nsresult nsAutoConfig::downloadAutoConfig() rv = NS_NewURI(getter_AddRefs(url), mConfigURL.get(), nullptr, nullptr); if (NS_FAILED(rv)) { - PR_LOG(MCD, PR_LOG_DEBUG, ("failed to create URL - is autoadmin.global_config_url valid? - %s\n", mConfigURL.get())); + MOZ_LOG(MCD, LogLevel::Debug, ("failed to create URL - is autoadmin.global_config_url valid? - %s\n", mConfigURL.get())); return rv; } - PR_LOG(MCD, PR_LOG_DEBUG, ("running MCD url %s\n", mConfigURL.get())); + MOZ_LOG(MCD, LogLevel::Debug, ("running MCD url %s\n", mConfigURL.get())); // open a channel for the url rv = NS_NewChannel(getter_AddRefs(channel), url, diff --git a/extensions/pref/autoconfig/src/nsReadConfig.cpp b/extensions/pref/autoconfig/src/nsReadConfig.cpp index 85a0c148ad..b58ef12680 100644 --- a/extensions/pref/autoconfig/src/nsReadConfig.cpp +++ b/extensions/pref/autoconfig/src/nsReadConfig.cpp @@ -140,7 +140,7 @@ nsresult nsReadConfig::readConfigFile() getter_Copies(lockFileName)); - PR_LOG(MCD, PR_LOG_DEBUG, ("general.config.filename = %s\n", lockFileName.get())); + MOZ_LOG(MCD, LogLevel::Debug, ("general.config.filename = %s\n", lockFileName.get())); if (NS_FAILED(rv)) return rv; @@ -179,11 +179,11 @@ nsresult nsReadConfig::readConfigFile() int32_t obscureValue = 0; (void) defaultPrefBranch->GetIntPref("general.config.obscure_value", &obscureValue); - PR_LOG(MCD, PR_LOG_DEBUG, ("evaluating .cfg file %s with obscureValue %d\n", lockFileName.get(), obscureValue)); + MOZ_LOG(MCD, LogLevel::Debug, ("evaluating .cfg file %s with obscureValue %d\n", lockFileName.get(), obscureValue)); rv = openAndEvaluateJSFile(lockFileName.get(), obscureValue, true, true); if (NS_FAILED(rv)) { - PR_LOG(MCD, PR_LOG_DEBUG, ("error evaluating .cfg file %s %x\n", lockFileName.get(), rv)); + MOZ_LOG(MCD, LogLevel::Debug, ("error evaluating .cfg file %s %x\n", lockFileName.get(), rv)); return rv; } diff --git a/gfx/2d/Logging.h b/gfx/2d/Logging.h index 25962f5079..4a3347b73e 100644 --- a/gfx/2d/Logging.h +++ b/gfx/2d/Logging.h @@ -42,20 +42,20 @@ const int LOG_DEFAULT = LOG_EVERYTHING; const int LOG_DEFAULT = LOG_CRITICAL; #endif -inline PRLogModuleLevel PRLogLevelForLevel(int aLevel) { +inline mozilla::LogLevel PRLogLevelForLevel(int aLevel) { switch (aLevel) { case LOG_CRITICAL: - return PR_LOG_ERROR; + return LogLevel::Error; case LOG_WARNING: - return PR_LOG_WARNING; + return LogLevel::Warning; case LOG_DEBUG: - return PR_LOG_DEBUG; + return LogLevel::Debug; case LOG_DEBUG_PRLOG: - return PR_LOG_DEBUG; + return LogLevel::Debug; case LOG_EVERYTHING: - return PR_LOG_ALWAYS; + return LogLevel::Error; } - return PR_LOG_DEBUG; + return LogLevel::Debug; } class PreferenceAccess @@ -133,7 +133,7 @@ struct BasicLogger #if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_ANDROID) return true; #else - if (PR_LOG_TEST(GetGFX2DLog(), PRLogLevelForLevel(aLevel))) { + if (MOZ_LOG_TEST(GetGFX2DLog(), PRLogLevelForLevel(aLevel))) { return true; } else if ((PreferenceAccess::sGfxLogLevel >= LOG_DEBUG_PRLOG) || (aLevel < LOG_DEBUG)) { @@ -160,7 +160,7 @@ struct BasicLogger #if defined(MOZ_WIDGET_GONK) || defined(MOZ_WIDGET_ANDROID) printf_stderr("%s%s", aString.c_str(), aNoNewline ? "" : "\n"); #else - if (PR_LOG_TEST(GetGFX2DLog(), PRLogLevelForLevel(aLevel))) { + if (MOZ_LOG_TEST(GetGFX2DLog(), PRLogLevelForLevel(aLevel))) { PR_LogPrint("%s%s", aString.c_str(), aNoNewline ? "" : "\n"); } else if ((PreferenceAccess::sGfxLogLevel >= LOG_DEBUG_PRLOG) || (aLevel < LOG_DEBUG)) { diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 906fc995fb..ac76d4f683 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -2172,7 +2172,7 @@ LayerManager::IsLogEnabled() { MOZ_ASSERT(!!sLog, "layer manager must be created before logging is allowed"); - return PR_LOG_TEST(sLog, PR_LOG_DEBUG); + return MOZ_LOG_TEST(sLog, LogLevel::Debug); } void diff --git a/gfx/layers/LayersTypes.h b/gfx/layers/LayersTypes.h index f59560d14d..60e0dcceb7 100644 --- a/gfx/layers/LayersTypes.h +++ b/gfx/layers/LayersTypes.h @@ -21,9 +21,9 @@ # define MOZ_LAYERS_HAVE_LOG #endif #define MOZ_LAYERS_LOG(_args) \ - PR_LOG(LayerManager::GetLog(), PR_LOG_DEBUG, _args) + MOZ_LOG(LayerManager::GetLog(), LogLevel::Debug, _args) #define MOZ_LAYERS_LOG_IF_SHADOWABLE(layer, _args) \ - do { if (layer->AsShadowableLayer()) { PR_LOG(LayerManager::GetLog(), PR_LOG_DEBUG, _args); } } while (0) + do { if (layer->AsShadowableLayer()) { MOZ_LOG(LayerManager::GetLog(), LogLevel::Debug, _args); } } while (0) #define INVALID_OVERLAY -1 diff --git a/gfx/thebes/gfxDWriteFontList.cpp b/gfx/thebes/gfxDWriteFontList.cpp index 372dbcfeea..f1bdc9a008 100644 --- a/gfx/thebes/gfxDWriteFontList.cpp +++ b/gfx/thebes/gfxDWriteFontList.cpp @@ -27,21 +27,21 @@ using namespace mozilla; -#define LOG_FONTLIST(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \ - PR_LOG_DEBUG, args) -#define LOG_FONTLIST_ENABLED() PR_LOG_TEST( \ +#define LOG_FONTLIST(args) MOZ_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \ + LogLevel::Debug, args) +#define LOG_FONTLIST_ENABLED() MOZ_LOG_TEST( \ gfxPlatform::GetLog(eGfxLog_fontlist), \ - PR_LOG_DEBUG) + LogLevel::Debug) -#define LOG_FONTINIT(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontinit), \ - PR_LOG_DEBUG, args) -#define LOG_FONTINIT_ENABLED() PR_LOG_TEST( \ +#define LOG_FONTINIT(args) MOZ_LOG(gfxPlatform::GetLog(eGfxLog_fontinit), \ + LogLevel::Debug, args) +#define LOG_FONTINIT_ENABLED() MOZ_LOG_TEST( \ gfxPlatform::GetLog(eGfxLog_fontinit), \ - PR_LOG_DEBUG) + LogLevel::Debug) -#define LOG_CMAPDATA_ENABLED() PR_LOG_TEST( \ +#define LOG_CMAPDATA_ENABLED() MOZ_LOG_TEST( \ gfxPlatform::GetLog(eGfxLog_cmapdata), \ - PR_LOG_DEBUG) + LogLevel::Debug) static __inline void BuildKeyNameFromFontName(nsAString &aName) diff --git a/gfx/thebes/gfxFT2FontList.cpp b/gfx/thebes/gfxFT2FontList.cpp index 66a1434eec..b6edd9f423 100644 --- a/gfx/thebes/gfxFT2FontList.cpp +++ b/gfx/thebes/gfxFT2FontList.cpp @@ -60,8 +60,8 @@ GetFontInfoLog() } #undef LOG -#define LOG(args) PR_LOG(GetFontInfoLog(), PR_LOG_DEBUG, args) -#define LOG_ENABLED() PR_LOG_TEST(GetFontInfoLog(), PR_LOG_DEBUG) +#define LOG(args) MOZ_LOG(GetFontInfoLog(), mozilla::LogLevel::Debug, args) +#define LOG_ENABLED() MOZ_LOG_TEST(GetFontInfoLog(), mozilla::LogLevel::Debug) static cairo_user_data_key_t sFTUserFontDataKey; diff --git a/gfx/thebes/gfxFcPlatformFontList.cpp b/gfx/thebes/gfxFcPlatformFontList.cpp index 7dc36fcacd..fc349b8154 100644 --- a/gfx/thebes/gfxFcPlatformFontList.cpp +++ b/gfx/thebes/gfxFcPlatformFontList.cpp @@ -36,14 +36,14 @@ using namespace mozilla::unicode; #define PRINTING_FC_PROPERTY "gfx.printing" -#define LOG_FONTLIST(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \ - PR_LOG_DEBUG, args) -#define LOG_FONTLIST_ENABLED() PR_LOG_TEST( \ +#define LOG_FONTLIST(args) MOZ_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \ + LogLevel::Debug, args) +#define LOG_FONTLIST_ENABLED() MOZ_LOG_TEST( \ gfxPlatform::GetLog(eGfxLog_fontlist), \ - PR_LOG_DEBUG) -#define LOG_CMAPDATA_ENABLED() PR_LOG_TEST( \ + LogLevel::Debug) +#define LOG_CMAPDATA_ENABLED() MOZ_LOG_TEST( \ gfxPlatform::GetLog(eGfxLog_cmapdata), \ - PR_LOG_DEBUG) + LogLevel::Debug) static const FcChar8* ToFcChar8Ptr(const char* aStr) diff --git a/gfx/thebes/gfxFont.cpp b/gfx/thebes/gfxFont.cpp index 0f06797a79..b240442784 100644 --- a/gfx/thebes/gfxFont.cpp +++ b/gfx/thebes/gfxFont.cpp @@ -72,11 +72,11 @@ uint32_t gGlyphExtentsSetupLazyTight = 0; uint32_t gGlyphExtentsSetupFallBackToTight = 0; #endif -#define LOG_FONTINIT(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontinit), \ - PR_LOG_DEBUG, args) -#define LOG_FONTINIT_ENABLED() PR_LOG_TEST( \ +#define LOG_FONTINIT(args) MOZ_LOG(gfxPlatform::GetLog(eGfxLog_fontinit), \ + LogLevel::Debug, args) +#define LOG_FONTINIT_ENABLED() MOZ_LOG_TEST( \ gfxPlatform::GetLog(eGfxLog_fontinit), \ - PR_LOG_DEBUG) + LogLevel::Debug) /* diff --git a/gfx/thebes/gfxFontEntry.cpp b/gfx/thebes/gfxFontEntry.cpp index b7c9ba2700..80214611c9 100644 --- a/gfx/thebes/gfxFontEntry.cpp +++ b/gfx/thebes/gfxFontEntry.cpp @@ -1498,10 +1498,10 @@ gfxFontFamily::FindFontForChar(GlobalFontMatch *aMatchData) PRLogModuleInfo *log = gfxPlatform::GetLog(eGfxLog_textrun); - if (MOZ_UNLIKELY(PR_LOG_TEST(log, PR_LOG_DEBUG))) { + if (MOZ_UNLIKELY(MOZ_LOG_TEST(log, LogLevel::Debug))) { uint32_t unicodeRange = FindCharUnicodeRange(aMatchData->mCh); uint32_t script = GetScriptCode(aMatchData->mCh); - PR_LOG(log, PR_LOG_DEBUG,\ + MOZ_LOG(log, LogLevel::Debug,\ ("(textrun-systemfallback-fonts) char: u+%6.6x " "unicode-range: %d script: %d match: [%s]\n", aMatchData->mCh, diff --git a/gfx/thebes/gfxFontUtils.cpp b/gfx/thebes/gfxFontUtils.cpp index f07aa10364..da07c64152 100644 --- a/gfx/thebes/gfxFontUtils.cpp +++ b/gfx/thebes/gfxFontUtils.cpp @@ -26,8 +26,8 @@ #include "plbase64.h" #include "mozilla/Logging.h" -#define LOG(log, args) PR_LOG(gfxPlatform::GetLog(log), \ - PR_LOG_DEBUG, args) +#define LOG(log, args) MOZ_LOG(gfxPlatform::GetLog(log), \ + LogLevel::Debug, args) #define UNICODE_BMP_LIMIT 0x10000 diff --git a/gfx/thebes/gfxGDIFontList.cpp b/gfx/thebes/gfxGDIFontList.cpp index 31727f51a9..ff94535a85 100644 --- a/gfx/thebes/gfxGDIFontList.cpp +++ b/gfx/thebes/gfxGDIFontList.cpp @@ -40,15 +40,15 @@ using namespace mozilla; #define CLEARTYPE_QUALITY 5 #endif -#define LOG_FONTLIST(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \ - PR_LOG_DEBUG, args) -#define LOG_FONTLIST_ENABLED() PR_LOG_TEST( \ +#define LOG_FONTLIST(args) MOZ_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \ + LogLevel::Debug, args) +#define LOG_FONTLIST_ENABLED() MOZ_LOG_TEST( \ gfxPlatform::GetLog(eGfxLog_fontlist), \ - PR_LOG_DEBUG) + LogLevel::Debug) -#define LOG_CMAPDATA_ENABLED() PR_LOG_TEST( \ +#define LOG_CMAPDATA_ENABLED() MOZ_LOG_TEST( \ gfxPlatform::GetLog(eGfxLog_cmapdata), \ - PR_LOG_DEBUG) + LogLevel::Debug) static __inline void BuildKeyNameFromFontName(nsAString &aName) diff --git a/gfx/thebes/gfxMacPlatformFontList.mm b/gfx/thebes/gfxMacPlatformFontList.mm index 982ae10334..1b12617935 100644 --- a/gfx/thebes/gfxMacPlatformFontList.mm +++ b/gfx/thebes/gfxMacPlatformFontList.mm @@ -129,14 +129,14 @@ static NSString* GetNSStringForString(const nsAString& aSrc) length:aSrc.Length()]; } -#define LOG_FONTLIST(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \ - PR_LOG_DEBUG, args) -#define LOG_FONTLIST_ENABLED() PR_LOG_TEST( \ +#define LOG_FONTLIST(args) MOZ_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \ + mozilla::LogLevel::Debug, args) +#define LOG_FONTLIST_ENABLED() MOZ_LOG_TEST( \ gfxPlatform::GetLog(eGfxLog_fontlist), \ - PR_LOG_DEBUG) -#define LOG_CMAPDATA_ENABLED() PR_LOG_TEST( \ + mozilla::LogLevel::Debug) +#define LOG_CMAPDATA_ENABLED() MOZ_LOG_TEST( \ gfxPlatform::GetLog(eGfxLog_cmapdata), \ - PR_LOG_DEBUG) + mozilla::LogLevel::Debug) #pragma mark- diff --git a/gfx/thebes/gfxPlatformFontList.cpp b/gfx/thebes/gfxPlatformFontList.cpp index f48bc7a952..4c0ed0f15b 100644 --- a/gfx/thebes/gfxPlatformFontList.cpp +++ b/gfx/thebes/gfxPlatformFontList.cpp @@ -23,16 +23,16 @@ using namespace mozilla; -#define LOG_FONTLIST(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \ - PR_LOG_DEBUG, args) -#define LOG_FONTLIST_ENABLED() PR_LOG_TEST( \ +#define LOG_FONTLIST(args) MOZ_LOG(gfxPlatform::GetLog(eGfxLog_fontlist), \ + LogLevel::Debug, args) +#define LOG_FONTLIST_ENABLED() MOZ_LOG_TEST( \ gfxPlatform::GetLog(eGfxLog_fontlist), \ - PR_LOG_DEBUG) -#define LOG_FONTINIT(args) PR_LOG(gfxPlatform::GetLog(eGfxLog_fontinit), \ - PR_LOG_DEBUG, args) -#define LOG_FONTINIT_ENABLED() PR_LOG_TEST( \ + LogLevel::Debug) +#define LOG_FONTINIT(args) MOZ_LOG(gfxPlatform::GetLog(eGfxLog_fontinit), \ + LogLevel::Debug, args) +#define LOG_FONTINIT_ENABLED() MOZ_LOG_TEST( \ gfxPlatform::GetLog(eGfxLog_fontinit), \ - PR_LOG_DEBUG) + LogLevel::Debug) gfxPlatformFontList *gfxPlatformFontList::sPlatformFontList = nullptr; @@ -580,10 +580,10 @@ gfxPlatformFontList::SystemFindFontForChar(uint32_t aCh, uint32_t aNextCh, PRLogModuleInfo *log = gfxPlatform::GetLog(eGfxLog_textrun); - if (MOZ_UNLIKELY(PR_LOG_TEST(log, PR_LOG_WARNING))) { + if (MOZ_UNLIKELY(MOZ_LOG_TEST(log, LogLevel::Warning))) { uint32_t unicodeRange = FindCharUnicodeRange(aCh); int32_t script = mozilla::unicode::GetScriptCode(aCh); - PR_LOG(log, PR_LOG_WARNING,\ + MOZ_LOG(log, LogLevel::Warning,\ ("(textrun-systemfallback-%s) char: u+%6.6x " "unicode-range: %d script: %d match: [%s]" " time: %dus cmaps: %d\n", diff --git a/gfx/thebes/gfxTextRun.cpp b/gfx/thebes/gfxTextRun.cpp index 085808c92a..1189a5faf9 100644 --- a/gfx/thebes/gfxTextRun.cpp +++ b/gfx/thebes/gfxTextRun.cpp @@ -2214,13 +2214,13 @@ gfxFontGroup::InitTextRun(gfxContext *aContext, if (sizeof(T) == sizeof(uint8_t) && !transformedString) { - if (MOZ_UNLIKELY(PR_LOG_TEST(log, PR_LOG_WARNING))) { + if (MOZ_UNLIKELY(MOZ_LOG_TEST(log, LogLevel::Warning))) { nsAutoCString lang; mStyle.language->ToUTF8String(lang); nsAutoString families; mFamilyList.ToString(families); nsAutoCString str((const char*)aString, aLength); - PR_LOG(log, PR_LOG_WARNING,\ + MOZ_LOG(log, LogLevel::Warning,\ ("(%s) fontgroup: [%s] default: %s lang: %s script: %d " "len %d weight: %d width: %d style: %s size: %6.2f %d-byte " "TEXTRUN [%s] ENDTEXTRUN\n", @@ -2262,13 +2262,13 @@ gfxFontGroup::InitTextRun(gfxContext *aContext, int32_t runScript = MOZ_SCRIPT_LATIN; while (scriptRuns.Next(runStart, runLimit, runScript)) { - if (MOZ_UNLIKELY(PR_LOG_TEST(log, PR_LOG_WARNING))) { + if (MOZ_UNLIKELY(MOZ_LOG_TEST(log, LogLevel::Warning))) { nsAutoCString lang; mStyle.language->ToUTF8String(lang); nsAutoString families; mFamilyList.ToString(families); uint32_t runLen = runLimit - runStart; - PR_LOG(log, PR_LOG_WARNING,\ + MOZ_LOG(log, LogLevel::Warning,\ ("(%s) fontgroup: [%s] default: %s lang: %s script: %d " "len %d weight: %d width: %d style: %s size: %6.2f " "%d-byte TEXTRUN [%s] ENDTEXTRUN\n", diff --git a/gfx/thebes/gfxUserFontSet.cpp b/gfx/thebes/gfxUserFontSet.cpp index 35a86f6308..61d21d34bd 100644 --- a/gfx/thebes/gfxUserFontSet.cpp +++ b/gfx/thebes/gfxUserFontSet.cpp @@ -33,8 +33,8 @@ gfxUserFontSet::GetUserFontsLog() return sLog; } -#define LOG(args) PR_LOG(gfxUserFontSet::GetUserFontsLog(), PR_LOG_DEBUG, args) -#define LOG_ENABLED() PR_LOG_TEST(gfxUserFontSet::GetUserFontsLog(), PR_LOG_DEBUG) +#define LOG(args) MOZ_LOG(gfxUserFontSet::GetUserFontsLog(), mozilla::LogLevel::Debug, args) +#define LOG_ENABLED() MOZ_LOG_TEST(gfxUserFontSet::GetUserFontsLog(), mozilla::LogLevel::Debug) static uint64_t sFontSetGeneration = 0; diff --git a/hal/HalLog.h b/hal/HalLog.h index 4000a4e212..7cdc9d8879 100644 --- a/hal/HalLog.h +++ b/hal/HalLog.h @@ -22,9 +22,9 @@ namespace hal { extern PRLogModuleInfo *GetHalLog(); #define HAL_LOG(...) \ - PR_LOG(mozilla::hal::GetHalLog(), PR_LOG_DEBUG, (__VA_ARGS__)) + MOZ_LOG(mozilla::hal::GetHalLog(), LogLevel::Debug, (__VA_ARGS__)) #define HAL_ERR(...) \ - PR_LOG(mozilla::hal::GetHalLog(), PR_LOG_ERROR, (__VA_ARGS__)) + MOZ_LOG(mozilla::hal::GetHalLog(), LogLevel::Error, (__VA_ARGS__)) } // namespace hal diff --git a/image/ImageLogging.h b/image/ImageLogging.h index ef3c7d893f..2c3b68d2ba 100644 --- a/image/ImageLogging.h +++ b/image/ImageLogging.h @@ -16,6 +16,8 @@ extern PRLogModuleInfo* GetImgLog(); #define GIVE_ME_MS_NOW() PR_IntervalToMilliseconds(PR_IntervalNow()) +using mozilla::LogLevel; + class LogScope { public: @@ -24,7 +26,7 @@ public: , mFrom(aFrom) , mFunc(aFunc) { - PR_LOG(mLog, PR_LOG_DEBUG, ("%d [this=%p] %s {ENTER}\n", + MOZ_LOG(mLog, LogLevel::Debug, ("%d [this=%p] %s {ENTER}\n", GIVE_ME_MS_NOW(), mFrom, mFunc)); } @@ -35,7 +37,7 @@ public: , mFrom(from) , mFunc(fn) { - PR_LOG(mLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=\"%s\") {ENTER}\n", + MOZ_LOG(mLog, LogLevel::Debug, ("%d [this=%p] %s (%s=\"%s\") {ENTER}\n", GIVE_ME_MS_NOW(), mFrom, mFunc, paramName, paramValue)); } @@ -47,7 +49,7 @@ public: , mFrom(from) , mFunc(fn) { - PR_LOG(mLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=%p) {ENTER}\n", + MOZ_LOG(mLog, LogLevel::Debug, ("%d [this=%p] %s (%s=%p) {ENTER}\n", GIVE_ME_MS_NOW(), mFrom, mFunc, paramName, paramValue)); } @@ -59,7 +61,7 @@ public: , mFrom(from) , mFunc(fn) { - PR_LOG(mLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=\"%d\") {ENTER}\n", + MOZ_LOG(mLog, LogLevel::Debug, ("%d [this=%p] %s (%s=\"%d\") {ENTER}\n", GIVE_ME_MS_NOW(), mFrom, mFunc, paramName, paramValue)); } @@ -71,14 +73,14 @@ public: , mFrom(from) , mFunc(fn) { - PR_LOG(mLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=\"%d\") {ENTER}\n", + MOZ_LOG(mLog, LogLevel::Debug, ("%d [this=%p] %s (%s=\"%d\") {ENTER}\n", GIVE_ME_MS_NOW(), mFrom, mFunc, paramName, paramValue)); } ~LogScope() { - PR_LOG(mLog, PR_LOG_DEBUG, ("%d [this=%p] %s {EXIT}\n", + MOZ_LOG(mLog, LogLevel::Debug, ("%d [this=%p] %s {EXIT}\n", GIVE_ME_MS_NOW(), mFrom, mFunc)); } @@ -92,14 +94,14 @@ class LogFunc { public: LogFunc(PRLogModuleInfo* aLog, void* from, const char* fn) { - PR_LOG(aLog, PR_LOG_DEBUG, ("%d [this=%p] %s\n", + MOZ_LOG(aLog, LogLevel::Debug, ("%d [this=%p] %s\n", GIVE_ME_MS_NOW(), from, fn)); } LogFunc(PRLogModuleInfo* aLog, void* from, const char* fn, const char* paramName, const char* paramValue) { - PR_LOG(aLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=\"%s\")\n", + MOZ_LOG(aLog, LogLevel::Debug, ("%d [this=%p] %s (%s=\"%s\")\n", GIVE_ME_MS_NOW(), from, fn, paramName, paramValue)); } @@ -107,7 +109,7 @@ public: LogFunc(PRLogModuleInfo* aLog, void* from, const char* fn, const char* paramName, const void* paramValue) { - PR_LOG(aLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=\"%p\")\n", + MOZ_LOG(aLog, LogLevel::Debug, ("%d [this=%p] %s (%s=\"%p\")\n", GIVE_ME_MS_NOW(), from, fn, paramName, paramValue)); } @@ -116,7 +118,7 @@ public: LogFunc(PRLogModuleInfo* aLog, void* from, const char* fn, const char* paramName, uint32_t paramValue) { - PR_LOG(aLog, PR_LOG_DEBUG, ("%d [this=%p] %s (%s=\"%d\")\n", + MOZ_LOG(aLog, LogLevel::Debug, ("%d [this=%p] %s (%s=\"%d\")\n", GIVE_ME_MS_NOW(), from, fn, paramName, paramValue)); } @@ -129,7 +131,7 @@ public: LogMessage(PRLogModuleInfo* aLog, void* from, const char* fn, const char* msg) { - PR_LOG(aLog, PR_LOG_DEBUG, ("%d [this=%p] %s -- %s\n", + MOZ_LOG(aLog, LogLevel::Debug, ("%d [this=%p] %s -- %s\n", GIVE_ME_MS_NOW(), from, fn, msg)); } }; diff --git a/image/ProgressTracker.cpp b/image/ProgressTracker.cpp index 5a0d985e4c..aa4fc9adfa 100644 --- a/image/ProgressTracker.cpp +++ b/image/ProgressTracker.cpp @@ -184,7 +184,7 @@ ProgressTracker::Notify(IProgressObserver* aObserver) { MOZ_ASSERT(NS_IsMainThread()); - if (PR_LOG_TEST(GetImgLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetImgLog(), LogLevel::Debug)) { nsRefPtr image = GetImage(); if (image && image->GetURI()) { nsRefPtr uri(image->GetURI()); @@ -253,7 +253,7 @@ ProgressTracker::NotifyCurrentState(IProgressObserver* aObserver) { MOZ_ASSERT(NS_IsMainThread()); - if (PR_LOG_TEST(GetImgLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetImgLog(), LogLevel::Debug)) { nsRefPtr image = GetImage(); nsAutoCString spec; if (image && image->GetURI()) { diff --git a/image/RasterImage.cpp b/image/RasterImage.cpp index 40ac2b8a7a..1710b75fb3 100644 --- a/image/RasterImage.cpp +++ b/image/RasterImage.cpp @@ -87,7 +87,7 @@ static int32_t sMaxDecodeCount = 0; */ #define LOG_CONTAINER_ERROR \ PR_BEGIN_MACRO \ - PR_LOG (GetImgLog(), PR_LOG_ERROR, \ + MOZ_LOG (GetImgLog(), LogLevel::Error, \ ("RasterImage: [this=%p] Error " \ "detected at line %u for image of " \ "type %s\n", this, __LINE__, \ diff --git a/image/decoders/nsBMPDecoder.cpp b/image/decoders/nsBMPDecoder.cpp index 2925f9fe09..fe8bb38f05 100644 --- a/image/decoders/nsBMPDecoder.cpp +++ b/image/decoders/nsBMPDecoder.cpp @@ -336,7 +336,7 @@ nsBMPDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) mProcessedHeader = true; ProcessInfoHeader(); - PR_LOG(GetBMPLog(), PR_LOG_DEBUG, + MOZ_LOG(GetBMPLog(), LogLevel::Debug, ("BMP is %lix%lix%lu. compression=%lu\n", mBIH.width, mBIH.height, mBIH.bpp, mBIH.compression)); // Verify we support this bit depth @@ -405,20 +405,20 @@ nsBMPDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) // If we have RLE4 or RLE8 or BI_ALPHABITFIELDS, then ensure we // have valid BPP values before adding the frame if (mBIH.compression == BI_RLE8 && mBIH.bpp != 8) { - PR_LOG(GetBMPLog(), PR_LOG_DEBUG, + MOZ_LOG(GetBMPLog(), LogLevel::Debug, ("BMP RLE8 compression only supports 8 bits per pixel\n")); PostDataError(); return; } if (mBIH.compression == BI_RLE4 && mBIH.bpp != 4 && mBIH.bpp != 1) { - PR_LOG(GetBMPLog(), PR_LOG_DEBUG, + MOZ_LOG(GetBMPLog(), LogLevel::Debug, ("BMP RLE4 compression only supports 4 bits per pixel\n")); PostDataError(); return; } if (mBIH.compression == BI_ALPHABITFIELDS && mBIH.bpp != 16 && mBIH.bpp != 32) { - PR_LOG(GetBMPLog(), PR_LOG_DEBUG, + MOZ_LOG(GetBMPLog(), LogLevel::Debug, ("BMP ALPHABITFIELDS only supports 16 or 32 bits per pixel\n" )); PostDataError(); @@ -690,7 +690,7 @@ nsBMPDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) if (((mBIH.compression == BI_RLE8) && (mBIH.bpp != 8)) || ((mBIH.compression == BI_RLE4) && (mBIH.bpp != 4) && (mBIH.bpp != 1))) { - PR_LOG(GetBMPLog(), PR_LOG_DEBUG, + MOZ_LOG(GetBMPLog(), LogLevel::Debug, ("BMP RLE8/RLE4 compression only supports 8/4 bits per" " pixel\n")); PostDataError(); diff --git a/image/decoders/nsJPEGDecoder.cpp b/image/decoders/nsJPEGDecoder.cpp index 89d526ed54..15d80a5775 100644 --- a/image/decoders/nsJPEGDecoder.cpp +++ b/image/decoders/nsJPEGDecoder.cpp @@ -106,7 +106,7 @@ nsJPEGDecoder::nsJPEGDecoder(RasterImage* aImage, mCMSMode = 0; - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("nsJPEGDecoder::nsJPEGDecoder: Creating JPEG decoder %p", this)); } @@ -125,7 +125,7 @@ nsJPEGDecoder::~nsJPEGDecoder() qcms_profile_release(mInProfile); } - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("nsJPEGDecoder::~nsJPEGDecoder: Destroying JPEG decoder %p", this)); } @@ -219,7 +219,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) // Error due to corrupt stream - return NS_OK and consume silently // so that ImageLib doesn't throw away a partial image load mState = JPEG_SINK_NON_JPEG_TRAILER; - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (setjmp returned NS_ERROR_FAILURE)")); return; } else { @@ -228,13 +228,13 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) // mozilla is seconds away from falling flat on its face. PostDecoderError(error_code); mState = JPEG_ERROR; - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (setjmp returned an error)")); return; } } - PR_LOG(GetJPEGLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGLog(), LogLevel::Debug, ("[this=%p] nsJPEGDecoder::Write -- processing JPEG data\n", this)); switch (mState) { @@ -244,7 +244,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) // Step 3: read file parameters with jpeg_read_header() if (jpeg_read_header(&mInfo, TRUE) == JPEG_SUSPENDED) { - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (JPEG_SUSPENDED)")); return; // I/O suspension } @@ -310,7 +310,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) default: mState = JPEG_ERROR; PostDataError(); - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (unknown colorpsace (1))")); return; } @@ -327,7 +327,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) default: mState = JPEG_ERROR; PostDataError(); - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (unknown colorpsace (2))")); return; } @@ -386,7 +386,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) default: mState = JPEG_ERROR; PostDataError(); - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (unknown colorpsace (3))")); return; break; @@ -401,7 +401,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) if (!mImageData) { mState = JPEG_ERROR; PostDecoderError(NS_ERROR_OUT_OF_MEMORY); - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (could not initialize image frame)")); return; } @@ -417,7 +417,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) } - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, (" JPEGDecoderAccounting: nsJPEGDecoder::" "Write -- created image frame with %ux%u pixels", mInfo.output_width, mInfo.output_height)); @@ -441,7 +441,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) // Step 5: Start decompressor if (jpeg_start_decompress(&mInfo) == FALSE) { - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (I/O suspension after jpeg_start_decompress())")); return; // I/O suspension } @@ -461,7 +461,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) OutputScanlines(&suspend); if (suspend) { - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (I/O suspension after OutputScanlines() - SEQUENTIAL)")); return; // I/O suspension } @@ -497,7 +497,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) scan--; if (!jpeg_start_output(&mInfo, scan)) { - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (I/O suspension after jpeg_start_output() -" " PROGRESSIVE)")); return; // I/O suspension @@ -517,14 +517,14 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) // jpeg_start_output() multiple times for the same scan mInfo.output_scanline = 0xffffff; } - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (I/O suspension after OutputScanlines() - PROGRESSIVE)")); return; // I/O suspension } if (mInfo.output_scanline == mInfo.output_height) { if (!jpeg_finish_output(&mInfo)) { - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (I/O suspension after jpeg_finish_output() -" " PROGRESSIVE)")); return; // I/O suspension @@ -552,7 +552,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) // Step 7: Finish decompression if (jpeg_finish_decompress(&mInfo) == FALSE) { - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (I/O suspension after jpeg_finish_decompress() - DONE)")); return; // I/O suspension } @@ -563,7 +563,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) break; } case JPEG_SINK_NON_JPEG_TRAILER: - PR_LOG(GetJPEGLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGLog(), LogLevel::Debug, ("[this=%p] nsJPEGDecoder::ProcessData -- entering" " JPEG_SINK_NON_JPEG_TRAILER case\n", this)); @@ -575,7 +575,7 @@ nsJPEGDecoder::WriteInternal(const char* aBuffer, uint32_t aCount) "decoder"); } - PR_LOG(GetJPEGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetJPEGDecoderAccountingLog(), LogLevel::Debug, ("} (end of function)")); return; } diff --git a/image/decoders/nsPNGDecoder.cpp b/image/decoders/nsPNGDecoder.cpp index 7ebc90fb2a..0e68a0c33a 100644 --- a/image/decoders/nsPNGDecoder.cpp +++ b/image/decoders/nsPNGDecoder.cpp @@ -175,7 +175,7 @@ void nsPNGDecoder::CreateFrame(png_uint_32 x_offset, png_uint_32 y_offset, mFrameRect = neededRect; - PR_LOG(GetPNGDecoderAccountingLog(), PR_LOG_DEBUG, + MOZ_LOG(GetPNGDecoderAccountingLog(), LogLevel::Debug, ("PNGDecoderAccounting: nsPNGDecoder::CreateFrame -- created " "image frame with %dx%d pixels in container %p", width, height, @@ -856,11 +856,11 @@ nsPNGDecoder::frame_info_callback(png_structp png_ptr, png_uint_32 frame_num) height = png_get_next_frame_height(png_ptr, decoder->mInfo); if (width == 0) { - PR_LOG(GetPNGLog(), PR_LOG_ERROR, ("libpng error: Frame width must not be 0\n")); + MOZ_LOG(GetPNGLog(), LogLevel::Error, ("libpng error: Frame width must not be 0\n")); png_longjmp(png_ptr, 1); } if (height == 0) { - PR_LOG(GetPNGLog(), PR_LOG_ERROR, ("libpng error: Frame height must not be 0\n")); + MOZ_LOG(GetPNGLog(), LogLevel::Error, ("libpng error: Frame height must not be 0\n")); png_longjmp(png_ptr, 1); } @@ -912,7 +912,7 @@ nsPNGDecoder::end_callback(png_structp png_ptr, png_infop info_ptr) void nsPNGDecoder::error_callback(png_structp png_ptr, png_const_charp error_msg) { - PR_LOG(GetPNGLog(), PR_LOG_ERROR, ("libpng error: %s\n", error_msg)); + MOZ_LOG(GetPNGLog(), LogLevel::Error, ("libpng error: %s\n", error_msg)); png_longjmp(png_ptr, 1); } @@ -920,7 +920,7 @@ nsPNGDecoder::error_callback(png_structp png_ptr, png_const_charp error_msg) void nsPNGDecoder::warning_callback(png_structp png_ptr, png_const_charp warning_msg) { - PR_LOG(GetPNGLog(), PR_LOG_WARNING, ("libpng warning: %s\n", warning_msg)); + MOZ_LOG(GetPNGLog(), LogLevel::Warning, ("libpng warning: %s\n", warning_msg)); } Telemetry::ID diff --git a/image/decoders/nsWEBPDecoder.cpp b/image/decoders/nsWEBPDecoder.cpp index 7ac36213e9..15e74a6771 100644 --- a/image/decoders/nsWEBPDecoder.cpp +++ b/image/decoders/nsWEBPDecoder.cpp @@ -25,14 +25,14 @@ nsWEBPDecoder::nsWEBPDecoder(RasterImage* aImage) , mData(nullptr) , mPreviousLastLine(0) { - PR_LOG(gWEBPDecoderAccountingLog, PR_LOG_DEBUG, + MOZ_LOG(gWEBPDecoderAccountingLog, LogLevel::Debug, ("nsWEBPDecoder::nsWEBPDecoder: Creating WEBP decoder %p", this)); } nsWEBPDecoder::~nsWEBPDecoder() { - PR_LOG(gWEBPDecoderAccountingLog, PR_LOG_DEBUG, + MOZ_LOG(gWEBPDecoderAccountingLog, LogLevel::Debug, ("nsWEBPDecoder::~nsWEBPDecoder: Destroying WEBP decoder %p", this)); diff --git a/image/encoders/png/nsPNGEncoder.cpp b/image/encoders/png/nsPNGEncoder.cpp index 2329a2dfb8..028aff6ed8 100644 --- a/image/encoders/png/nsPNGEncoder.cpp +++ b/image/encoders/png/nsPNGEncoder.cpp @@ -697,7 +697,7 @@ void nsPNGEncoder::WarningCallback(png_structp png_ptr, png_const_charp warning_msg) { - PR_LOG(GetPNGEncoderLog(), PR_LOG_WARNING, + MOZ_LOG(GetPNGEncoderLog(), LogLevel::Warning, ("libpng warning: %s\n", warning_msg)); } @@ -708,7 +708,7 @@ void nsPNGEncoder::ErrorCallback(png_structp png_ptr, png_const_charp error_msg) { - PR_LOG(GetPNGEncoderLog(), PR_LOG_ERROR, ("libpng error: %s\n", error_msg)); + MOZ_LOG(GetPNGEncoderLog(), LogLevel::Error, ("libpng error: %s\n", error_msg)); png_longjmp(png_ptr, 1); } diff --git a/image/imgLoader.cpp b/image/imgLoader.cpp index 8368e2c426..554238b751 100644 --- a/image/imgLoader.cpp +++ b/image/imgLoader.cpp @@ -818,7 +818,7 @@ imgCacheEntry::UpdateCache(int32_t diff /* = 0 */) void imgCacheEntry::SetHasNoProxies(bool hasNoProxies) { - if (PR_LOG_TEST(GetImgLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetImgLog(), LogLevel::Debug)) { if (hasNoProxies) { LOG_FUNC_WITH_PARAM(GetImgLog(), "imgCacheEntry::SetHasNoProxies true", "uri", mRequest->CacheKey().Spec()); @@ -1036,7 +1036,7 @@ imgCacheExpirationTracker::NotifyExpired(imgCacheEntry* entry) // mechanism doesn't. nsRefPtr kungFuDeathGrip(entry); - if (PR_LOG_TEST(GetImgLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetImgLog(), LogLevel::Debug)) { nsRefPtr req = entry->GetRequest(); if (req) { LOG_FUNC_WITH_PARAM(GetImgLog(), @@ -1399,20 +1399,20 @@ imgLoader::PutIntoCache(const ImageCacheKey& aKey, imgCacheEntry* entry) // the cache. nsRefPtr tmpCacheEntry; if (cache.Get(aKey, getter_AddRefs(tmpCacheEntry)) && tmpCacheEntry) { - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("[this=%p] imgLoader::PutIntoCache -- Element already in the cache", nullptr)); nsRefPtr tmpRequest = tmpCacheEntry->GetRequest(); // If it already exists, and we're putting the same key into the cache, we // should remove the old version. - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("[this=%p] imgLoader::PutIntoCache -- Replacing cached element", nullptr)); RemoveFromCache(aKey); } else { - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("[this=%p] imgLoader::PutIntoCache --" " Element NOT already in the cache", nullptr)); } @@ -1537,7 +1537,7 @@ imgLoader::CheckCacheLimits(imgCacheTable& cache, imgCacheQueue& queue) NS_ASSERTION(entry, "imgLoader::CheckCacheLimits -- NULL entry pointer"); - if (PR_LOG_TEST(GetImgLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetImgLog(), LogLevel::Debug)) { nsRefPtr req = entry->GetRequest(); if (req) { LOG_STATIC_FUNC_WITH_PARAM(GetImgLog(), @@ -1772,14 +1772,14 @@ imgLoader::ValidateEntry(imgCacheEntry* aEntry, // Determine whether the cache aEntry must be revalidated... validateRequest = ShouldRevalidateEntry(aEntry, aLoadFlags, hasExpired); - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("imgLoader::ValidateEntry validating cache entry. " "validateRequest = %d", validateRequest)); - } else if (!key && PR_LOG_TEST(GetImgLog(), PR_LOG_DEBUG)) { + } else if (!key && MOZ_LOG_TEST(GetImgLog(), LogLevel::Debug)) { nsAutoCString spec; aURI->GetSpec(spec); - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("imgLoader::ValidateEntry BYPASSING cache validation for %s " "because of NULL LoadID", spec.get())); } @@ -1797,7 +1797,7 @@ imgLoader::ValidateEntry(imgCacheEntry* aEntry, } if (requestAppCache != groupAppCache) { - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("imgLoader::ValidateEntry - Unable to use cached imgRequest " "[request=%p] because of mismatched application caches\n", address_of(request))); @@ -2179,7 +2179,7 @@ imgLoader::LoadImage(nsIURI* aURI, getter_AddRefs(request), getter_AddRefs(entry)); - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("[this=%p] imgLoader::LoadImage -- Created new imgRequest" " [request=%p]\n", this, request.get())); @@ -2202,7 +2202,7 @@ imgLoader::LoadImage(nsIURI* aURI, // request. nsCOMPtr listener = pl; if (corsmode != imgIRequest::CORS_NONE) { - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("[this=%p] imgLoader::LoadImage -- Setting up a CORS load", this)); bool withCredentials = corsmode == imgIRequest::CORS_USE_CREDENTIALS; @@ -2211,7 +2211,7 @@ imgLoader::LoadImage(nsIURI* aURI, new nsCORSListenerProxy(pl, aLoadingPrincipal, withCredentials); rv = corsproxy->Init(newChannel, DataURIHandling::Allow); if (NS_FAILED(rv)) { - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("[this=%p] imgLoader::LoadImage -- nsCORSListenerProxy " "creation failed: 0x%x\n", this, rv)); request->CancelAndAbort(rv); @@ -2221,7 +2221,7 @@ imgLoader::LoadImage(nsIURI* aURI, listener = corsproxy; } - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("[this=%p] imgLoader::LoadImage -- Calling channel->AsyncOpen()\n", this)); @@ -2231,7 +2231,7 @@ imgLoader::LoadImage(nsIURI* aURI, nsresult openRes = newChannel->AsyncOpen(listener, nullptr); if (NS_FAILED(openRes)) { - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("[this=%p] imgLoader::LoadImage -- AsyncOpen() failed: 0x%x\n", this, openRes)); request->CancelAndAbort(openRes); @@ -2864,7 +2864,7 @@ ProxyListener::CheckListenerChain() if (retargetableListener) { rv = retargetableListener->CheckListenerChain(); } - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("ProxyListener::CheckListenerChain %s [this=%p listener=%p rv=%x]", (NS_SUCCEEDED(rv) ? "success" : "failure"), this, (nsIStreamListener*)mDestListener, rv)); @@ -2994,7 +2994,7 @@ imgCacheValidator::OnStartRequest(nsIRequest* aRequest, nsISupports* ctxt) uri = imageURL->ToIURI(); } - if (PR_LOG_TEST(GetImgLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetImgLog(), LogLevel::Debug)) { nsAutoCString spec; uri->GetSpec(spec); LOG_MSG_WITH_PARAM(GetImgLog(), @@ -3086,7 +3086,7 @@ imgCacheValidator::CheckListenerChain() if (retargetableListener) { rv = retargetableListener->CheckListenerChain(); } - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("[this=%p] imgCacheValidator::CheckListenerChain -- rv %d=%s", this, NS_SUCCEEDED(rv) ? "succeeded" : "failed", rv)); return rv; diff --git a/image/imgRequest.cpp b/image/imgRequest.cpp index 9e5c53c7e3..481e12b9a9 100644 --- a/image/imgRequest.cpp +++ b/image/imgRequest.cpp @@ -51,7 +51,7 @@ GetImgLog() } return sImgLog; } -#define LOG_TEST(level) (GetImgLog() && PR_LOG_TEST(GetImgLog(), (level))) +#define LOG_TEST(level) (GetImgLog() && MOZ_LOG_TEST(GetImgLog(), (level))) NS_IMPL_ISUPPORTS(imgRequest, nsIStreamListener, nsIRequestObserver, @@ -260,7 +260,7 @@ imgRequest::RemoveProxy(imgRequestProxy* proxy, nsresult aStatus) if (mLoader) { mLoader->SetHasNoProxies(this, mCacheEntry); } - } else if (PR_LOG_TEST(GetImgLog(), PR_LOG_DEBUG)) { + } else if (MOZ_LOG_TEST(GetImgLog(), LogLevel::Debug)) { nsAutoCString spec; mURI->GetSpec(spec); LOG_MSG_WITH_PARAM(GetImgLog(), @@ -794,7 +794,7 @@ imgRequest::OnStartRequest(nsIRequest* aRequest, nsISupports* ctxt) DecodePool::Singleton()->GetIOEventTarget(); rv = retargetable->RetargetDeliveryTo(target); } - PR_LOG(GetImgLog(), PR_LOG_WARNING, + MOZ_LOG(GetImgLog(), LogLevel::Warning, ("[this=%p] imgRequest::OnStartRequest -- " "RetargetDeliveryTo rv %d=%s\n", this, rv, NS_SUCCEEDED(rv) ? "succeeded" : "failed")); @@ -950,14 +950,14 @@ PrepareForNewPart(nsIRequest* aRequest, nsIInputStream* aInStr, uint32_t aCount, } if (NS_FAILED(rv)) { - PR_LOG(GetImgLog(), - PR_LOG_ERROR, ("imgRequest::PrepareForNewPart " + MOZ_LOG(GetImgLog(), + LogLevel::Error, ("imgRequest::PrepareForNewPart " "-- Content type unavailable from the channel\n")); return result; } } - PR_LOG(GetImgLog(), PR_LOG_DEBUG, + MOZ_LOG(GetImgLog(), LogLevel::Debug, ("imgRequest::PrepareForNewPart -- Got content type %s\n", result.mContentType.get())); @@ -1115,7 +1115,7 @@ imgRequest::OnDataAvailable(nsIRequest* aRequest, nsISupports* aContext, image->OnImageDataAvailable(aRequest, aContext, aInStr, aOffset, aCount); if (NS_FAILED(rv)) { - PR_LOG(GetImgLog(), PR_LOG_WARNING, + MOZ_LOG(GetImgLog(), LogLevel::Warning, ("[this=%p] imgRequest::OnDataAvailable -- " "copy to RasterImage failed\n", this)); Cancel(NS_IMAGELIB_ERROR_FAILURE); @@ -1233,7 +1233,7 @@ imgRequest::OnRedirectVerifyCallback(nsresult result) mTimedChannel = do_QueryInterface(mChannel); mNewRedirectChannel = nullptr; - if (LOG_TEST(PR_LOG_DEBUG)) { + if (LOG_TEST(LogLevel::Debug)) { nsAutoCString spec; if (mCurrentURI) { mCurrentURI->GetSpec(spec); @@ -1260,7 +1260,7 @@ imgRequest::OnRedirectVerifyCallback(nsresult result) // Update the current URI. mChannel->GetURI(getter_AddRefs(mCurrentURI)); - if (LOG_TEST(PR_LOG_DEBUG)) { + if (LOG_TEST(LogLevel::Debug)) { nsAutoCString spec; if (mCurrentURI) { mCurrentURI->GetSpec(spec); diff --git a/image/imgRequestProxy.cpp b/image/imgRequestProxy.cpp index 5fc42a881e..64634cd8bf 100644 --- a/image/imgRequestProxy.cpp +++ b/image/imgRequestProxy.cpp @@ -866,7 +866,7 @@ imgRequestProxy::Notify(int32_t aType, const mozilla::gfx::IntRect* aRect) void imgRequestProxy::OnLoadComplete(bool aLastPart) { - if (PR_LOG_TEST(GetImgLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetImgLog(), LogLevel::Debug)) { nsAutoCString name; GetName(name); LOG_FUNC_WITH_PARAM(GetImgLog(), "imgRequestProxy::OnLoadComplete", @@ -912,7 +912,7 @@ imgRequestProxy::OnLoadComplete(bool aLastPart) void imgRequestProxy::BlockOnload() { - if (PR_LOG_TEST(GetImgLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetImgLog(), LogLevel::Debug)) { nsAutoCString name; GetName(name); LOG_FUNC_WITH_PARAM(GetImgLog(), "imgRequestProxy::BlockOnload", @@ -928,7 +928,7 @@ imgRequestProxy::BlockOnload() void imgRequestProxy::UnblockOnload() { - if (PR_LOG_TEST(GetImgLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetImgLog(), LogLevel::Debug)) { nsAutoCString name; GetName(name); LOG_FUNC_WITH_PARAM(GetImgLog(), "imgRequestProxy::UnblockOnload", diff --git a/ipc/chromium/src/base/logging.cc b/ipc/chromium/src/base/logging.cc index 2b8d180bdd..8b0f9d843c 100644 --- a/ipc/chromium/src/base/logging.cc +++ b/ipc/chromium/src/base/logging.cc @@ -12,37 +12,37 @@ namespace mozilla { Logger::~Logger() { - PRLogModuleLevel prlevel = PR_LOG_DEBUG; + LogLevel prlevel = LogLevel::Debug; int xpcomlevel = -1; switch (mSeverity) { case LOG_INFO: - prlevel = PR_LOG_DEBUG; + prlevel = LogLevel::Debug; xpcomlevel = -1; break; case LOG_WARNING: - prlevel = PR_LOG_WARNING; + prlevel = LogLevel::Warning; xpcomlevel = NS_DEBUG_WARNING; break; case LOG_ERROR: - prlevel = PR_LOG_ERROR; + prlevel = LogLevel::Error; xpcomlevel = NS_DEBUG_WARNING; break; case LOG_ERROR_REPORT: - prlevel = PR_LOG_ERROR; + prlevel = LogLevel::Error; xpcomlevel = NS_DEBUG_ASSERTION; break; case LOG_FATAL: - prlevel = PR_LOG_ERROR; + prlevel = LogLevel::Error; xpcomlevel = NS_DEBUG_ABORT; break; } - PR_LOG(GetLog(), prlevel, ("%s:%i: %s", mFile, mLine, mMsg ? mMsg : "")); + MOZ_LOG(GetLog(), prlevel, ("%s:%i: %s", mFile, mLine, mMsg ? mMsg : "")); if (xpcomlevel != -1) NS_DebugBreak(xpcomlevel, mMsg, NULL, mFile, mLine); diff --git a/js/xpconnect/loader/mozJSComponentLoader.cpp b/js/xpconnect/loader/mozJSComponentLoader.cpp index ac60981c54..f8d3aa1a13 100644 --- a/js/xpconnect/loader/mozJSComponentLoader.cpp +++ b/js/xpconnect/loader/mozJSComponentLoader.cpp @@ -72,7 +72,7 @@ static const char kJSCachePrefix[] = "jsloader"; // NSPR_LOG_MODULES=JSComponentLoader:5 static PRLogModuleInfo* gJSCLLog; -#define LOG(args) PR_LOG(gJSCLLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gJSCLLog, mozilla::LogLevel::Debug, args) // Components.utils.import error messages #define ERROR_SCOPE_OBJ "%s - Second argument must be an object." diff --git a/js/xpconnect/src/XPCLog.cpp b/js/xpconnect/src/XPCLog.cpp index afbfe4c218..5624587c78 100644 --- a/js/xpconnect/src/XPCLog.cpp +++ b/js/xpconnect/src/XPCLog.cpp @@ -31,7 +31,7 @@ static bool Init() { g_LogMod = PR_NewLogModule("xpclog"); g_Spaces = new char[SPACE_COUNT+1]; - if (!g_LogMod || !g_Spaces || !PR_LOG_TEST(g_LogMod,1)) { + if (!g_LogMod || !g_Spaces || !MOZ_LOG_TEST(g_LogMod,LogLevel::Error)) { g_InitState = 1; XPC_Log_Finish(); return false; @@ -71,7 +71,7 @@ XPC_Log_print(const char* fmt, ...) bool XPC_Log_Check(int i) { - return CAN_RUN && PR_LOG_TEST(g_LogMod,1); + return CAN_RUN && MOZ_LOG_TEST(g_LogMod,LogLevel::Error); } void diff --git a/js/xpconnect/src/nsXPConnect.cpp b/js/xpconnect/src/nsXPConnect.cpp index a5042de08a..978a71d133 100644 --- a/js/xpconnect/src/nsXPConnect.cpp +++ b/js/xpconnect/src/nsXPConnect.cpp @@ -243,8 +243,8 @@ xpc::ErrorReport::LogToConsole() if (!gJSDiagnostics) gJSDiagnostics = PR_NewLogModule("JSDiagnostics"); if (gJSDiagnostics) { - PR_LOG(gJSDiagnostics, - JSREPORT_IS_WARNING(mFlags) ? PR_LOG_WARNING : PR_LOG_ERROR, + MOZ_LOG(gJSDiagnostics, + JSREPORT_IS_WARNING(mFlags) ? LogLevel::Warning : LogLevel::Error, ("file %s, line %u\n%s", NS_LossyConvertUTF16toASCII(mFileName).get(), mLineNumber, NS_LossyConvertUTF16toASCII(mErrorMsg).get())); } diff --git a/layout/base/AccessibleCaretLogger.h b/layout/base/AccessibleCaretLogger.h index b9d2f86c2a..b02297da3f 100644 --- a/layout/base/AccessibleCaretLogger.h +++ b/layout/base/AccessibleCaretLogger.h @@ -15,12 +15,12 @@ namespace mozilla { PRLogModuleInfo* GetAccessibleCaretLog(); #ifndef AC_LOG_BASE -#define AC_LOG_BASE(...) PR_LOG(GetAccessibleCaretLog(), PR_LOG_DEBUG, (__VA_ARGS__)); +#define AC_LOG_BASE(...) MOZ_LOG(GetAccessibleCaretLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)); #endif #ifndef AC_LOGV_BASE #define AC_LOGV_BASE(...) \ - PR_LOG(GetAccessibleCaretLog(), PR_LOG_DEBUG + 1, (__VA_ARGS__)); + MOZ_LOG(GetAccessibleCaretLog(), LogLevel::Verbose, (__VA_ARGS__)); #endif #else diff --git a/layout/base/SelectionCarets.cpp b/layout/base/SelectionCarets.cpp index 04b5b299de..a5b7c99a21 100644 --- a/layout/base/SelectionCarets.cpp +++ b/layout/base/SelectionCarets.cpp @@ -45,12 +45,12 @@ static const char* kSelectionCaretsLogModuleName = "SelectionCarets"; // To enable all the SELECTIONCARETS_LOG print statements, set the environment // variable NSPR_LOG_MODULES=SelectionCarets:5 #define SELECTIONCARETS_LOG(message, ...) \ - PR_LOG(gSelectionCaretsLog, PR_LOG_DEBUG, \ + MOZ_LOG(gSelectionCaretsLog, LogLevel::Debug, \ ("SelectionCarets (%p): %s:%d : " message "\n", this, __FUNCTION__, \ __LINE__, ##__VA_ARGS__)); #define SELECTIONCARETS_LOG_STATIC(message, ...) \ - PR_LOG(gSelectionCaretsLog, PR_LOG_DEBUG, \ + MOZ_LOG(gSelectionCaretsLog, LogLevel::Debug, \ ("SelectionCarets: %s:%d : " message "\n", __FUNCTION__, __LINE__, \ ##__VA_ARGS__)); diff --git a/layout/base/TouchCaret.cpp b/layout/base/TouchCaret.cpp index 4c085988c7..bfcc1c788f 100644 --- a/layout/base/TouchCaret.cpp +++ b/layout/base/TouchCaret.cpp @@ -42,12 +42,12 @@ static const char* kTouchCaretLogModuleName = "TouchCaret"; // To enable all the TOUCHCARET_LOG print statements, set the environment // variable NSPR_LOG_MODULES=TouchCaret:5 #define TOUCHCARET_LOG(message, ...) \ - PR_LOG(gTouchCaretLog, PR_LOG_DEBUG, \ + MOZ_LOG(gTouchCaretLog, LogLevel::Debug, \ ("TouchCaret (%p): %s:%d : " message "\n", this, __FUNCTION__, \ __LINE__, ##__VA_ARGS__)); #define TOUCHCARET_LOG_STATIC(message, ...) \ - PR_LOG(gTouchCaretLog, PR_LOG_DEBUG, \ + MOZ_LOG(gTouchCaretLog, LogLevel::Debug, \ ("TouchCaret: %s:%d : " message "\n", __FUNCTION__, __LINE__, \ ##__VA_ARGS__)); diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 6a26e1e804..eafca9ea69 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -143,7 +143,7 @@ GetPrintingLog() sLog = PR_NewLogModule("printing"); return sLog; } -#define PR_PL(_p1) PR_LOG(GetPrintingLog(), PR_LOG_DEBUG, _p1); +#define PR_PL(_p1) MOZ_LOG(GetPrintingLog(), mozilla::LogLevel::Debug, _p1); #endif // NS_PRINTING #define PRT_YESNO(_p) ((_p)?"YES":"NO") diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index bbe1a35edb..0efd492b0e 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -253,7 +253,7 @@ nsPresContext::nsPresContext(nsIDocument* aDocument, nsPresContextType aType) // if text perf logging enabled, init stats struct PRLogModuleInfo *log = gfxPlatform::GetLog(eGfxLog_textperf); - if (log && log->level >= PR_LOG_WARNING) { + if (MOZ_LOG_TEST(log, LogLevel::Warning)) { mTextPerf = new gfxTextPerfMetrics(); } diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 04087e3831..03fba052c6 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -1013,12 +1013,12 @@ LogTextPerfStats(gfxTextPerfMetrics* aTextPerf, PRLogModuleInfo* tpLog = gfxPlatform::GetLog(eGfxLog_textperf); // ignore XUL contexts unless at debug level - PRLogModuleLevel logLevel = PR_LOG_WARNING; + mozilla::LogLevel logLevel = LogLevel::Warning; if (aCounts.numContentTextRuns == 0) { - logLevel = PR_LOG_DEBUG; + logLevel = LogLevel::Debug; } - if (!PR_LOG_TEST(tpLog, logLevel)) { + if (!MOZ_LOG_TEST(tpLog, logLevel)) { return; } @@ -1043,7 +1043,7 @@ LogTextPerfStats(gfxTextPerfMetrics* aTextPerf, } if (aLogType == eLog_loaddone) { - PR_LOG(tpLog, logLevel, + MOZ_LOG(tpLog, logLevel, ("%s reflow: %d chars: %d " "[%s] " "content-textruns: %d chrome-textruns: %d " @@ -1063,7 +1063,7 @@ LogTextPerfStats(gfxTextPerfMetrics* aTextPerf, aCounts.textrunConst, aCounts.textrunDestr, aTextPerf->cumulative.textrunDestr)); } else { - PR_LOG(tpLog, logLevel, + MOZ_LOG(tpLog, logLevel, ("%s reflow: %d chars: %d " "content-textruns: %d chrome-textruns: %d " "max-textrun-len: %d " @@ -2666,7 +2666,7 @@ PresShell::BeginLoad(nsIDocument *aDocument) tp = mPresContext->GetTextPerfMetrics(); } - bool shouldLog = gLog && PR_LOG_TEST(gLog, PR_LOG_DEBUG); + bool shouldLog = gLog && MOZ_LOG_TEST(gLog, LogLevel::Debug); if (shouldLog || tp) { mLoadBegin = TimeStamp::Now(); } @@ -2677,7 +2677,7 @@ PresShell::BeginLoad(nsIDocument *aDocument) if (uri) { uri->GetSpec(spec); } - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("(presshell) %p load begin [%s]\n", this, spec.get())); } @@ -2702,7 +2702,7 @@ PresShell::LoadComplete() } // log load - bool shouldLog = gLog && PR_LOG_TEST(gLog, PR_LOG_DEBUG); + bool shouldLog = gLog && MOZ_LOG_TEST(gLog, LogLevel::Debug); if (shouldLog || tp) { TimeDuration loadTime = TimeStamp::Now() - mLoadBegin; nsIURI* uri = mDocument->GetDocumentURI(); @@ -2711,7 +2711,7 @@ PresShell::LoadComplete() uri->GetSpec(spec); } if (shouldLog) { - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("(presshell) %p load done time-ms: %9.2f [%s]\n", this, loadTime.ToMilliseconds(), spec.get())); } diff --git a/layout/base/nsRefreshDriver.cpp b/layout/base/nsRefreshDriver.cpp index 038b0e5e41..1ef6b69778 100644 --- a/layout/base/nsRefreshDriver.cpp +++ b/layout/base/nsRefreshDriver.cpp @@ -74,7 +74,7 @@ using namespace mozilla::ipc; using namespace mozilla::layout; static PRLogModuleInfo *gLog = nullptr; -#define LOG(...) PR_LOG(gLog, PR_LOG_NOTICE, (__VA_ARGS__)) +#define LOG(...) MOZ_LOG(gLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) #define DEFAULT_FRAME_RATE 60 #define DEFAULT_THROTTLED_FRAME_RATE 1 diff --git a/layout/generic/nsFlexContainerFrame.cpp b/layout/generic/nsFlexContainerFrame.cpp index 8ec958eec3..6995663641 100644 --- a/layout/generic/nsFlexContainerFrame.cpp +++ b/layout/generic/nsFlexContainerFrame.cpp @@ -2194,7 +2194,7 @@ FlexLine::FreezeOrRestoreEachFlexibleSize(const nscoord aTotalViolation, void FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize) { - PR_LOG(GetFlexContainerLog(), PR_LOG_DEBUG, ("ResolveFlexibleLengths\n")); + MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug, ("ResolveFlexibleLengths\n")); // Determine whether we're going to be growing or shrinking items. const bool isUsingFlexGrow = @@ -2242,7 +2242,7 @@ FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize) availableFreeSpace -= item->GetMainSize(); } - PR_LOG(GetFlexContainerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug, (" available free space = %d\n", availableFreeSpace)); @@ -2354,7 +2354,7 @@ FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize) } } - PR_LOG(GetFlexContainerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug, (" Distributing available space:")); // Since this loop only operates on unfrozen flex items, we can break as // soon as we have seen all of them. @@ -2402,7 +2402,7 @@ FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize) availableFreeSpace -= sizeDelta; item->SetMainSize(item->GetMainSize() + sizeDelta); - PR_LOG(GetFlexContainerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug, (" child %p receives %d, for a total of %d\n", item, sizeDelta, item->GetMainSize())); } @@ -2412,7 +2412,7 @@ FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize) // Fix min/max violations: nscoord totalViolation = 0; // keeps track of adjustments for min/max - PR_LOG(GetFlexContainerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug, (" Checking for violations:")); // Since this loop only operates on unfrozen flex items, we can break as @@ -2441,7 +2441,7 @@ FlexLine::ResolveFlexibleLengths(nscoord aFlexContainerMainSize) FreezeOrRestoreEachFlexibleSize(totalViolation, iterationCounter + 1 == mNumItems); - PR_LOG(GetFlexContainerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug, (" Total violation: %d\n", totalViolation)); if (mNumFrozenItems == mNumItems) { @@ -3591,7 +3591,7 @@ nsFlexContainerFrame::Reflow(nsPresContext* aPresContext, MarkInReflow(); DO_GLOBAL_REFLOW_COUNT("nsFlexContainerFrame"); DISPLAY_REFLOW(aPresContext, this, aReflowState, aDesiredSize, aStatus); - PR_LOG(GetFlexContainerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetFlexContainerLog(), LogLevel::Debug, ("Reflow() for nsFlexContainerFrame %p\n", this)); if (IsFrameTreeTooDeep(aReflowState, aDesiredSize, aStatus)) { diff --git a/layout/generic/nsPageFrame.cpp b/layout/generic/nsPageFrame.cpp index 5e2c287edf..9c16c55461 100644 --- a/layout/generic/nsPageFrame.cpp +++ b/layout/generic/nsPageFrame.cpp @@ -23,7 +23,7 @@ #include "mozilla/Logging.h" extern PRLogModuleInfo *GetLayoutPrintingLog(); -#define PR_PL(_p1) PR_LOG(GetLayoutPrintingLog(), PR_LOG_DEBUG, _p1) +#define PR_PL(_p1) MOZ_LOG(GetLayoutPrintingLog(), mozilla::LogLevel::Debug, _p1) using namespace mozilla; using namespace mozilla::gfx; diff --git a/layout/generic/nsPluginFrame.cpp b/layout/generic/nsPluginFrame.cpp index c8b36422c9..39fbc40b41 100644 --- a/layout/generic/nsPluginFrame.cpp +++ b/layout/generic/nsPluginFrame.cpp @@ -157,13 +157,13 @@ nsPluginFrame::nsPluginFrame(nsStyleContext* aContext) : nsPluginFrameSuper(aContext) , mReflowCallbackPosted(false) { - PR_LOG(GetObjectFrameLog(), PR_LOG_DEBUG, + MOZ_LOG(GetObjectFrameLog(), LogLevel::Debug, ("Created new nsPluginFrame %p\n", this)); } nsPluginFrame::~nsPluginFrame() { - PR_LOG(GetObjectFrameLog(), PR_LOG_DEBUG, + MOZ_LOG(GetObjectFrameLog(), LogLevel::Debug, ("nsPluginFrame %p deleted\n", this)); } @@ -193,7 +193,7 @@ nsPluginFrame::Init(nsIContent* aContent, nsContainerFrame* aParent, nsIFrame* aPrevInFlow) { - PR_LOG(GetObjectFrameLog(), PR_LOG_DEBUG, + MOZ_LOG(GetObjectFrameLog(), LogLevel::Debug, ("Initializing nsPluginFrame %p for content %p\n", this, aContent)); nsPluginFrameSuper::Init(aContent, aParent, aPrevInFlow); diff --git a/layout/generic/nsSimplePageSequenceFrame.cpp b/layout/generic/nsSimplePageSequenceFrame.cpp index 48e39c04af..768f5ed13e 100644 --- a/layout/generic/nsSimplePageSequenceFrame.cpp +++ b/layout/generic/nsSimplePageSequenceFrame.cpp @@ -50,7 +50,7 @@ GetLayoutPrintingLog() sLog = PR_NewLogModule("printing-layout"); return sLog; } -#define PR_PL(_p1) PR_LOG(GetLayoutPrintingLog(), PR_LOG_DEBUG, _p1) +#define PR_PL(_p1) MOZ_LOG(GetLayoutPrintingLog(), mozilla::LogLevel::Debug, _p1) nsSimplePageSequenceFrame* NS_NewSimplePageSequenceFrame(nsIPresShell* aPresShell, nsStyleContext* aContext) diff --git a/layout/printing/nsPrintData.cpp b/layout/printing/nsPrintData.cpp index 2c9ce46173..6771b746f2 100644 --- a/layout/printing/nsPrintData.cpp +++ b/layout/printing/nsPrintData.cpp @@ -25,7 +25,7 @@ GetPrintingLog() sLog = PR_NewLogModule("printing"); return sLog; } -#define PR_PL(_p1) PR_LOG(GetPrintingLog(), PR_LOG_DEBUG, _p1); +#define PR_PL(_p1) MOZ_LOG(GetPrintingLog(), mozilla::LogLevel::Debug, _p1); //--------------------------------------------------- //-- nsPrintData Class Impl diff --git a/layout/printing/nsPrintEngine.cpp b/layout/printing/nsPrintEngine.cpp index 2baa43151e..0aba474089 100644 --- a/layout/printing/nsPrintEngine.cpp +++ b/layout/printing/nsPrintEngine.cpp @@ -146,7 +146,7 @@ GetPrintingLog() sLog = PR_NewLogModule("printing"); return sLog; } -#define PR_PL(_p1) PR_LOG(GetPrintingLog(), PR_LOG_DEBUG, _p1); +#define PR_PL(_p1) MOZ_LOG(GetPrintingLog(), mozilla::LogLevel::Debug, _p1); #endif #ifdef EXTENDED_DEBUG_PRINTING @@ -1707,7 +1707,7 @@ nsPrintEngine::SetupToPrintContent() NS_ENSURE_SUCCESS(rv, rv); } - if (PR_LOG_TEST(GetPrintingLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetPrintingLog(), LogLevel::Debug)) { float calcRatio = 0.0f; if (mPrt->mPrintDocList.Length() > 1 && mPrt->mPrintObject->mFrameType == eFrameSet) { nsPrintObject* smallestPO = FindSmallestSTF(); diff --git a/layout/style/FontFaceSet.cpp b/layout/style/FontFaceSet.cpp index 92c777e935..50fc229fda 100644 --- a/layout/style/FontFaceSet.cpp +++ b/layout/style/FontFaceSet.cpp @@ -37,9 +37,9 @@ using namespace mozilla; using namespace mozilla::dom; -#define LOG(args) PR_LOG(gfxUserFontSet::GetUserFontsLog(), PR_LOG_DEBUG, args) -#define LOG_ENABLED() PR_LOG_TEST(gfxUserFontSet::GetUserFontsLog(), \ - PR_LOG_DEBUG) +#define LOG(args) MOZ_LOG(gfxUserFontSet::GetUserFontsLog(), mozilla::LogLevel::Debug, args) +#define LOG_ENABLED() MOZ_LOG_TEST(gfxUserFontSet::GetUserFontsLog(), \ + LogLevel::Debug) #define FONT_LOADING_API_ENABLED_PREF "layout.css.font-loading-api.enabled" diff --git a/layout/style/Loader.cpp b/layout/style/Loader.cpp index 752c49fdd3..81c95ecdf5 100644 --- a/layout/style/Loader.cpp +++ b/layout/style/Loader.cpp @@ -264,16 +264,14 @@ GetLoaderLog() return sLog; } -#define LOG_FORCE(args) PR_LOG(GetLoaderLog(), PR_LOG_ALWAYS, args) -#define LOG_ERROR(args) PR_LOG(GetLoaderLog(), PR_LOG_ERROR, args) -#define LOG_WARN(args) PR_LOG(GetLoaderLog(), PR_LOG_WARNING, args) -#define LOG_DEBUG(args) PR_LOG(GetLoaderLog(), PR_LOG_DEBUG, args) +#define LOG_ERROR(args) MOZ_LOG(GetLoaderLog(), mozilla::LogLevel::Error, args) +#define LOG_WARN(args) MOZ_LOG(GetLoaderLog(), mozilla::LogLevel::Warning, args) +#define LOG_DEBUG(args) MOZ_LOG(GetLoaderLog(), mozilla::LogLevel::Debug, args) #define LOG(args) LOG_DEBUG(args) -#define LOG_FORCE_ENABLED() PR_LOG_TEST(GetLoaderLog(), PR_LOG_ALWAYS) -#define LOG_ERROR_ENABLED() PR_LOG_TEST(GetLoaderLog(), PR_LOG_ERROR) -#define LOG_WARN_ENABLED() PR_LOG_TEST(GetLoaderLog(), PR_LOG_WARNING) -#define LOG_DEBUG_ENABLED() PR_LOG_TEST(GetLoaderLog(), PR_LOG_DEBUG) +#define LOG_ERROR_ENABLED() MOZ_LOG_TEST(GetLoaderLog(), mozilla::LogLevel::Error) +#define LOG_WARN_ENABLED() MOZ_LOG_TEST(GetLoaderLog(), mozilla::LogLevel::Warning) +#define LOG_DEBUG_ENABLED() MOZ_LOG_TEST(GetLoaderLog(), mozilla::LogLevel::Debug) #define LOG_ENABLED() LOG_DEBUG_ENABLED() #define LOG_URI(format, uri) \ diff --git a/layout/style/nsFontFaceLoader.cpp b/layout/style/nsFontFaceLoader.cpp index cb1e93fe4f..c08517cbae 100644 --- a/layout/style/nsFontFaceLoader.cpp +++ b/layout/style/nsFontFaceLoader.cpp @@ -25,9 +25,9 @@ using namespace mozilla; -#define LOG(args) PR_LOG(gfxUserFontSet::GetUserFontsLog(), PR_LOG_DEBUG, args) -#define LOG_ENABLED() PR_LOG_TEST(gfxUserFontSet::GetUserFontsLog(), \ - PR_LOG_DEBUG) +#define LOG(args) MOZ_LOG(gfxUserFontSet::GetUserFontsLog(), mozilla::LogLevel::Debug, args) +#define LOG_ENABLED() MOZ_LOG_TEST(gfxUserFontSet::GetUserFontsLog(), \ + LogLevel::Debug) nsFontFaceLoader::nsFontFaceLoader(gfxUserFontEntry* aUserFontEntry, nsIURI* aFontURI, diff --git a/media/libstagefright/binding/MoofParser.cpp b/media/libstagefright/binding/MoofParser.cpp index 063ceabc0a..db23d1f86b 100644 --- a/media/libstagefright/binding/MoofParser.cpp +++ b/media/libstagefright/binding/MoofParser.cpp @@ -20,7 +20,7 @@ extern PRLogModuleInfo* GetDemuxerLog(); #define STRINGIFY(x) #x #define TOSTRING(x) STRINGIFY(x) -#define LOG(name, arg, ...) PR_LOG(GetDemuxerLog(), PR_LOG_DEBUG, (TOSTRING(name) "(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) +#define LOG(name, arg, ...) MOZ_LOG(GetDemuxerLog(), mozilla::LogLevel::Debug, (TOSTRING(name) "(%p)::%s: " arg, this, __func__, ##__VA_ARGS__)) #else #define LOG(...) #endif diff --git a/media/mtransport/logging.h b/media/mtransport/logging.h index 37f8b71bfb..1a2b71cf90 100644 --- a/media/mtransport/logging.h +++ b/media/mtransport/logging.h @@ -12,12 +12,11 @@ #include #include "mozilla/Logging.h" -#define ML_EMERG 1 -#define ML_ERROR 2 -#define ML_WARNING 3 -#define ML_NOTICE 4 -#define ML_INFO 5 -#define ML_DEBUG 6 +#define ML_ERROR mozilla::LogLevel::Error +#define ML_WARNING mozilla::LogLevel::Warning +#define ML_NOTICE mozilla::LogLevel::Info +#define ML_INFO mozilla::LogLevel::Debug +#define ML_DEBUG mozilla::LogLevel::Verbose #define MOZ_MTLOG_MODULE(n) \ static PRLogModuleInfo* getLogModule() { \ @@ -29,10 +28,10 @@ #define MOZ_MTLOG(level, b) \ do { \ - if (PR_LOG_TEST(getLogModule(), level)) { \ + if (MOZ_LOG_TEST(getLogModule(), level)) { \ std::stringstream str; \ str << b; \ - PR_LOG(getLogModule(), level, ("%s", str.str().c_str())); \ + MOZ_LOG(getLogModule(), level, ("%s", str.str().c_str())); \ } \ } while(0) diff --git a/media/mtransport/nricectx.cpp b/media/mtransport/nricectx.cpp index fea00c5229..513addc34b 100644 --- a/media/mtransport/nricectx.cpp +++ b/media/mtransport/nricectx.cpp @@ -461,13 +461,13 @@ RefPtr NrIceCtx::Create(const std::string& name, #ifdef USE_INTERFACE_PRIORITIZER nr_interface_prioritizer *prioritizer = CreateInterfacePrioritizer(); if (!prioritizer) { - MOZ_MTLOG(PR_LOG_ERROR, "Couldn't create interface prioritizer."); + MOZ_MTLOG(LogLevel::Error, "Couldn't create interface prioritizer."); return nullptr; } r = nr_ice_ctx_set_interface_prioritizer(ctx->ctx_, prioritizer); if (r) { - MOZ_MTLOG(PR_LOG_ERROR, "Couldn't set interface prioritizer."); + MOZ_MTLOG(LogLevel::Error, "Couldn't set interface prioritizer."); return nullptr; } #endif // USE_INTERFACE_PRIORITIZER @@ -661,7 +661,7 @@ nsresult NrIceCtx::SetProxyServer(const NrIceProxyServer& proxy_server) { } if ((r = nr_socket_wrapper_factory_proxy_tunnel_create(config, &wrapper))) { - MOZ_MTLOG(PR_LOG_ERROR, "Couldn't create proxy tunnel wrapper."); + MOZ_MTLOG(LogLevel::Error, "Couldn't create proxy tunnel wrapper."); ABORT(r); } diff --git a/media/mtransport/nrinterfaceprioritizer.cpp b/media/mtransport/nrinterfaceprioritizer.cpp index 33d17017f3..96fc0395e1 100644 --- a/media/mtransport/nrinterfaceprioritizer.cpp +++ b/media/mtransport/nrinterfaceprioritizer.cpp @@ -24,7 +24,7 @@ public: char buf[MAXIFNAME + 41]; int r = nr_transport_addr_fmt_ifname_addr_string(&local_addr.addr, buf, sizeof(buf)); if (r) { - MOZ_MTLOG(PR_LOG_ERROR, "Error formatting interface address string."); + MOZ_MTLOG(ML_ERROR, "Error formatting interface address string."); return false; } key_ = buf; diff --git a/media/webrtc/signaling/src/common/browser_logging/CSFLog.cpp b/media/webrtc/signaling/src/common/browser_logging/CSFLog.cpp index 0145b00442..4ecf9512d1 100644 --- a/media/webrtc/signaling/src/common/browser_logging/CSFLog.cpp +++ b/media/webrtc/signaling/src/common/browser_logging/CSFLog.cpp @@ -14,6 +14,8 @@ #include "prthread.h" #include "nsThreadUtils.h" +#include "mozilla/Logging.h" + static PRLogModuleInfo *gLogModuleInfo = nullptr; PRLogModuleInfo *GetSignalingLogInfo() @@ -42,12 +44,12 @@ void CSFLogV(CSFLogLevel priority, const char* sourceFile, int sourceLine, const vprintf(format, args); #else - PRLogModuleLevel level = static_cast(priority); + mozilla::LogLevel level = static_cast(priority); GetSignalingLogInfo(); // Skip doing any of this work if we're not logging the indicated level... - if (!PR_LOG_TEST(gLogModuleInfo,level)) { + if (!MOZ_LOG_TEST(gLogModuleInfo,level)) { return; } @@ -82,7 +84,7 @@ void CSFLogV(CSFLogLevel priority, const char* sourceFile, int sourceLine, const } vsnprintf(message, MAX_MESSAGE_LENGTH, format, args); - PR_LOG(gLogModuleInfo, level, ("[%s|%s] %s:%d: %s", + MOZ_LOG(gLogModuleInfo, level, ("[%s|%s] %s:%d: %s", threadName, tag, sourceFile, sourceLine, message)); #endif diff --git a/media/webrtc/signaling/src/common/browser_logging/CSFLog.h b/media/webrtc/signaling/src/common/browser_logging/CSFLog.h index 5db2f6b897..a201579929 100644 --- a/media/webrtc/signaling/src/common/browser_logging/CSFLog.h +++ b/media/webrtc/signaling/src/common/browser_logging/CSFLog.h @@ -6,30 +6,27 @@ #define CSFLOG_H #include -#include "prlog.h" + +struct PRLogModuleInfo; typedef enum{ - CSF_LOG_CRITICAL =1, - CSF_LOG_ERROR, + CSF_LOG_ERROR = 1, CSF_LOG_WARNING, - CSF_LOG_NOTICE, CSF_LOG_INFO, CSF_LOG_DEBUG, - CSF_LOG_OBNOXIOUS + CSF_LOG_VERBOSE, } CSFLogLevel; #define CSFLogError(tag , format, ...) CSFLog( CSF_LOG_ERROR, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) #define CSFLogErrorV(tag , format, va_list_arg) CSFLogV(CSF_LOG_ERROR, __FILE__ , __LINE__ , tag , format , va_list_arg ) #define CSFLogWarn(tag , format, ...) CSFLog( CSF_LOG_WARNING, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) #define CSFLogWarnV(tag , format, va_list_arg) CSFLogV(CSF_LOG_WARNING, __FILE__ , __LINE__ , tag , format , va_list_arg ) -#define CSFLogNotice(tag , format, ...) CSFLog( CSF_LOG_NOTICE, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) -#define CSFLogNoticeV(tag , format, va_list_arg) CSFLogV(CSF_LOG_NOTICE, __FILE__ , __LINE__ , tag , format , va_list_arg ) #define CSFLogInfo(tag , format, ...) CSFLog( CSF_LOG_INFO, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) #define CSFLogInfoV(tag , format, va_list_arg) CSFLogV(CSF_LOG_INFO, __FILE__ , __LINE__ , tag , format , va_list_arg ) #define CSFLogDebug(tag , format, ...) CSFLog(CSF_LOG_DEBUG, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) #define CSFLogDebugV(tag , format, va_list_arg) CSFLogV(CSF_LOG_DEBUG, __FILE__ , __LINE__ , tag , format , va_list_arg ) -#define CSFLogObnoxious(tag , format, ...) CSFLog(CSF_LOG_OBNOXIOUS, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) -#define CSFLogObnoxiousV(tag , format, va_list_arg) CSFLogV(CSF_LOG_OBNOXIOUS, __FILE__ , __LINE__ , tag , format , va_list_arg ) +#define CSFLogVerbose(tag , format, ...) CSFLog(CSF_LOG_VERBOSE, __FILE__ , __LINE__ , tag , format , ## __VA_ARGS__ ) +#define CSFLogVerboseV(tag , format, va_list_arg) CSFLogV(CSF_LOG_VERBOSE, __FILE__ , __LINE__ , tag , format , va_list_arg ) #ifdef __cplusplus extern "C" @@ -43,8 +40,8 @@ void CSFLog( CSFLogLevel priority, const char* sourceFile, int sourceLine, const void CSFLogV( CSFLogLevel priority, const char* sourceFile, int sourceLine, const char* tag , const char* format, va_list args); -PRLogModuleInfo *GetSignalingLogInfo(); -PRLogModuleInfo *GetWebRTCLogInfo(); +struct PRLogModuleInfo *GetSignalingLogInfo(); +struct PRLogModuleInfo *GetWebRTCLogInfo(); #ifdef __cplusplus } diff --git a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp index 5c844cd1dd..d5275565dc 100644 --- a/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp +++ b/media/webrtc/signaling/src/common/browser_logging/WebRtcLog.cpp @@ -19,6 +19,8 @@ #include "nsStringAPI.h" #endif +using mozilla::LogLevel; + static int gWebRtcTraceLoggingOn = 0; #ifndef ANDROID @@ -49,7 +51,7 @@ public: void Print(webrtc::TraceLevel level, const char* message, int length) { PRLogModuleInfo *log = GetWebRtcTraceLog(); - PR_LOG(log, PR_LOG_DEBUG, ("%s", message)); + MOZ_LOG(log, LogLevel::Debug, ("%s", message)); } }; diff --git a/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp b/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp index 444f8fa97b..272ee54048 100644 --- a/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp +++ b/media/webrtc/signaling/src/media-conduit/AudioConduit.cpp @@ -531,7 +531,7 @@ WebrtcAudioConduit::SendAudioFrame(const int16_t audio_data[], } #if !defined(MOZILLA_EXTERNAL_LINKAGE) - if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) { struct Processing insert = { TimeStamp::Now(), 0 }; mProcessing.AppendElement(insert); } @@ -643,7 +643,7 @@ WebrtcAudioConduit::GetAudioFrame(int16_t speechData[], } #if !defined(MOZILLA_EXTERNAL_LINKAGE) - if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) { if (mProcessing.Length() > 0) { unsigned int now; mPtrVoEVideoSync->GetPlayoutTimestamp(mChannel, now); @@ -680,7 +680,7 @@ WebrtcAudioConduit::ReceivedRTPPacket(const void *data, int len) if(mEngineReceiving) { #if !defined(MOZILLA_EXTERNAL_LINKAGE) - if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) { // timestamp is at 32 bits in ([1]) struct Processing insert = { TimeStamp::Now(), ntohl(static_cast(data)[1]) }; @@ -818,7 +818,7 @@ int WebrtcAudioConduit::SendPacket(int channel, const void* data, int len) CSFLogDebug(logTag, "%s : channel %d", __FUNCTION__, channel); #if !defined(MOZILLA_EXTERNAL_LINKAGE) - if (PR_LOG_TEST(GetLatencyLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetLatencyLog(), LogLevel::Debug)) { if (mProcessing.Length() > 0) { TimeStamp started = mProcessing[0].mTimeStamp; mProcessing.RemoveElementAt(0); diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp index 3bae826819..b9f452040d 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp +++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.cpp @@ -44,8 +44,8 @@ GetGMPLog() return sLog; } #endif -#define LOGD(msg) PR_LOG(GetGMPLog(), PR_LOG_DEBUG, msg) -#define LOG(level, msg) PR_LOG(GetGMPLog(), (level), msg) +#define LOGD(msg) MOZ_LOG(GetGMPLog(), mozilla::LogLevel::Debug, msg) +#define LOG(level, msg) MOZ_LOG(GetGMPLog(), (level), msg) // Encoder. WebrtcGmpVideoEncoder::WebrtcGmpVideoEncoder() @@ -483,7 +483,7 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame, break; default: // Really that it's not in the enum - LOG(PR_LOG_ERROR, + LOG(LogLevel::Error, ("GMP plugin returned incorrect type (%d)", aEncodedFrame->BufferType())); // XXX Bug 1041232 - need a better API for interfacing to the // plugin so we can kill it here @@ -528,7 +528,7 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame, } if (buffer+size > end) { // XXX see above - should we kill the plugin for returning extra bytes? Probably - LOG(PR_LOG_ERROR, + LOG(LogLevel::Error, ("GMP plugin returned badly formatted encoded data: end is %td bytes past buffer end", buffer+size - end)); return; diff --git a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp index 0ac5fa4c91..142d77c5bd 100644 --- a/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp +++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionImpl.cpp @@ -366,7 +366,7 @@ bool PCUuidGenerator::Generate(std::string* idp) { PeerConnectionImpl::PeerConnectionImpl(const GlobalObject* aGlobal) -: mTimeCard(PR_LOG_TEST(signalingLogInfo(),PR_LOG_ERROR) ? +: mTimeCard(MOZ_LOG_TEST(signalingLogInfo(),LogLevel::Error) ? create_timecard() : nullptr) , mSignalingState(PCImplSignalingState::SignalingStable) , mIceConnectionState(PCImplIceConnectionState::New) diff --git a/modules/libjar/nsJARChannel.cpp b/modules/libjar/nsJARChannel.cpp index 4f8aff2e4f..9c23e9426e 100644 --- a/modules/libjar/nsJARChannel.cpp +++ b/modules/libjar/nsJARChannel.cpp @@ -51,8 +51,8 @@ static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID); // static PRLogModuleInfo *gJarProtocolLog = nullptr; -#define LOG(args) PR_LOG(gJarProtocolLog, PR_LOG_DEBUG, args) -#define LOG_ENABLED() PR_LOG_TEST(gJarProtocolLog, 4) +#define LOG(args) MOZ_LOG(gJarProtocolLog, mozilla::LogLevel::Debug, args) +#define LOG_ENABLED() MOZ_LOG_TEST(gJarProtocolLog, mozilla::LogLevel::Debug) //----------------------------------------------------------------------------- // nsJARInputThunk diff --git a/netwerk/base/BackgroundFileSaver.cpp b/netwerk/base/BackgroundFileSaver.cpp index 7352c2eb85..3e1e2a45a1 100644 --- a/netwerk/base/BackgroundFileSaver.cpp +++ b/netwerk/base/BackgroundFileSaver.cpp @@ -33,8 +33,8 @@ namespace net { // NSPR_LOG_MODULES=BackgroundFileSaver:5 PRLogModuleInfo *BackgroundFileSaver::prlog = nullptr; -#define LOG(args) PR_LOG(BackgroundFileSaver::prlog, PR_LOG_DEBUG, args) -#define LOG_ENABLED() PR_LOG_TEST(BackgroundFileSaver::prlog, 4) +#define LOG(args) MOZ_LOG(BackgroundFileSaver::prlog, mozilla::LogLevel::Debug, args) +#define LOG_ENABLED() MOZ_LOG_TEST(BackgroundFileSaver::prlog, mozilla::LogLevel::Debug) //////////////////////////////////////////////////////////////////////////////// //// Globals diff --git a/netwerk/base/Predictor.cpp b/netwerk/base/Predictor.cpp index 61d62c3b09..5ee9de23c6 100644 --- a/netwerk/base/Predictor.cpp +++ b/netwerk/base/Predictor.cpp @@ -53,7 +53,7 @@ namespace net { Predictor *Predictor::sSelf = nullptr; static PRLogModuleInfo *gPredictorLog = nullptr; -#define PREDICTOR_LOG(args) PR_LOG(gPredictorLog, 4, args) +#define PREDICTOR_LOG(args) MOZ_LOG(gPredictorLog, mozilla::LogLevel::Debug, args) #define RETURN_IF_FAILED(_rv) \ do { \ diff --git a/netwerk/base/nsAsyncRedirectVerifyHelper.cpp b/netwerk/base/nsAsyncRedirectVerifyHelper.cpp index 846699f29f..0f432ce2e9 100644 --- a/netwerk/base/nsAsyncRedirectVerifyHelper.cpp +++ b/netwerk/base/nsAsyncRedirectVerifyHelper.cpp @@ -22,7 +22,7 @@ GetRedirectLog() sLog = PR_NewLogModule("nsRedirect"); return sLog; } -#define LOG(args) PR_LOG(GetRedirectLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(GetRedirectLog(), mozilla::LogLevel::Debug, args) NS_IMPL_ISUPPORTS(nsAsyncRedirectVerifyHelper, nsIAsyncVerifyRedirectCallback, diff --git a/netwerk/base/nsAsyncStreamCopier.cpp b/netwerk/base/nsAsyncStreamCopier.cpp index 3b3d9de43d..260843626a 100644 --- a/netwerk/base/nsAsyncStreamCopier.cpp +++ b/netwerk/base/nsAsyncStreamCopier.cpp @@ -17,7 +17,7 @@ using namespace mozilla; // NSPR_LOG_MODULES=nsStreamCopier:5 // static PRLogModuleInfo *gStreamCopierLog = nullptr; -#define LOG(args) PR_LOG(gStreamCopierLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gStreamCopierLog, mozilla::LogLevel::Debug, args) /** * An event used to perform initialization off the main thread. diff --git a/netwerk/base/nsAutodialWin.cpp b/netwerk/base/nsAutodialWin.cpp index a10d3c2baa..7987335536 100644 --- a/netwerk/base/nsAutodialWin.cpp +++ b/netwerk/base/nsAutodialWin.cpp @@ -25,7 +25,7 @@ // set NSPR_LOG_MODULES=Autodial:5 // set NSPR_LOG_FILE=nspr.log // -// this enables PR_LOG_DEBUG level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file nspr.log // @@ -33,8 +33,8 @@ static PRLogModuleInfo* gLog = nullptr; #undef LOGD #undef LOGE -#define LOGD(args) PR_LOG(gLog, PR_LOG_DEBUG, args) -#define LOGE(args) PR_LOG(gLog, PR_LOG_ERROR, args) +#define LOGD(args) MOZ_LOG(gLog, mozilla::LogLevel::Debug, args) +#define LOGE(args) MOZ_LOG(gLog, mozilla::LogLevel::Error, args) // Don't try to dial again within a few seconds of when user pressed cancel. #define NO_RETRY_PERIOD_SEC 5 diff --git a/netwerk/base/nsChannelClassifier.cpp b/netwerk/base/nsChannelClassifier.cpp index 0b4c2a4701..2fea0fc071 100644 --- a/netwerk/base/nsChannelClassifier.cpp +++ b/netwerk/base/nsChannelClassifier.cpp @@ -41,7 +41,7 @@ using mozilla::Preferences; // static PRLogModuleInfo *gChannelClassifierLog; #undef LOG -#define LOG(args) PR_LOG(gChannelClassifierLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gChannelClassifierLog, mozilla::LogLevel::Debug, args) NS_IMPL_ISUPPORTS(nsChannelClassifier, nsIURIClassifierCallback) diff --git a/netwerk/base/nsDirectoryIndexStream.cpp b/netwerk/base/nsDirectoryIndexStream.cpp index 8333a21002..37d4e4b69c 100644 --- a/netwerk/base/nsDirectoryIndexStream.cpp +++ b/netwerk/base/nsDirectoryIndexStream.cpp @@ -47,7 +47,7 @@ nsDirectoryIndexStream::nsDirectoryIndexStream() if (! gLog) gLog = PR_NewLogModule("nsDirectoryIndexStream"); - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("nsDirectoryIndexStream[%p]: created", this)); } @@ -92,10 +92,10 @@ nsDirectoryIndexStream::Init(nsIFile* aDir) if (!isDir) return NS_ERROR_ILLEGAL_VALUE; - if (PR_LOG_TEST(gLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Debug)) { nsAutoCString path; aDir->GetNativePath(path); - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("nsDirectoryIndexStream[%p]: initialized on %s", this, path.get())); } @@ -157,7 +157,7 @@ nsDirectoryIndexStream::Init(nsIFile* aDir) nsDirectoryIndexStream::~nsDirectoryIndexStream() { - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("nsDirectoryIndexStream[%p]: destroyed", this)); } @@ -239,10 +239,10 @@ nsDirectoryIndexStream::Read(char* aBuf, uint32_t aCount, uint32_t* aReadCount) nsIFile* current = mArray.ObjectAt(mPos); ++mPos; - if (PR_LOG_TEST(gLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Debug)) { nsAutoCString path; current->GetNativePath(path); - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("nsDirectoryIndexStream[%p]: iterated %s", this, path.get())); } @@ -254,7 +254,7 @@ nsDirectoryIndexStream::Read(char* aBuf, uint32_t aCount, uint32_t* aReadCount) bool hidden = false; current->IsHidden(&hidden); if (hidden) { - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("nsDirectoryIndexStream[%p]: skipping hidden file/directory", this)); continue; diff --git a/netwerk/base/nsInputStreamPump.cpp b/netwerk/base/nsInputStreamPump.cpp index 9495d1af92..ab12742fa5 100644 --- a/netwerk/base/nsInputStreamPump.cpp +++ b/netwerk/base/nsInputStreamPump.cpp @@ -26,7 +26,7 @@ static NS_DEFINE_CID(kStreamTransportServiceCID, NS_STREAMTRANSPORTSERVICE_CID); // static PRLogModuleInfo *gStreamPumpLog = nullptr; #undef LOG -#define LOG(args) PR_LOG(gStreamPumpLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gStreamPumpLog, mozilla::LogLevel::Debug, args) //----------------------------------------------------------------------------- // nsInputStreamPump methods diff --git a/netwerk/base/nsLoadGroup.cpp b/netwerk/base/nsLoadGroup.cpp index 9ae3964d2a..4e00aebe10 100644 --- a/netwerk/base/nsLoadGroup.cpp +++ b/netwerk/base/nsLoadGroup.cpp @@ -34,13 +34,13 @@ using namespace mozilla::net; // set NSPR_LOG_MODULES=LoadGroup:5 // set NSPR_LOG_FILE=nspr.log // -// this enables PR_LOG_DEBUG level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file nspr.log // static PRLogModuleInfo* gLoadGroupLog = nullptr; #undef LOG -#define LOG(args) PR_LOG(gLoadGroupLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gLoadGroupLog, mozilla::LogLevel::Debug, args) //////////////////////////////////////////////////////////////////////////////// // nsLoadGroupConnectionInfo @@ -305,7 +305,7 @@ nsLoadGroup::Cancel(nsresult status) continue; } - if (PR_LOG_TEST(gLoadGroupLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gLoadGroupLog, LogLevel::Debug)) { nsAutoCString nameStr; request->GetName(nameStr); LOG(("LOADGROUP [%x]: Canceling request %x %s.\n", @@ -366,7 +366,7 @@ nsLoadGroup::Suspend() if (!request) continue; - if (PR_LOG_TEST(gLoadGroupLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gLoadGroupLog, LogLevel::Debug)) { nsAutoCString nameStr; request->GetName(nameStr); LOG(("LOADGROUP [%x]: Suspending request %x %s.\n", @@ -411,7 +411,7 @@ nsLoadGroup::Resume() if (!request) continue; - if (PR_LOG_TEST(gLoadGroupLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gLoadGroupLog, LogLevel::Debug)) { nsAutoCString nameStr; request->GetName(nameStr); LOG(("LOADGROUP [%x]: Resuming request %x %s.\n", @@ -500,7 +500,7 @@ nsLoadGroup::AddRequest(nsIRequest *request, nsISupports* ctxt) { nsresult rv; - if (PR_LOG_TEST(gLoadGroupLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gLoadGroupLog, LogLevel::Debug)) { nsAutoCString nameStr; request->GetName(nameStr); LOG(("LOADGROUP [%x]: Adding request %x %s (count=%d).\n", @@ -597,7 +597,7 @@ nsLoadGroup::RemoveRequest(nsIRequest *request, nsISupports* ctxt, NS_ENSURE_ARG_POINTER(request); nsresult rv; - if (PR_LOG_TEST(gLoadGroupLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gLoadGroupLog, LogLevel::Debug)) { nsAutoCString nameStr; request->GetName(nameStr); LOG(("LOADGROUP [%x]: Removing request %x %s status %x (count=%d).\n", diff --git a/netwerk/base/nsPACMan.cpp b/netwerk/base/nsPACMan.cpp index 0931880af8..fe8edaaeb6 100644 --- a/netwerk/base/nsPACMan.cpp +++ b/netwerk/base/nsPACMan.cpp @@ -26,7 +26,7 @@ using namespace mozilla; using namespace mozilla::net; #undef LOG -#define LOG(args) PR_LOG(GetProxyLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(GetProxyLog(), 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 diff --git a/netwerk/base/nsProtocolProxyService.cpp b/netwerk/base/nsProtocolProxyService.cpp index 8654bc4324..660986e326 100644 --- a/netwerk/base/nsProtocolProxyService.cpp +++ b/netwerk/base/nsProtocolProxyService.cpp @@ -49,7 +49,7 @@ using namespace mozilla; #include "mozilla/Logging.h" #undef LOG -#define LOG(args) PR_LOG(net::GetProxyLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(net::GetProxyLog(), mozilla::LogLevel::Debug, args) //---------------------------------------------------------------------------- diff --git a/netwerk/base/nsRequestObserverProxy.cpp b/netwerk/base/nsRequestObserverProxy.cpp index 16014bc03f..195d24db1e 100644 --- a/netwerk/base/nsRequestObserverProxy.cpp +++ b/netwerk/base/nsRequestObserverProxy.cpp @@ -16,7 +16,7 @@ using namespace mozilla; static PRLogModuleInfo *gRequestObserverProxyLog; #undef LOG -#define LOG(args) PR_LOG(gRequestObserverProxyLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gRequestObserverProxyLog, mozilla::LogLevel::Debug, args) //----------------------------------------------------------------------------- // nsARequestObserverEvent internal class... diff --git a/netwerk/base/nsSecCheckWrapChannel.cpp b/netwerk/base/nsSecCheckWrapChannel.cpp index 09a7f6fce7..18e282eecf 100644 --- a/netwerk/base/nsSecCheckWrapChannel.cpp +++ b/netwerk/base/nsSecCheckWrapChannel.cpp @@ -7,7 +7,6 @@ #include "nsHttpChannel.h" #include "nsCOMPtr.h" -#ifdef PR_LOGGING static PRLogModuleInfo* GetChannelWrapperLog() { @@ -17,9 +16,8 @@ GetChannelWrapperLog() } return gChannelWrapperPRLog; } -#endif -#define CHANNELWRAPPERLOG(args) PR_LOG(GetChannelWrapperLog(), 4, args) +#define CHANNELWRAPPERLOG(args) MOZ_LOG(GetChannelWrapperLog(), mozilla::LogLevel::Debug, args) NS_IMPL_ADDREF(nsSecCheckWrapChannelBase) NS_IMPL_RELEASE(nsSecCheckWrapChannelBase) @@ -70,7 +68,6 @@ nsSecCheckWrapChannel::nsSecCheckWrapChannel(nsIChannel* aChannel, : nsSecCheckWrapChannelBase(aChannel) , mLoadInfo(aLoadInfo) { -#ifdef PR_LOGGING { nsCOMPtr uri; mChannel->GetURI(getter_AddRefs(uri)); @@ -80,7 +77,6 @@ nsSecCheckWrapChannel::nsSecCheckWrapChannel(nsIChannel* aChannel, } CHANNELWRAPPERLOG(("nsSecCheckWrapChannel::nsSecCheckWrapChannel [%p] (%s)",this, spec.get())); } -#endif } nsSecCheckWrapChannel::~nsSecCheckWrapChannel() diff --git a/netwerk/base/nsSocketTransportService2.h b/netwerk/base/nsSocketTransportService2.h index fb9ce27590..83b266bcfc 100644 --- a/netwerk/base/nsSocketTransportService2.h +++ b/netwerk/base/nsSocketTransportService2.h @@ -27,15 +27,15 @@ struct PRPollDesc; // set NSPR_LOG_MODULES=nsSocketTransport:5 // extern PRLogModuleInfo *gSocketTransportLog; -#define SOCKET_LOG(args) PR_LOG(gSocketTransportLog, PR_LOG_DEBUG, args) -#define SOCKET_LOG_ENABLED() PR_LOG_TEST(gSocketTransportLog, PR_LOG_DEBUG) +#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; -#define UDPSOCKET_LOG(args) PR_LOG(gUDPSocketLog, PR_LOG_DEBUG, args) -#define UDPSOCKET_LOG_ENABLED() PR_LOG_TEST(gUDPSocketLog, PR_LOG_DEBUG) +#define UDPSOCKET_LOG(args) MOZ_LOG(gUDPSocketLog, mozilla::LogLevel::Debug, args) +#define UDPSOCKET_LOG_ENABLED() MOZ_LOG_TEST(gUDPSocketLog, mozilla::LogLevel::Debug) //----------------------------------------------------------------------------- diff --git a/netwerk/base/nsStandardURL.cpp b/netwerk/base/nsStandardURL.cpp index c0452f8818..24e7a03027 100644 --- a/netwerk/base/nsStandardURL.cpp +++ b/netwerk/base/nsStandardURL.cpp @@ -45,9 +45,9 @@ static PRLogModuleInfo *gStandardURLLog; // The Chromium code defines its own LOG macro which we don't want #undef LOG -#define LOG(args) PR_LOG(gStandardURLLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gStandardURLLog, mozilla::LogLevel::Debug, args) #undef LOG_ENABLED -#define LOG_ENABLED() PR_LOG_TEST(gStandardURLLog, PR_LOG_DEBUG) +#define LOG_ENABLED() MOZ_LOG_TEST(gStandardURLLog, mozilla::LogLevel::Debug) //---------------------------------------------------------------------------- diff --git a/netwerk/cache/nsCache.cpp b/netwerk/cache/nsCache.cpp index 9b05d2205a..3b2cbdea3a 100644 --- a/netwerk/cache/nsCache.cpp +++ b/netwerk/cache/nsCache.cpp @@ -27,14 +27,14 @@ CacheLogInit() void -CacheLogPrintPath(PRLogModuleLevel level, const char * format, nsIFile * item) +CacheLogPrintPath(mozilla::LogLevel level, const char * format, nsIFile * item) { nsAutoCString path; nsresult rv = item->GetNativePath(path); if (NS_SUCCEEDED(rv)) { - PR_LOG(gCacheLog, level, (format, path.get())); + MOZ_LOG(gCacheLog, level, (format, path.get())); } else { - PR_LOG(gCacheLog, level, ("GetNativePath failed: %x", rv)); + MOZ_LOG(gCacheLog, level, ("GetNativePath failed: %x", rv)); } } diff --git a/netwerk/cache/nsCache.h b/netwerk/cache/nsCache.h index 5876b325d8..78cca09abe 100644 --- a/netwerk/cache/nsCache.h +++ b/netwerk/cache/nsCache.h @@ -21,14 +21,14 @@ // PR_LOG args = "format string", arg, arg, ... extern PRLogModuleInfo * gCacheLog; void CacheLogInit(); -void CacheLogPrintPath(PRLogModuleLevel level, +void CacheLogPrintPath(mozilla::LogLevel level, const char * format, nsIFile * item); #define CACHE_LOG_INIT() CacheLogInit() -#define CACHE_LOG_ALWAYS(args) PR_LOG(gCacheLog, PR_LOG_ALWAYS, args) -#define CACHE_LOG_ERROR(args) PR_LOG(gCacheLog, PR_LOG_ERROR, args) -#define CACHE_LOG_WARNING(args) PR_LOG(gCacheLog, PR_LOG_WARNING, args) -#define CACHE_LOG_DEBUG(args) PR_LOG(gCacheLog, PR_LOG_DEBUG, args) +#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) +#define CACHE_LOG_DEBUG(args) MOZ_LOG(gCacheLog, mozilla::LogLevel::Debug, args) #define CACHE_LOG_PATH(level, format, item) \ CacheLogPrintPath(level, format, item) diff --git a/netwerk/cache/nsCacheService.cpp b/netwerk/cache/nsCacheService.cpp index e4b5fc1acd..0d39b2323e 100644 --- a/netwerk/cache/nsCacheService.cpp +++ b/netwerk/cache/nsCacheService.cpp @@ -383,7 +383,7 @@ nsCacheProfilePrefObserver::Observe(nsISupports * subject, { nsresult rv; NS_ConvertUTF16toUTF8 data(data_unicode); - CACHE_LOG_ALWAYS(("Observe [topic=%s data=%s]\n", topic, data.get())); + CACHE_LOG_INFO(("Observe [topic=%s data=%s]\n", topic, data.get())); if (!nsCacheService::IsInitialized()) { if (!strcmp("resume_process_notification", topic)) { @@ -1731,7 +1731,7 @@ nsCacheService::GetCustomOfflineDevice(nsIFile *aProfileDir, nsresult nsCacheService::CreateOfflineDevice() { - CACHE_LOG_ALWAYS(("Creating default offline device")); + CACHE_LOG_INFO(("Creating default offline device")); if (mOfflineDevice) return NS_OK; if (!nsCacheService::IsInitialized()) { @@ -1754,10 +1754,10 @@ nsCacheService::CreateCustomOfflineDevice(nsIFile *aProfileDir, { NS_ENSURE_ARG(aProfileDir); - if (PR_LOG_TEST(gCacheLog, PR_LOG_ALWAYS)) { + if (MOZ_LOG_TEST(gCacheLog, LogLevel::Info)) { nsAutoCString profilePath; aProfileDir->GetNativePath(profilePath); - CACHE_LOG_ALWAYS(("Creating custom offline device, %s, %d", + CACHE_LOG_INFO(("Creating custom offline device, %s, %d", profilePath.BeginReading(), aQuota)); } @@ -3021,18 +3021,18 @@ nsCacheService::LogCacheStatistics() { uint32_t hitPercentage = (uint32_t)((((double)mCacheHits) / ((double)(mCacheHits + mCacheMisses))) * 100); - CACHE_LOG_ALWAYS(("\nCache Service Statistics:\n\n")); - CACHE_LOG_ALWAYS((" TotalEntries = %d\n", mTotalEntries)); - CACHE_LOG_ALWAYS((" Cache Hits = %d\n", mCacheHits)); - CACHE_LOG_ALWAYS((" Cache Misses = %d\n", mCacheMisses)); - CACHE_LOG_ALWAYS((" Cache Hit %% = %d%%\n", hitPercentage)); - CACHE_LOG_ALWAYS((" Max Key Length = %d\n", mMaxKeyLength)); - CACHE_LOG_ALWAYS((" Max Meta Size = %d\n", mMaxMetaSize)); - CACHE_LOG_ALWAYS((" Max Data Size = %d\n", mMaxDataSize)); - CACHE_LOG_ALWAYS(("\n")); - CACHE_LOG_ALWAYS((" Deactivate Failures = %d\n", + CACHE_LOG_INFO(("\nCache Service Statistics:\n\n")); + CACHE_LOG_INFO((" TotalEntries = %d\n", mTotalEntries)); + CACHE_LOG_INFO((" Cache Hits = %d\n", mCacheHits)); + CACHE_LOG_INFO((" Cache Misses = %d\n", mCacheMisses)); + CACHE_LOG_INFO((" Cache Hit %% = %d%%\n", hitPercentage)); + CACHE_LOG_INFO((" Max Key Length = %d\n", mMaxKeyLength)); + CACHE_LOG_INFO((" Max Meta Size = %d\n", mMaxMetaSize)); + CACHE_LOG_INFO((" Max Data Size = %d\n", mMaxDataSize)); + CACHE_LOG_INFO(("\n")); + CACHE_LOG_INFO((" Deactivate Failures = %d\n", mDeactivateFailures)); - CACHE_LOG_ALWAYS((" Deactivated Unbound Entries = %d\n", + CACHE_LOG_INFO((" Deactivated Unbound Entries = %d\n", mDeactivatedUnboundEntries)); } diff --git a/netwerk/cache/nsDiskCacheDevice.cpp b/netwerk/cache/nsDiskCacheDevice.cpp index 096f69b6d1..6a56959d15 100644 --- a/netwerk/cache/nsDiskCacheDevice.cpp +++ b/netwerk/cache/nsDiskCacheDevice.cpp @@ -986,8 +986,8 @@ nsDiskCacheDevice::OpenDiskCache() if (!exists) { nsCacheService::MarkStartingFresh(); rv = mCacheDirectory->Create(nsIFile::DIRECTORY_TYPE, 0777); - CACHE_LOG_PATH(PR_LOG_ALWAYS, "\ncreate cache directory: %s\n", mCacheDirectory); - CACHE_LOG_ALWAYS(("mCacheDirectory->Create() = %x\n", rv)); + CACHE_LOG_PATH(LogLevel::Info, "\ncreate cache directory: %s\n", mCacheDirectory); + CACHE_LOG_INFO(("mCacheDirectory->Create() = %x\n", rv)); if (NS_FAILED(rv)) return rv; diff --git a/netwerk/cache/nsDiskCacheDeviceSQL.cpp b/netwerk/cache/nsDiskCacheDeviceSQL.cpp index 10091d6d86..27c322ae94 100644 --- a/netwerk/cache/nsDiskCacheDeviceSQL.cpp +++ b/netwerk/cache/nsDiskCacheDeviceSQL.cpp @@ -223,7 +223,7 @@ nsOfflineCacheEvictionFunction::Apply() LOG(("nsOfflineCacheEvictionFunction::Apply\n")); for (int32_t i = 0; i < mItems.Count(); i++) { - if (PR_LOG_TEST(gCacheLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gCacheLog, LogLevel::Debug)) { nsAutoCString path; mItems[i]->GetNativePath(path); LOG((" removing %s\n", path.get())); diff --git a/netwerk/cache2/CacheEntry.cpp b/netwerk/cache2/CacheEntry.cpp index 902142a4c3..b349d8f689 100644 --- a/netwerk/cache2/CacheEntry.cpp +++ b/netwerk/cache2/CacheEntry.cpp @@ -198,8 +198,6 @@ CacheEntry::~CacheEntry() MOZ_COUNT_DTOR(CacheEntry); } -#ifdef PR_LOG - char const * CacheEntry::StateString(uint32_t aState) { switch (aState) { @@ -214,8 +212,6 @@ char const * CacheEntry::StateString(uint32_t aState) return "?"; } -#endif - nsresult CacheEntry::HashingKeyWithStorage(nsACString &aResult) const { return HashingKey(mStorageID, mEnhanceID, mURI, aResult); diff --git a/netwerk/cache2/CacheEntry.h b/netwerk/cache2/CacheEntry.h index 1309c17a68..2ddb6695d6 100644 --- a/netwerk/cache2/CacheEntry.h +++ b/netwerk/cache2/CacheEntry.h @@ -294,9 +294,7 @@ private: // fails to open an output stream. bool mHasData : 1; -#ifdef PR_LOG static char const * StateString(uint32_t aState); -#endif enum EState { // transiting to: NOTLOADED = 0, // -> LOADING | EMPTY diff --git a/netwerk/cache2/CacheLog.cpp b/netwerk/cache2/CacheLog.cpp index 6ce3203081..b9205c20d7 100644 --- a/netwerk/cache2/CacheLog.cpp +++ b/netwerk/cache2/CacheLog.cpp @@ -14,7 +14,7 @@ namespace net { // set NSPR_LOG_MODULES=cache2:5 // set NSPR_LOG_FILE=nspr.log // -// this enables PR_LOG_DEBUG level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file nspr.log PRLogModuleInfo* GetCache2Log() { diff --git a/netwerk/cache2/CacheLog.h b/netwerk/cache2/CacheLog.h index 911d02a3cb..a726d852cd 100644 --- a/netwerk/cache2/CacheLog.h +++ b/netwerk/cache2/CacheLog.h @@ -11,8 +11,8 @@ namespace mozilla { namespace net { extern PRLogModuleInfo* GetCache2Log(); -#define LOG(x) PR_LOG(GetCache2Log(), PR_LOG_DEBUG, x) -#define LOG_ENABLED() PR_LOG_TEST(GetCache2Log(), PR_LOG_DEBUG) +#define LOG(x) MOZ_LOG(GetCache2Log(), mozilla::LogLevel::Debug, x) +#define LOG_ENABLED() MOZ_LOG_TEST(GetCache2Log(), mozilla::LogLevel::Debug) } // namespace net } // namespace mozilla diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index 6fac12911b..e6731686a2 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -196,41 +196,41 @@ GetCookieLog() #define COOKIE_LOGEVICTED(a, details) \ PR_BEGIN_MACRO \ - if (PR_LOG_TEST(GetCookieLog(), PR_LOG_DEBUG)) \ + if (MOZ_LOG_TEST(GetCookieLog(), LogLevel::Debug)) \ LogEvicted(a, details); \ PR_END_MACRO #define COOKIE_LOGSTRING(lvl, fmt) \ PR_BEGIN_MACRO \ - PR_LOG(GetCookieLog(), lvl, fmt); \ - PR_LOG(GetCookieLog(), lvl, ("\n")); \ + MOZ_LOG(GetCookieLog(), lvl, fmt); \ + MOZ_LOG(GetCookieLog(), 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 (!PR_LOG_TEST(GetCookieLog(), PR_LOG_WARNING)) + if (!MOZ_LOG_TEST(GetCookieLog(), LogLevel::Warning)) return; nsAutoCString spec; if (aHostURI) aHostURI->GetAsciiSpec(spec); - PR_LOG(GetCookieLog(), PR_LOG_WARNING, + MOZ_LOG(GetCookieLog(), LogLevel::Warning, ("===== %s =====\n", aSetCookie ? "COOKIE NOT ACCEPTED" : "COOKIE NOT SENT")); - PR_LOG(GetCookieLog(), PR_LOG_WARNING,("request URL: %s\n", spec.get())); + MOZ_LOG(GetCookieLog(), LogLevel::Warning,("request URL: %s\n", spec.get())); if (aSetCookie) - PR_LOG(GetCookieLog(), PR_LOG_WARNING,("cookie string: %s\n", aCookieString)); + MOZ_LOG(GetCookieLog(), 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); - PR_LOG(GetCookieLog(), PR_LOG_WARNING,("current time: %s", timeString)); - PR_LOG(GetCookieLog(), PR_LOG_WARNING,("rejected because %s\n", aReason)); - PR_LOG(GetCookieLog(), PR_LOG_WARNING,("\n")); + 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")); } static void @@ -241,27 +241,27 @@ LogCookie(nsCookie *aCookie) char timeString[40]; PR_FormatTimeUSEnglish(timeString, 40, "%c GMT", &explodedTime); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("current time: %s", timeString)); + MOZ_LOG(GetCookieLog(), LogLevel::Debug,("current time: %s", timeString)); if (aCookie) { - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("----------------\n")); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("name: %s\n", aCookie->Name().get())); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("value: %s\n", aCookie->Value().get())); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("%s: %s\n", aCookie->IsDomain() ? "domain" : "host", aCookie->Host().get())); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("path: %s\n", aCookie->Path().get())); + 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())); PR_ExplodeTime(aCookie->Expiry() * int64_t(PR_USEC_PER_SEC), PR_GMTParameters, &explodedTime); PR_FormatTimeUSEnglish(timeString, 40, "%c GMT", &explodedTime); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG, + MOZ_LOG(GetCookieLog(), 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); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("created: %s", timeString)); + MOZ_LOG(GetCookieLog(), LogLevel::Debug,("created: %s", timeString)); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("is secure: %s\n", aCookie->IsSecure() ? "true" : "false")); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("is httpOnly: %s\n", aCookie->IsHttpOnly() ? "true" : "false")); + 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")); } } @@ -269,7 +269,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 (!PR_LOG_TEST(GetCookieLog(), PR_LOG_DEBUG)) { + if (!MOZ_LOG_TEST(GetCookieLog(), LogLevel::Debug)) { return; } @@ -277,27 +277,27 @@ LogSuccess(bool aSetCookie, nsIURI *aHostURI, const char *aCookieString, nsCooki if (aHostURI) aHostURI->GetAsciiSpec(spec); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG, + MOZ_LOG(GetCookieLog(), LogLevel::Debug, ("===== %s =====\n", aSetCookie ? "COOKIE ACCEPTED" : "COOKIE SENT")); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("request URL: %s\n", spec.get())); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("cookie string: %s\n", aCookieString)); + MOZ_LOG(GetCookieLog(), LogLevel::Debug,("request URL: %s\n", spec.get())); + MOZ_LOG(GetCookieLog(), LogLevel::Debug,("cookie string: %s\n", aCookieString)); if (aSetCookie) - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("replaces existing cookie: %s\n", aReplacing ? "true" : "false")); + MOZ_LOG(GetCookieLog(), LogLevel::Debug,("replaces existing cookie: %s\n", aReplacing ? "true" : "false")); LogCookie(aCookie); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("\n")); + MOZ_LOG(GetCookieLog(), LogLevel::Debug,("\n")); } static void LogEvicted(nsCookie *aCookie, const char* details) { - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("===== COOKIE EVICTED =====\n")); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("%s\n", details)); + MOZ_LOG(GetCookieLog(), LogLevel::Debug,("===== COOKIE EVICTED =====\n")); + MOZ_LOG(GetCookieLog(), LogLevel::Debug,("%s\n", details)); LogCookie(aCookie); - PR_LOG(GetCookieLog(), PR_LOG_DEBUG,("\n")); + MOZ_LOG(GetCookieLog(), LogLevel::Debug,("\n")); } // inline wrappers to make passing in nsAFlatCStrings easier @@ -343,13 +343,13 @@ protected: public: NS_IMETHOD HandleError(mozIStorageError* aError) override { - if (PR_LOG_TEST(GetCookieLog(), PR_LOG_WARNING)) { + if (MOZ_LOG_TEST(GetCookieLog(), LogLevel::Warning)) { int32_t result = -1; aError->GetResult(&result); nsAutoCString message; aError->GetMessage(message); - COOKIE_LOGSTRING(PR_LOG_WARNING, + COOKIE_LOGSTRING(LogLevel::Warning, ("DBListenerErrorHandler::HandleError(): Error %d occurred while " "performing operation '%s' with message '%s'; rebuilding database.", result, GetOpType(), message.get())); @@ -388,7 +388,7 @@ public: // so. if (mDBState->corruptFlag == DBState::REBUILDING && aReason == mozIStorageStatementCallback::REASON_FINISHED) { - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("InsertCookieDBListener::HandleCompletion(): rebuild complete")); mDBState->corruptFlag = DBState::OK; } @@ -519,12 +519,12 @@ public: case mozIStorageStatementCallback::REASON_CANCELED: // Nothing more to do here. The partially read data has already been // thrown away. - COOKIE_LOGSTRING(PR_LOG_DEBUG, ("Read canceled")); + COOKIE_LOGSTRING(LogLevel::Debug, ("Read canceled")); break; case mozIStorageStatementCallback::REASON_ERROR: // Nothing more to do here. DBListenerErrorHandler::HandleError() // can handle it. - COOKIE_LOGSTRING(PR_LOG_DEBUG, ("Read error")); + COOKIE_LOGSTRING(LogLevel::Debug, ("Read error")); break; default: NS_NOTREACHED("invalid reason"); @@ -750,7 +750,7 @@ nsCookieService::Init() mPermissionService = do_GetService(NS_COOKIEPERMISSION_CONTRACTID); if (!mPermissionService) { NS_WARNING("nsICookiePermission implementation not available - some features won't work!"); - COOKIE_LOGSTRING(PR_LOG_WARNING, ("Init(): nsICookiePermission implementation not available")); + COOKIE_LOGSTRING(LogLevel::Warning, ("Init(): nsICookiePermission implementation not available")); } return NS_OK; @@ -774,7 +774,7 @@ nsCookieService::InitDBStates() getter_AddRefs(mDefaultDBState->cookieFile)); if (NS_FAILED(rv)) { // We've already set up our DBStates appropriately; nothing more to do. - COOKIE_LOGSTRING(PR_LOG_WARNING, + COOKIE_LOGSTRING(LogLevel::Warning, ("InitDBStates(): couldn't get cookie file")); return; } @@ -786,7 +786,7 @@ nsCookieService::InitDBStates() if (result == RESULT_RETRY) { // Database may be corrupt. Synchronously close the connection, clean up the // default DBState, and try again. - COOKIE_LOGSTRING(PR_LOG_WARNING, ("InitDBStates(): retrying TryInitDB()")); + COOKIE_LOGSTRING(LogLevel::Warning, ("InitDBStates(): retrying TryInitDB()")); CleanupCachedStatements(); CleanupDefaultDBConnection(); result = TryInitDB(true); @@ -797,7 +797,7 @@ nsCookieService::InitDBStates() } if (result == RESULT_FAILURE) { - COOKIE_LOGSTRING(PR_LOG_WARNING, + COOKIE_LOGSTRING(LogLevel::Warning, ("InitDBStates(): TryInitDB() failed, closing connection")); // Connection failure is unrecoverable. Clean up our connection. We can run @@ -1085,7 +1085,7 @@ nsCookieService::TryInitDB(bool aRecreateDB) "DROP TABLE moz_cookies_old")); NS_ENSURE_SUCCESS(rv, RESULT_RETRY); - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("Upgraded database to schema version 5")); } @@ -1340,7 +1340,7 @@ nsCookieService::CleanupDefaultDBConnection() void nsCookieService::HandleDBClosed(DBState* aDBState) { - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("HandleDBClosed(): DBState %x closed", aDBState)); switch (aDBState->corruptFlag) { @@ -1364,7 +1364,7 @@ nsCookieService::HandleDBClosed(DBState* aDBState) nsresult rv = backupFile->MoveToNative(nullptr, NS_LITERAL_CSTRING(COOKIES_FILE ".bak-rebuild")); - COOKIE_LOGSTRING(PR_LOG_WARNING, + COOKIE_LOGSTRING(LogLevel::Warning, ("HandleDBClosed(): DBState %x encountered error rebuilding db; move to " "'cookies.sqlite.bak-rebuild' gave rv 0x%x", aDBState, rv)); mObserverService->NotifyObservers(nullptr, "cookie-db-closed", nullptr); @@ -1379,12 +1379,12 @@ nsCookieService::HandleCorruptDB(DBState* aDBState) if (mDefaultDBState != aDBState) { // We've either closed the state or we've switched profiles. It's getting // a bit late to rebuild -- bail instead. - COOKIE_LOGSTRING(PR_LOG_WARNING, + COOKIE_LOGSTRING(LogLevel::Warning, ("HandleCorruptDB(): DBState %x is already closed, aborting", aDBState)); return; } - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("HandleCorruptDB(): DBState %x has corruptFlag %u", aDBState, aDBState->corruptFlag)); @@ -1461,13 +1461,13 @@ nsCookieService::RebuildCorruptDB(DBState* aDBState) // a bit late to rebuild -- bail instead. In any case, we were waiting // on rebuild completion to notify of the db closure, which won't happen -- // do so now. - COOKIE_LOGSTRING(PR_LOG_WARNING, + COOKIE_LOGSTRING(LogLevel::Warning, ("RebuildCorruptDB(): DBState %x is stale, aborting", aDBState)); mObserverService->NotifyObservers(nullptr, "cookie-db-closed", nullptr); return; } - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("RebuildCorruptDB(): creating new database")); // The database has been closed, and we're ready to rebuild. Open a @@ -1476,7 +1476,7 @@ nsCookieService::RebuildCorruptDB(DBState* aDBState) if (result != RESULT_OK) { // We're done. Reset our DB connection and statements, and notify of // closure. - COOKIE_LOGSTRING(PR_LOG_WARNING, + COOKIE_LOGSTRING(LogLevel::Warning, ("RebuildCorruptDB(): TryInitDB() failed with result %u", result)); CleanupCachedStatements(); CleanupDefaultDBConnection(); @@ -1498,7 +1498,7 @@ nsCookieService::RebuildCorruptDB(DBState* aDBState) uint32_t length; paramsArray->GetLength(&length); if (length == 0) { - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("RebuildCorruptDB(): nothing to write, rebuild complete")); mDefaultDBState->corruptFlag = DBState::OK; return; @@ -1921,7 +1921,7 @@ nsCookieService::RemoveAll() NS_ASSERT_SUCCESS(rv); } else { // Recreate the database. - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("RemoveAll(): corruption detected with rv 0x%x", rv)); HandleCorruptDB(mDefaultDBState); } @@ -2197,7 +2197,7 @@ nsCookieService::AsyncReadComplete() mDefaultDBState->hostArray.Clear(); mDefaultDBState->readSet.Clear(); - COOKIE_LOGSTRING(PR_LOG_DEBUG, ("Read(): %ld cookies read", + COOKIE_LOGSTRING(LogLevel::Debug, ("Read(): %ld cookies read", mDefaultDBState->cookieCount)); mObserverService->NotifyObservers(nullptr, "cookie-db-read", nullptr); @@ -2268,7 +2268,7 @@ nsCookieService::EnsureReadDomain(const nsCookieKey &aKey) if (NS_FAILED(rv)) { // Recreate the database. - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("EnsureReadDomain(): corruption detected when creating statement " "with rv 0x%x", rv)); HandleCorruptDB(mDefaultDBState); @@ -2298,7 +2298,7 @@ nsCookieService::EnsureReadDomain(const nsCookieKey &aKey) rv = mDefaultDBState->stmtReadDomain->ExecuteStep(&hasResult); if (NS_FAILED(rv)) { // Recreate the database. - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("EnsureReadDomain(): corruption detected when reading result " "with rv 0x%x", rv)); HandleCorruptDB(mDefaultDBState); @@ -2320,7 +2320,7 @@ nsCookieService::EnsureReadDomain(const nsCookieKey &aKey) // Add it to the hashset of read entries, so we don't read it again. mDefaultDBState->readSet.PutEntry(aKey); - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("EnsureReadDomain(): %ld cookies read for base domain %s, " " appId=%u, inBrowser=%d", array.Length(), aKey.mBaseDomain.get(), (unsigned)aKey.mAppId, (int)aKey.mInBrowserElement)); @@ -2361,7 +2361,7 @@ nsCookieService::EnsureReadComplete() if (NS_FAILED(rv)) { // Recreate the database. - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("EnsureReadComplete(): corruption detected when creating statement " "with rv 0x%x", rv)); HandleCorruptDB(mDefaultDBState); @@ -2376,7 +2376,7 @@ nsCookieService::EnsureReadComplete() rv = stmt->ExecuteStep(&hasResult); if (NS_FAILED(rv)) { // Recreate the database. - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("EnsureReadComplete(): corruption detected when reading result " "with rv 0x%x", rv)); HandleCorruptDB(mDefaultDBState); @@ -2410,7 +2410,7 @@ nsCookieService::EnsureReadComplete() mDefaultDBState->syncConn = nullptr; mDefaultDBState->readSet.Clear(); - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("EnsureReadComplete(): %ld cookies read", array.Length())); } @@ -2582,7 +2582,7 @@ nsCookieService::ImportCookies(nsIFile *aCookieFile) } - COOKIE_LOGSTRING(PR_LOG_DEBUG, ("ImportCookies(): %ld cookies imported", + COOKIE_LOGSTRING(LogLevel::Debug, ("ImportCookies(): %ld cookies imported", mDefaultDBState->cookieCount)); return NS_OK; @@ -3791,7 +3791,7 @@ nsCookieService::PurgeCookies(int64_t aCurrentTimeInUsec) EnsureReadComplete(); uint32_t initialCookieCount = mDBState->cookieCount; - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("PurgeCookies(): beginning purge with %ld cookies and %lld oldest age", mDBState->cookieCount, aCurrentTimeInUsec - mDBState->cookieOldestTime)); @@ -3855,7 +3855,7 @@ nsCookieService::PurgeCookies(int64_t aCurrentTimeInUsec) // reset the oldest time indicator mDBState->cookieOldestTime = data.oldestTime; - COOKIE_LOGSTRING(PR_LOG_DEBUG, + COOKIE_LOGSTRING(LogLevel::Debug, ("PurgeCookies(): %ld expired; %ld purged; %ld remain; %lld oldest age", initialCookieCount - postExpiryCookieCount, postExpiryCookieCount - mDBState->cookieCount, diff --git a/netwerk/dns/GetAddrInfo.cpp b/netwerk/dns/GetAddrInfo.cpp index e608191600..6a23aa5b99 100644 --- a/netwerk/dns/GetAddrInfo.cpp +++ b/netwerk/dns/GetAddrInfo.cpp @@ -25,9 +25,9 @@ #include "mozilla/Logging.h" static PRLogModuleInfo *gGetAddrInfoLog = PR_NewLogModule("GetAddrInfo"); #define LOG(msg, ...) \ - PR_LOG(gGetAddrInfoLog, PR_LOG_DEBUG, ("[DNS]: " msg, ##__VA_ARGS__)) + MOZ_LOG(gGetAddrInfoLog, LogLevel::Debug, ("[DNS]: " msg, ##__VA_ARGS__)) #define LOG_WARNING(msg, ...) \ - PR_LOG(gGetAddrInfoLog, PR_LOG_WARNING, ("[DNS]: " msg, ##__VA_ARGS__)) + 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 diff --git a/netwerk/dns/mdns/libmdns/MDNSResponderOperator.cpp b/netwerk/dns/mdns/libmdns/MDNSResponderOperator.cpp index 92b082705d..9b2bbd773d 100644 --- a/netwerk/dns/mdns/libmdns/MDNSResponderOperator.cpp +++ b/netwerk/dns/mdns/libmdns/MDNSResponderOperator.cpp @@ -31,9 +31,9 @@ GetOperatorLog() return log; } #undef LOG_I -#define LOG_I(...) PR_LOG(GetOperatorLog(), PR_LOG_NOTICE, (__VA_ARGS__)) +#define LOG_I(...) MOZ_LOG(GetOperatorLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) #undef LOG_E -#define LOG_E(...) PR_LOG(GetOperatorLog(), PR_LOG_ERROR, (__VA_ARGS__)) +#define LOG_E(...) MOZ_LOG(GetOperatorLog(), mozilla::LogLevel::Error, (__VA_ARGS__)) namespace mozilla { namespace net { diff --git a/netwerk/dns/nsHostResolver.cpp b/netwerk/dns/nsHostResolver.cpp index 6022405119..30e61276f3 100644 --- a/netwerk/dns/nsHostResolver.cpp +++ b/netwerk/dns/nsHostResolver.cpp @@ -68,7 +68,7 @@ PR_STATIC_ASSERT (HighThreadThreshold <= MAX_RESOLVER_THREADS); //---------------------------------------------------------------------------- static PRLogModuleInfo *gHostResolverLog = nullptr; -#define LOG(args) PR_LOG(gHostResolverLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gHostResolverLog, mozilla::LogLevel::Debug, args) #define LOG_HOST(host, interface) host, \ (interface && interface[0] != '\0') ? " on interface " : "", \ diff --git a/netwerk/protocol/ftp/FTPChannelChild.cpp b/netwerk/protocol/ftp/FTPChannelChild.cpp index b4d24185fd..2b261f9f49 100644 --- a/netwerk/protocol/ftp/FTPChannelChild.cpp +++ b/netwerk/protocol/ftp/FTPChannelChild.cpp @@ -22,7 +22,7 @@ using namespace mozilla::ipc; #undef LOG -#define LOG(args) PR_LOG(gFTPLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gFTPLog, mozilla::LogLevel::Debug, args) namespace mozilla { namespace net { diff --git a/netwerk/protocol/ftp/FTPChannelParent.cpp b/netwerk/protocol/ftp/FTPChannelParent.cpp index d7c4c00e4f..64eedaac99 100644 --- a/netwerk/protocol/ftp/FTPChannelParent.cpp +++ b/netwerk/protocol/ftp/FTPChannelParent.cpp @@ -24,7 +24,7 @@ using namespace mozilla::ipc; #undef LOG -#define LOG(args) PR_LOG(gFTPLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gFTPLog, mozilla::LogLevel::Debug, args) namespace mozilla { namespace net { diff --git a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp index 6d8068ffb1..eeb8f6e623 100644 --- a/netwerk/protocol/ftp/nsFtpConnectionThread.cpp +++ b/netwerk/protocol/ftp/nsFtpConnectionThread.cpp @@ -46,8 +46,8 @@ #endif extern PRLogModuleInfo* gFTPLog; -#define LOG(args) PR_LOG(gFTPLog, PR_LOG_DEBUG, args) -#define LOG_ALWAYS(args) PR_LOG(gFTPLog, PR_LOG_ALWAYS, args) +#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; @@ -93,7 +93,7 @@ nsFtpState::nsFtpState() , mControlStatus(NS_OK) , mDeferredCallbackPending(false) { - LOG_ALWAYS(("FTP:(%x) nsFtpState created", this)); + LOG_INFO(("FTP:(%x) nsFtpState created", this)); // make sure handler stays around NS_ADDREF(gFtpHandler); @@ -101,7 +101,7 @@ nsFtpState::nsFtpState() nsFtpState::~nsFtpState() { - LOG_ALWAYS(("FTP:(%x) nsFtpState destroyed", this)); + LOG_INFO(("FTP:(%x) nsFtpState destroyed", this)); if (mProxyRequest) mProxyRequest->Cancel(NS_ERROR_FAILURE); @@ -1775,7 +1775,7 @@ nsFtpState::KillControlConnection() mControlConnection->IsAlive() && mCacheConnection) { - LOG_ALWAYS(("FTP:(%p) caching CC(%p)", this, mControlConnection.get())); + LOG_INFO(("FTP:(%p) caching CC(%p)", this, mControlConnection.get())); // Store connection persistent data mControlConnection->mServerType = mServerType; @@ -1833,7 +1833,7 @@ nsFtpState::StopProcessing() return NS_OK; mKeepRunning = false; - LOG_ALWAYS(("FTP:(%x) nsFtpState stopping", this)); + LOG_INFO(("FTP:(%x) nsFtpState stopping", this)); #ifdef DEBUG_dougt printf("FTP Stopped: [response code %d] [response msg follows:]\n%s\n", mResponseCode, mResponseMsg.get()); diff --git a/netwerk/protocol/ftp/nsFtpControlConnection.cpp b/netwerk/protocol/ftp/nsFtpControlConnection.cpp index 1350a880a3..1f158593ba 100644 --- a/netwerk/protocol/ftp/nsFtpControlConnection.cpp +++ b/netwerk/protocol/ftp/nsFtpControlConnection.cpp @@ -16,8 +16,8 @@ #include extern PRLogModuleInfo* gFTPLog; -#define LOG(args) PR_LOG(gFTPLog, PR_LOG_DEBUG, args) -#define LOG_ALWAYS(args) PR_LOG(gFTPLog, PR_LOG_ALWAYS, args) +#define LOG(args) MOZ_LOG(gFTPLog, mozilla::LogLevel::Debug, args) +#define LOG_INFO(args) MOZ_LOG(gFTPLog, mozilla::LogLevel::Info, args) // // nsFtpControlConnection implementation ... @@ -66,12 +66,12 @@ nsFtpControlConnection::nsFtpControlConnection(const nsCSubstring& host, : mServerType(0), mSessionId(gFtpHandler->GetSessionId()) , mUseUTF8(false), mHost(host), mPort(port) { - LOG_ALWAYS(("FTP:CC created @%p", this)); + LOG_INFO(("FTP:CC created @%p", this)); } nsFtpControlConnection::~nsFtpControlConnection() { - LOG_ALWAYS(("FTP:CC destroyed @%p", this)); + LOG_INFO(("FTP:CC destroyed @%p", this)); } bool @@ -153,7 +153,7 @@ nsFtpControlConnection::Disconnect(nsresult status) if (!mSocket) return NS_OK; // already disconnected - LOG_ALWAYS(("FTP:(%p) CC disconnecting (%x)", this, status)); + LOG_INFO(("FTP:(%p) CC disconnecting (%x)", this, status)); if (NS_FAILED(status)) { // break cyclic reference! diff --git a/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp index 0ea266c883..977fcc4e71 100644 --- a/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp +++ b/netwerk/protocol/ftp/nsFtpProtocolHandler.cpp @@ -42,12 +42,12 @@ using namespace mozilla::net; // set NSPR_LOG_MODULES=nsFtp:5 // set NSPR_LOG_FILE=nspr.log // -// this enables PR_LOG_DEBUG level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file nspr.log // PRLogModuleInfo* gFTPLog = nullptr; #undef LOG -#define LOG(args) PR_LOG(gFTPLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gFTPLog, mozilla::LogLevel::Debug, args) //----------------------------------------------------------------------------- diff --git a/netwerk/protocol/http/HttpBaseChannel.h b/netwerk/protocol/http/HttpBaseChannel.h index 57afb8e479..130f5a45aa 100644 --- a/netwerk/protocol/http/HttpBaseChannel.h +++ b/netwerk/protocol/http/HttpBaseChannel.h @@ -478,7 +478,7 @@ protected: template nsresult HttpAsyncAborter::AsyncAbort(nsresult status) { - PR_LOG(gHttpLog, 4, + MOZ_LOG(gHttpLog, LogLevel::Debug, ("HttpAsyncAborter::AsyncAbort [this=%p status=%x]\n", mThis, status)); mThis->mStatus = status; @@ -495,7 +495,7 @@ inline void HttpAsyncAborter::HandleAsyncAbort() NS_PRECONDITION(!mCallOnResume, "How did that happen?"); if (mThis->mSuspendCount) { - PR_LOG(gHttpLog, 4, + MOZ_LOG(gHttpLog, LogLevel::Debug, ("Waiting until resume to do async notification [this=%p]\n", mThis)); mCallOnResume = &T::HandleAsyncAbort; return; diff --git a/netwerk/protocol/http/HttpLog.h b/netwerk/protocol/http/HttpLog.h index cb5f172768..a79e0c7655 100644 --- a/netwerk/protocol/http/HttpLog.h +++ b/netwerk/protocol/http/HttpLog.h @@ -31,24 +31,24 @@ // set NSPR_LOG_MODULES=nsHttp:5 // set NSPR_LOG_FILE=http.log // -// this enables PR_LOG_ALWAYS level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file http.log // extern PRLogModuleInfo *gHttpLog; // http logging -#define LOG1(args) PR_LOG(gHttpLog, 1, args) -#define LOG2(args) PR_LOG(gHttpLog, 2, args) -#define LOG3(args) PR_LOG(gHttpLog, 3, args) -#define LOG4(args) PR_LOG(gHttpLog, 4, args) -#define LOG5(args) PR_LOG(gHttpLog, 5, args) +#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 LOG(args) LOG4(args) -#define LOG1_ENABLED() PR_LOG_TEST(gHttpLog, 1) -#define LOG2_ENABLED() PR_LOG_TEST(gHttpLog, 2) -#define LOG3_ENABLED() PR_LOG_TEST(gHttpLog, 3) -#define LOG4_ENABLED() PR_LOG_TEST(gHttpLog, 4) -#define LOG5_ENABLED() PR_LOG_TEST(gHttpLog, 5) +#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 LOG_ENABLED() LOG4_ENABLED() #endif // HttpLog_h__ diff --git a/netwerk/protocol/http/nsHttpConnectionInfo.h b/netwerk/protocol/http/nsHttpConnectionInfo.h index 7b15fb0288..243e7c482e 100644 --- a/netwerk/protocol/http/nsHttpConnectionInfo.h +++ b/netwerk/protocol/http/nsHttpConnectionInfo.h @@ -54,7 +54,7 @@ public: private: virtual ~nsHttpConnectionInfo() { - PR_LOG(gHttpLog, 4, ("Destroying nsHttpConnectionInfo @%x\n", this)); + MOZ_LOG(gHttpLog, LogLevel::Debug, ("Destroying nsHttpConnectionInfo @%x\n", this)); } void BuildHashKey(); diff --git a/netwerk/protocol/res/nsResProtocolHandler.cpp b/netwerk/protocol/res/nsResProtocolHandler.cpp index 231366eb13..efe0753636 100644 --- a/netwerk/protocol/res/nsResProtocolHandler.cpp +++ b/netwerk/protocol/res/nsResProtocolHandler.cpp @@ -17,6 +17,7 @@ #include "mozilla/Omnijar.h" using mozilla::dom::ContentParent; +using mozilla::LogLevel; using mozilla::unused; static NS_DEFINE_CID(kResURLCID, NS_RESURL_CID); @@ -31,7 +32,7 @@ static nsResProtocolHandler *gResHandler = nullptr; // set NSPR_LOG_MODULES=nsResProtocol:5 // set NSPR_LOG_FILE=log.txt // -// this enables PR_LOG_ALWAYS level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file log.txt // static PRLogModuleInfo *gResLog; @@ -447,10 +448,10 @@ nsResProtocolHandler::ResolveURI(nsIURI *uri, nsACString &result) rv = baseURI->Resolve(nsDependentCString(p, path.Length()-1), result); - if (PR_LOG_TEST(gResLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gResLog, LogLevel::Debug)) { nsAutoCString spec; uri->GetAsciiSpec(spec); - PR_LOG(gResLog, PR_LOG_DEBUG, + MOZ_LOG(gResLog, LogLevel::Debug, ("%s\n -> %s\n", spec.get(), PromiseFlatCString(result).get())); } return rv; diff --git a/netwerk/protocol/rtsp/controller/RtspController.cpp b/netwerk/protocol/rtsp/controller/RtspController.cpp index 5d868e1498..5594fcf05f 100644 --- a/netwerk/protocol/rtsp/controller/RtspController.cpp +++ b/netwerk/protocol/rtsp/controller/RtspController.cpp @@ -44,7 +44,7 @@ extern PRLogModuleInfo* gRtspLog; #undef LOG -#define LOG(args) PR_LOG(gRtspLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gRtspLog, mozilla::LogLevel::Debug, args) namespace mozilla { namespace net { diff --git a/netwerk/protocol/rtsp/controller/RtspControllerChild.cpp b/netwerk/protocol/rtsp/controller/RtspControllerChild.cpp index d90590808c..147b8c691a 100644 --- a/netwerk/protocol/rtsp/controller/RtspControllerChild.cpp +++ b/netwerk/protocol/rtsp/controller/RtspControllerChild.cpp @@ -18,7 +18,7 @@ PRLogModuleInfo* gRtspChildLog = nullptr; #undef LOG -#define LOG(args) PR_LOG(gRtspChildLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gRtspChildLog, mozilla::LogLevel::Debug, args) const uint32_t kRtspTotalTracks = 2; const unsigned long kRtspCommandDelayMs = 200; diff --git a/netwerk/protocol/rtsp/controller/RtspControllerParent.cpp b/netwerk/protocol/rtsp/controller/RtspControllerParent.cpp index 9fcb1dfec4..56e780fb5e 100644 --- a/netwerk/protocol/rtsp/controller/RtspControllerParent.cpp +++ b/netwerk/protocol/rtsp/controller/RtspControllerParent.cpp @@ -19,7 +19,7 @@ PRLogModuleInfo* gRtspLog; #undef LOG -#define LOG(args) PR_LOG(gRtspLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gRtspLog, mozilla::LogLevel::Debug, args) #define SEND_DISCONNECT_IF_ERROR(rv) \ if (NS_FAILED(rv) && mIPCOpen && mTotalTracks > 0ul) { \ diff --git a/netwerk/protocol/rtsp/rtsp/RtspPrlog.h b/netwerk/protocol/rtsp/rtsp/RtspPrlog.h index 63007afe34..fb4d26492b 100644 --- a/netwerk/protocol/rtsp/rtsp/RtspPrlog.h +++ b/netwerk/protocol/rtsp/rtsp/RtspPrlog.h @@ -11,9 +11,9 @@ extern PRLogModuleInfo* gRtspLog; -#define LOGI(msg, ...) PR_LOG(gRtspLog, PR_LOG_ALWAYS, (msg, ##__VA_ARGS__)) -#define LOGV(msg, ...) PR_LOG(gRtspLog, PR_LOG_DEBUG, (msg, ##__VA_ARGS__)) -#define LOGE(msg, ...) PR_LOG(gRtspLog, PR_LOG_ERROR, (msg, ##__VA_ARGS__)) -#define LOGW(msg, ...) PR_LOG(gRtspLog, PR_LOG_WARNING, (msg, ##__VA_ARGS__)) +#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__)) #endif // RTSPPRLOG_H diff --git a/netwerk/protocol/websocket/WebSocketLog.h b/netwerk/protocol/websocket/WebSocketLog.h index 5197aa818e..3c4190d3f6 100644 --- a/netwerk/protocol/websocket/WebSocketLog.h +++ b/netwerk/protocol/websocket/WebSocketLog.h @@ -14,6 +14,6 @@ extern PRLogModuleInfo* webSocketLog; #undef LOG -#define LOG(args) PR_LOG(webSocketLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(webSocketLog, mozilla::LogLevel::Debug, args) #endif diff --git a/netwerk/protocol/wyciwyg/nsWyciwyg.h b/netwerk/protocol/wyciwyg/nsWyciwyg.h index 55d2d5c6d1..7fbd24a404 100644 --- a/netwerk/protocol/wyciwyg/nsWyciwyg.h +++ b/netwerk/protocol/wyciwyg/nsWyciwyg.h @@ -20,22 +20,22 @@ // set NSPR_LOG_MODULES=nsWyciwyg:5 // set NSPR_LOG_FILE=wyciwyg.log // -// this enables PR_LOG_ALWAYS level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file wyciwyg.log // extern PRLogModuleInfo *gWyciwygLog; // http logging -#define LOG1(args) PR_LOG(gWyciwygLog, 1, args) -#define LOG2(args) PR_LOG(gWyciwygLog, 2, args) -#define LOG3(args) PR_LOG(gWyciwygLog, 3, args) -#define LOG4(args) PR_LOG(gWyciwygLog, 4, args) +#define LOG1(args) MOZ_LOG(gWyciwygLog, mozilla::LogLevel::Error, args) +#define LOG2(args) MOZ_LOG(gWyciwygLog, mozilla::LogLevel::Warning, args) +#define LOG3(args) MOZ_LOG(gWyciwygLog, mozilla::LogLevel::Info, args) +#define LOG4(args) MOZ_LOG(gWyciwygLog, mozilla::LogLevel::Debug, args) #define LOG(args) LOG4(args) -#define LOG1_ENABLED() PR_LOG_TEST(gWyciwygLog, 1) -#define LOG2_ENABLED() PR_LOG_TEST(gWyciwygLog, 2) -#define LOG3_ENABLED() PR_LOG_TEST(gWyciwygLog, 3) -#define LOG4_ENABLED() PR_LOG_TEST(gWyciwygLog, 4) +#define LOG1_ENABLED() MOZ_LOG_TEST(gWyciwygLog, mozilla::LogLevel::Error) +#define LOG2_ENABLED() MOZ_LOG_TEST(gWyciwygLog, mozilla::LogLevel::Warning) +#define LOG3_ENABLED() MOZ_LOG_TEST(gWyciwygLog, mozilla::LogLevel::Info) +#define LOG4_ENABLED() MOZ_LOG_TEST(gWyciwygLog, mozilla::LogLevel::Debug) #define LOG_ENABLED() LOG4_ENABLED() #define WYCIWYG_TYPE "text/html" diff --git a/netwerk/sctp/datachannel/DataChannel.cpp b/netwerk/sctp/datachannel/DataChannel.cpp index 6aa8b383f8..f0a1d6ee2b 100644 --- a/netwerk/sctp/datachannel/DataChannel.cpp +++ b/netwerk/sctp/datachannel/DataChannel.cpp @@ -178,7 +178,7 @@ debug_printf(const char *format, ...) va_list ap; char buffer[1024]; - if (PR_LOG_TEST(GetSCTPLog(), PR_LOG_ALWAYS)) { + if (MOZ_LOG_TEST(GetSCTPLog(), LogLevel::Debug)) { va_start(ap, format); #ifdef _WIN32 if (vsnprintf_s(buffer, sizeof(buffer), _TRUNCATE, format, ap) > 0) { @@ -335,8 +335,8 @@ DataChannelConnection::Init(unsigned short aPort, uint16_t aNumStreams, bool aUs ); } - // Set logging to SCTP:PR_LOG_DEBUG to get SCTP debugs - if (PR_LOG_TEST(GetSCTPLog(), PR_LOG_ALWAYS)) { + // Set logging to SCTP:LogLevel::Debug to get SCTP debugs + if (MOZ_LOG_TEST(GetSCTPLog(), LogLevel::Debug)) { usrsctp_sysctl_set_sctp_debug_on(SCTP_DEBUG_ALL); } @@ -654,7 +654,7 @@ void DataChannelConnection::SctpDtlsInput(TransportFlow *flow, const unsigned char *data, size_t len) { - if (PR_LOG_TEST(GetSCTPLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetSCTPLog(), LogLevel::Debug)) { char *buf; if ((buf = usrsctp_dumppacket((void *)data, len, SCTP_DUMP_INBOUND)) != nullptr) { @@ -684,7 +684,7 @@ DataChannelConnection::SctpDtlsOutput(void *addr, void *buffer, size_t length, DataChannelConnection *peer = static_cast(addr); int res; - if (PR_LOG_TEST(GetSCTPLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetSCTPLog(), LogLevel::Debug)) { char *buf; if ((buf = usrsctp_dumppacket(buffer, length, SCTP_DUMP_OUTBOUND)) != nullptr) { diff --git a/netwerk/sctp/datachannel/DataChannelLog.h b/netwerk/sctp/datachannel/DataChannelLog.h index 4f832812a8..dfa6eb6077 100644 --- a/netwerk/sctp/datachannel/DataChannelLog.h +++ b/netwerk/sctp/datachannel/DataChannelLog.h @@ -14,6 +14,6 @@ extern PRLogModuleInfo* GetDataChannelLog(); extern PRLogModuleInfo* GetSCTPLog(); #undef LOG -#define LOG(args) PR_LOG(GetDataChannelLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(GetDataChannelLog(), mozilla::LogLevel::Debug, args) #endif diff --git a/netwerk/socket/nsSOCKSIOLayer.cpp b/netwerk/socket/nsSOCKSIOLayer.cpp index 2e2d882671..b8e6934be0 100644 --- a/netwerk/socket/nsSOCKSIOLayer.cpp +++ b/netwerk/socket/nsSOCKSIOLayer.cpp @@ -19,8 +19,10 @@ #include "nsIDNSListener.h" #include "nsICancelable.h" #include "nsThreadUtils.h" +#include "mozilla/Logging.h" #include "mozilla/net/DNS.h" +using mozilla::LogLevel; using namespace mozilla::net; static PRDescIdentity nsSOCKSIOLayerIdentity; @@ -29,8 +31,8 @@ static bool firstTime = true; static bool ipv6Supported = true; static PRLogModuleInfo *gSOCKSLog; -#define LOGDEBUG(args) PR_LOG(gSOCKSLog, PR_LOG_DEBUG, args) -#define LOGERROR(args) PR_LOG(gSOCKSLog, PR_LOG_ERROR , args) +#define LOGDEBUG(args) MOZ_LOG(gSOCKSLog, mozilla::LogLevel::Debug, args) +#define LOGERROR(args) MOZ_LOG(gSOCKSLog, mozilla::LogLevel::Error , args) class nsSOCKSSocketInfo : public nsISOCKSSocketInfo , public nsIDNSListener @@ -435,7 +437,7 @@ nsSOCKSSocketInfo::ConnectToProxy(PRFileDesc *fd) return PR_FAILURE; } - if (PR_LOG_TEST(gSOCKSLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gSOCKSLog, LogLevel::Debug)) { char buf[kIPv6CStrBufSize]; NetAddrToString(&mInternalProxyAddr, buf, sizeof(buf)); LOGDEBUG(("socks: trying proxy server, %s:%hu", diff --git a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp index a83fb5a29b..283943e766 100644 --- a/netwerk/streamconv/converters/nsFTPDirListingConv.cpp +++ b/netwerk/streamconv/converters/nsFTPDirListingConv.cpp @@ -27,7 +27,7 @@ // set NSPR_LOG_MODULES=nsFTPDirListConv:5 // set NSPR_LOG_FILE=nspr.log // -// this enables PR_LOG_DEBUG level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file nspr.log // PRLogModuleInfo* gFTPDirListConvLog = nullptr; @@ -61,7 +61,7 @@ nsFTPDirListingConv::AsyncConvertData(const char *aFromType, const char *aToType mFinalListener = aListener; NS_ADDREF(mFinalListener); - PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, + MOZ_LOG(gFTPDirListConvLog, LogLevel::Debug, ("nsFTPDirListingConv::AsyncConvertData() converting FROM raw, TO application/http-index-format\n")); return NS_OK; @@ -95,7 +95,7 @@ nsFTPDirListingConv::OnDataAvailable(nsIRequest* request, nsISupports *ctxt, // the dir listings are ascii text, null terminate this sucker. buffer[streamLen] = '\0'; - PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("nsFTPDirListingConv::OnData(request = %x, ctxt = %x, inStr = %x, sourceOffset = %llu, count = %u)\n", request, ctxt, inStr, sourceOffset, count)); + MOZ_LOG(gFTPDirListConvLog, LogLevel::Debug, ("nsFTPDirListingConv::OnData(request = %x, ctxt = %x, inStr = %x, sourceOffset = %llu, count = %u)\n", request, ctxt, inStr, sourceOffset, count)); if (!mBuffer.IsEmpty()) { // we have data left over from a previous OnDataAvailable() call. @@ -110,7 +110,7 @@ nsFTPDirListingConv::OnDataAvailable(nsIRequest* request, nsISupports *ctxt, } #ifndef DEBUG_dougt - PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("::OnData() received the following %d bytes...\n\n%s\n\n", streamLen, buffer.get()) ); + MOZ_LOG(gFTPDirListConvLog, LogLevel::Debug, ("::OnData() received the following %d bytes...\n\n%s\n\n", streamLen, buffer.get()) ); #else printf("::OnData() received the following %d bytes...\n\n%s\n\n", streamLen, buffer); #endif // DEBUG_dougt @@ -132,7 +132,7 @@ nsFTPDirListingConv::OnDataAvailable(nsIRequest* request, nsISupports *ctxt, line = DigestBufferLines(line, indexFormat); #ifndef DEBUG_dougt - PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("::OnData() sending the following %d bytes...\n\n%s\n\n", + MOZ_LOG(gFTPDirListConvLog, LogLevel::Debug, ("::OnData() sending the following %d bytes...\n\n%s\n\n", indexFormat.Length(), indexFormat.get()) ); #else char *unescData = ToNewCString(indexFormat); @@ -146,7 +146,7 @@ nsFTPDirListingConv::OnDataAvailable(nsIRequest* request, nsISupports *ctxt, // if there's any data left over, buffer it. if (line && *line) { mBuffer.Append(line); - PR_LOG(gFTPDirListConvLog, PR_LOG_DEBUG, ("::OnData() buffering the following %d bytes...\n\n%s\n\n", + MOZ_LOG(gFTPDirListConvLog, LogLevel::Debug, ("::OnData() buffering the following %d bytes...\n\n%s\n\n", strlen(line), line) ); } diff --git a/netwerk/system/linux/nsNotifyAddrListener_Linux.cpp b/netwerk/system/linux/nsNotifyAddrListener_Linux.cpp index 0a54de5410..3a41565842 100644 --- a/netwerk/system/linux/nsNotifyAddrListener_Linux.cpp +++ b/netwerk/system/linux/nsNotifyAddrListener_Linux.cpp @@ -39,7 +39,7 @@ using namespace mozilla; static PRLogModuleInfo *gNotifyAddrLog = nullptr; -#define LOG(args) PR_LOG(gNotifyAddrLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gNotifyAddrLog, mozilla::LogLevel::Debug, args) #define NETWORK_NOTIFY_CHANGED_PREF "network.notify.changed" diff --git a/netwerk/system/win32/nsNotifyAddrListener.cpp b/netwerk/system/win32/nsNotifyAddrListener.cpp index d05d1e404a..7646305061 100644 --- a/netwerk/system/win32/nsNotifyAddrListener.cpp +++ b/netwerk/system/win32/nsNotifyAddrListener.cpp @@ -36,7 +36,7 @@ using namespace mozilla; static PRLogModuleInfo *gNotifyAddrLog = nullptr; -#define LOG(args) PR_LOG(gNotifyAddrLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gNotifyAddrLog, mozilla::LogLevel::Debug, args) static HMODULE sNetshell; static decltype(NcFreeNetconProperties)* sNcFreeNetconProperties; diff --git a/netwerk/test/TestBlockingSocket.cpp b/netwerk/test/TestBlockingSocket.cpp index d7d420fb86..33acfcf407 100644 --- a/netwerk/test/TestBlockingSocket.cpp +++ b/netwerk/test/TestBlockingSocket.cpp @@ -23,7 +23,7 @@ // set NSPR_LOG_MODULES=Test:5 // static PRLogModuleInfo *gTestLog = nullptr; -#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gTestLog, mozilla::LogLevel::Debug, args) //////////////////////////////////////////////////////////////////////////////// diff --git a/netwerk/test/TestIOThreads.cpp b/netwerk/test/TestIOThreads.cpp index 699c3d2a25..0bebad8680 100644 --- a/netwerk/test/TestIOThreads.cpp +++ b/netwerk/test/TestIOThreads.cpp @@ -15,7 +15,7 @@ // set NSPR_LOG_MODULES=Test:5 // static PRLogModuleInfo *gTestLog = nullptr; -#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gTestLog, mozilla::LogLevel::Debug, args) class nsIOEvent : public nsIRunnable { public: diff --git a/netwerk/test/TestOverlappedIO.cpp b/netwerk/test/TestOverlappedIO.cpp index a09897dcb2..db954b4f62 100644 --- a/netwerk/test/TestOverlappedIO.cpp +++ b/netwerk/test/TestOverlappedIO.cpp @@ -27,7 +27,7 @@ #include "nsIByteArrayInputStream.h" static PRLogModuleInfo *gTestSocketIOLog; -#define LOG(args) PR_LOG(gTestSocketIOLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gTestSocketIOLog, mozilla::LogLevel::Debug, args) static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID); static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); diff --git a/netwerk/test/TestProtocols.cpp b/netwerk/test/TestProtocols.cpp index 678e3bc53f..6c5d6a2d56 100644 --- a/netwerk/test/TestProtocols.cpp +++ b/netwerk/test/TestProtocols.cpp @@ -65,7 +65,7 @@ namespace TestProtocols { // set NSPR_LOG_MODULES=Test:5 // static PRLogModuleInfo *gTestLog = nullptr; -#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gTestLog, mozilla::LogLevel::Debug, args) static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID); diff --git a/netwerk/test/TestServ.cpp b/netwerk/test/TestServ.cpp index ac89ea057c..79a6a336fd 100644 --- a/netwerk/test/TestServ.cpp +++ b/netwerk/test/TestServ.cpp @@ -17,7 +17,7 @@ // set NSPR_LOG_MODULES=Test:5 // static PRLogModuleInfo *gTestLog = nullptr; -#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gTestLog, mozilla::LogLevel::Debug, args) class MySocketListener : public nsIServerSocketListener { diff --git a/netwerk/test/TestSocketIO.cpp b/netwerk/test/TestSocketIO.cpp index 61d2f7b423..319e8e1a4b 100644 --- a/netwerk/test/TestSocketIO.cpp +++ b/netwerk/test/TestSocketIO.cpp @@ -26,7 +26,7 @@ #include "nsIByteArrayInputStream.h" static PRLogModuleInfo *gTestSocketIOLog; -#define LOG(args) PR_LOG(gTestSocketIOLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gTestSocketIOLog, mozilla::LogLevel::Debug, args) static NS_DEFINE_CID(kSocketTransportServiceCID, NS_SOCKETTRANSPORTSERVICE_CID); static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); diff --git a/netwerk/test/TestSocketTransport.cpp b/netwerk/test/TestSocketTransport.cpp index 550e3b8cb3..a702e9261c 100644 --- a/netwerk/test/TestSocketTransport.cpp +++ b/netwerk/test/TestSocketTransport.cpp @@ -31,7 +31,7 @@ // set NSPR_LOG_MODULES=Test:5 // static PRLogModuleInfo *gTestLog = nullptr; -#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gTestLog, mozilla::LogLevel::Debug, args) //////////////////////////////////////////////////////////////////////////////// diff --git a/netwerk/test/TestStreamChannel.cpp b/netwerk/test/TestStreamChannel.cpp index 775375da0c..80ee03d736 100644 --- a/netwerk/test/TestStreamChannel.cpp +++ b/netwerk/test/TestStreamChannel.cpp @@ -29,7 +29,7 @@ // set NSPR_LOG_MODULES=Test:5 // static PRLogModuleInfo *gTestLog = nullptr; -#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gTestLog, mozilla::LogLevel::Debug, args) //////////////////////////////////////////////////////////////////////////////// diff --git a/netwerk/test/TestStreamLoader.cpp b/netwerk/test/TestStreamLoader.cpp index adaee65fee..1ddc105036 100644 --- a/netwerk/test/TestStreamLoader.cpp +++ b/netwerk/test/TestStreamLoader.cpp @@ -10,7 +10,7 @@ // set NSPR_LOG_MODULES=Test:5 // static PRLogModuleInfo *gTestLog = nullptr; -#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gTestLog, mozilla::LogLevel::Debug, args) class MyStreamLoaderObserver final : public nsIStreamLoaderObserver { diff --git a/netwerk/test/TestStreamPump.cpp b/netwerk/test/TestStreamPump.cpp index 7f27e5e00a..376b9deb7c 100644 --- a/netwerk/test/TestStreamPump.cpp +++ b/netwerk/test/TestStreamPump.cpp @@ -31,7 +31,7 @@ // set NSPR_LOG_MODULES=Test:5 // static PRLogModuleInfo *gTestLog = nullptr; -#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gTestLog, mozilla::LogLevel::Debug, args) //////////////////////////////////////////////////////////////////////////////// diff --git a/netwerk/test/TestStreamTransport.cpp b/netwerk/test/TestStreamTransport.cpp index 0a286a9d53..dd6230aeed 100644 --- a/netwerk/test/TestStreamTransport.cpp +++ b/netwerk/test/TestStreamTransport.cpp @@ -29,7 +29,7 @@ // set NSPR_LOG_MODULES=Test:5 // static PRLogModuleInfo *gTestLog = nullptr; -#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gTestLog, mozilla::LogLevel::Debug, args) //////////////////////////////////////////////////////////////////////////////// diff --git a/netwerk/test/TestUpload.cpp b/netwerk/test/TestUpload.cpp index 2af5b9a86d..e65e9c0228 100644 --- a/netwerk/test/TestUpload.cpp +++ b/netwerk/test/TestUpload.cpp @@ -20,7 +20,7 @@ // set NSPR_LOG_MODULES=Test:5 // static PRLogModuleInfo *gTestLog = nullptr; -#define LOG(args) PR_LOG(gTestLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gTestLog, mozilla::LogLevel::Debug, args) //----------------------------------------------------------------------------- // InputTestConsumer diff --git a/netwerk/wifi/nsWifiAccessPoint.cpp b/netwerk/wifi/nsWifiAccessPoint.cpp index 1243abdf67..d3dbcfee84 100644 --- a/netwerk/wifi/nsWifiAccessPoint.cpp +++ b/netwerk/wifi/nsWifiAccessPoint.cpp @@ -8,7 +8,7 @@ #include "mozilla/Logging.h" extern PRLogModuleInfo *gWifiMonitorLog; -#define LOG(args) PR_LOG(gWifiMonitorLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gWifiMonitorLog, mozilla::LogLevel::Debug, args) NS_IMPL_ISUPPORTS(nsWifiAccessPoint, nsIWifiAccessPoint) diff --git a/netwerk/wifi/nsWifiMonitor.h b/netwerk/wifi/nsWifiMonitor.h index 21f4c8a0a1..4ab5962b1e 100644 --- a/netwerk/wifi/nsWifiMonitor.h +++ b/netwerk/wifi/nsWifiMonitor.h @@ -27,7 +27,7 @@ #endif extern PRLogModuleInfo *gWifiMonitorLog; -#define LOG(args) PR_LOG(gWifiMonitorLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(gWifiMonitorLog, mozilla::LogLevel::Debug, args) class nsWifiAccessPoint; diff --git a/parser/htmlparser/nsExpatDriver.cpp b/parser/htmlparser/nsExpatDriver.cpp index 11d5125305..ee6c977f39 100644 --- a/parser/htmlparser/nsExpatDriver.cpp +++ b/parser/htmlparser/nsExpatDriver.cpp @@ -30,6 +30,10 @@ #include "nsUnicharInputStream.h" #include "nsIFrame.h" +#include "mozilla/Logging.h" + +using mozilla::LogLevel; + #define kExpatSeparatorChar 0xFFFF static const char16_t kUTF16[] = { 'U', 'T', 'F', '-', '1', '6', '\0' }; @@ -1074,7 +1078,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens) nsScannerIterator end; aScanner.EndReading(end); - PR_LOG(GetExpatDriverLog(), PR_LOG_DEBUG, + MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug, ("Remaining in expat's buffer: %i, remaining in scanner: %i.", mExpatBuffered, Distance(start, end))); @@ -1095,7 +1099,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens) length = 0; if (blocked) { - PR_LOG(GetExpatDriverLog(), PR_LOG_DEBUG, + MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug, ("Resuming Expat, will parse data remaining in Expat's " "buffer.\nContent of Expat's buffer:\n-----\n%s\n-----\n", NS_ConvertUTF16toUTF8(currentExpatPosition.get(), @@ -1104,7 +1108,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens) else { NS_ASSERTION(mExpatBuffered == Distance(currentExpatPosition, end), "Didn't pass all the data to Expat?"); - PR_LOG(GetExpatDriverLog(), PR_LOG_DEBUG, + MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug, ("Last call to Expat, will parse data remaining in Expat's " "buffer.\nContent of Expat's buffer:\n-----\n%s\n-----\n", NS_ConvertUTF16toUTF8(currentExpatPosition.get(), @@ -1115,7 +1119,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens) buffer = start.get(); length = uint32_t(start.size_forward()); - PR_LOG(GetExpatDriverLog(), PR_LOG_DEBUG, + MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug, ("Calling Expat, will parse data remaining in Expat's buffer and " "new data.\nContent of Expat's buffer:\n-----\n%s\n-----\nNew " "data:\n-----\n%s\n-----\n", @@ -1161,7 +1165,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens) mExpatBuffered += length - consumed; if (BlockedOrInterrupted()) { - PR_LOG(GetExpatDriverLog(), PR_LOG_DEBUG, + MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug, ("Blocked or interrupted parser (probably for loading linked " "stylesheets or scripts).")); @@ -1222,7 +1226,7 @@ nsExpatDriver::ConsumeToken(nsScanner& aScanner, bool& aFlushTokens) aScanner.SetPosition(currentExpatPosition, true); aScanner.Mark(); - PR_LOG(GetExpatDriverLog(), PR_LOG_DEBUG, + MOZ_LOG(GetExpatDriverLog(), LogLevel::Debug, ("Remaining in expat's buffer: %i, remaining in scanner: %i.", mExpatBuffered, Distance(currentExpatPosition, end))); diff --git a/rdf/base/nsInMemoryDataSource.cpp b/rdf/base/nsInMemoryDataSource.cpp index fafa4d7f88..bf36645cef 100644 --- a/rdf/base/nsInMemoryDataSource.cpp +++ b/rdf/base/nsInMemoryDataSource.cpp @@ -69,6 +69,8 @@ #include "rdfIDataSource.h" #include "rdfITripleVisitor.h" +using mozilla::LogLevel; + // This struct is used as the slot value in the forward and reverse // arcs hash tables. // @@ -774,7 +776,7 @@ InMemoryDataSource::~InMemoryDataSource() } } - PR_LOG(gLog, PR_LOG_NOTICE, + MOZ_LOG(gLog, LogLevel::Debug, ("InMemoryDataSource(%p): destroyed.", this)); MOZ_COUNT_DTOR(InMemoryDataSource); @@ -812,7 +814,7 @@ InMemoryDataSource::LogOperation(const char* aOperation, nsIRDFNode* aTarget, bool aTruthValue) { - if (! PR_LOG_TEST(gLog, PR_LOG_NOTICE)) + if (! MOZ_LOG_TEST(gLog, LogLevel::Debug)) return; nsXPIDLCString uri; diff --git a/rdf/base/nsRDFContentSink.cpp b/rdf/base/nsRDFContentSink.cpp index 5434f2a7f8..c21eef35e2 100644 --- a/rdf/base/nsRDFContentSink.cpp +++ b/rdf/base/nsRDFContentSink.cpp @@ -307,7 +307,7 @@ RDFContentSinkImpl::~RDFContentSinkImpl() NS_IF_RELEASE(mDocumentURL); if (mContextStack) { - PR_LOG(gLog, PR_LOG_WARNING, + MOZ_LOG(gLog, LogLevel::Warning, ("rdfxml: warning! unclosed tag")); // XXX we should never need to do this, but, we'll write the @@ -323,10 +323,10 @@ RDFContentSinkImpl::~RDFContentSinkImpl() // print some fairly useless debugging info // XXX we should save line numbers on the context stack: this'd // be about 1000x more helpful. - if (resource && PR_LOG_TEST(gLog, PR_LOG_NOTICE)) { + if (resource && MOZ_LOG_TEST(gLog, LogLevel::Debug)) { nsXPIDLCString uri; resource->GetValue(getter_Copies(uri)); - PR_LOG(gLog, PR_LOG_NOTICE, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfxml: uri=%s", (const char*) uri)); } @@ -421,7 +421,7 @@ RDFContentSinkImpl::HandleStartElement(const char16_t *aName, break; case eRDFContentSinkState_InEpilog: - PR_LOG(gLog, PR_LOG_WARNING, + MOZ_LOG(gLog, LogLevel::Warning, ("rdfxml: unexpected content in epilog at line %d", aLineNumber)); break; @@ -438,7 +438,7 @@ RDFContentSinkImpl::HandleEndElement(const char16_t *aName) nsIRDFResource* resource; if (NS_FAILED(PopContext(resource, mState, mParseMode))) { // XXX parser didn't catch unmatched tags? - if (PR_LOG_TEST(gLog, PR_LOG_WARNING)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Warning)) { nsAutoString tagStr(aName); char* tagCStr = ToNewCString(tagStr); @@ -850,7 +850,7 @@ RDFContentSinkImpl::GetIdAboutAttribute(const char16_t** aAttributes, } else if (localName == kAboutEachAtom) { // XXX we don't deal with aboutEach... - //PR_LOG(gLog, PR_LOG_WARNING, + //MOZ_LOG(gLog, LogLevel::Warning, // ("rdfxml: ignoring aboutEach at line %d", // aNode.GetSourceLineNumber())); } @@ -1039,7 +1039,7 @@ RDFContentSinkImpl::OpenRDF(const char16_t* aName) SplitExpatName(aName, getter_AddRefs(localName)); if (!nameSpaceURI.EqualsLiteral(RDF_NAMESPACE_URI) || localName != kRDFAtom) { - // PR_LOG(gLog, PR_LOG_ALWAYS, + // MOZ_LOG(gLog, LogLevel::Info, // ("rdfxml: expected RDF:RDF at line %d", // aNode.GetSourceLineNumber())); @@ -1213,7 +1213,7 @@ RDFContentSinkImpl::OpenMember(const char16_t* aName, if (!nameSpaceURI.EqualsLiteral(RDF_NAMESPACE_URI) || localName != kLiAtom) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Error, ("rdfxml: expected RDF:li at line %d", -1)); // XXX pass in line number diff --git a/rdf/base/nsRDFService.cpp b/rdf/base/nsRDFService.cpp index cd7a64b7ea..ee7401eeec 100644 --- a/rdf/base/nsRDFService.cpp +++ b/rdf/base/nsRDFService.cpp @@ -834,7 +834,7 @@ RDFServiceImpl::GetResource(const nsACString& aURI, nsIRDFResource** aResource) return NS_ERROR_INVALID_ARG; const nsAFlatCString& flatURI = PromiseFlatCString(aURI); - PR_LOG(gLog, PR_LOG_DEBUG, ("rdfserv get-resource %s", flatURI.get())); + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv get-resource %s", flatURI.get())); // First, check the cache to see if we've already created and // registered this thing. @@ -1133,7 +1133,7 @@ RDFServiceImpl::RegisterResource(nsIRDFResource* aResource, bool aReplace) // only ever held a weak reference to it. We simply replace // it. - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv replace-resource [%p] <-- [%p] %s", static_cast(hdr)->mResource, aResource, (const char*) uri)); @@ -1143,7 +1143,7 @@ RDFServiceImpl::RegisterResource(nsIRDFResource* aResource, bool aReplace) if (! hdr) return NS_ERROR_OUT_OF_MEMORY; - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv register-resource [%p] %s", aResource, (const char*) uri)); } @@ -1176,7 +1176,7 @@ RDFServiceImpl::UnregisterResource(nsIRDFResource* aResource) if (! uri) return NS_ERROR_UNEXPECTED; - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv unregister-resource [%p] %s", aResource, (const char*) uri)); @@ -1212,7 +1212,7 @@ RDFServiceImpl::RegisterDataSource(nsIRDFDataSource* aDataSource, bool aReplace) // N.B., we only hold a weak reference to the datasource, so // just replace the old with the new and don't touch any // refcounts. - PR_LOG(gLog, PR_LOG_NOTICE, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv replace-datasource [%p] <-- [%p] %s", (*hep)->value, aDataSource, (const char*) uri)); @@ -1225,7 +1225,7 @@ RDFServiceImpl::RegisterDataSource(nsIRDFDataSource* aDataSource, bool aReplace) PL_HashTableAdd(mNamedDataSources, key, aDataSource); - PR_LOG(gLog, PR_LOG_NOTICE, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv register-datasource [%p] %s", aDataSource, (const char*) uri)); @@ -1265,7 +1265,7 @@ RDFServiceImpl::UnregisterDataSource(nsIRDFDataSource* aDataSource) // don't release here. PL_HashTableRawRemove(mNamedDataSources, hep, *hep); - PR_LOG(gLog, PR_LOG_NOTICE, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv unregister-datasource [%p] %s", aDataSource, (const char*) uri)); @@ -1389,7 +1389,7 @@ RDFServiceImpl::RegisterLiteral(nsIRDFLiteral* aLiteral) entry->mLiteral = aLiteral; entry->mKey = value; - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv register-literal [%p] %s", aLiteral, (const char16_t*) value)); @@ -1410,7 +1410,7 @@ RDFServiceImpl::UnregisterLiteral(nsIRDFLiteral* aLiteral) // N.B. that we _don't_ release the literal: we only held a weak // reference to it in the hashtable. - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv unregister-literal [%p] %s", aLiteral, (const char16_t*) value)); @@ -1441,7 +1441,7 @@ RDFServiceImpl::RegisterInt(nsIRDFInt* aInt) entry->mInt = aInt; entry->mKey = value; - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv register-int [%p] %d", aInt, value)); @@ -1462,7 +1462,7 @@ RDFServiceImpl::UnregisterInt(nsIRDFInt* aInt) // N.B. that we _don't_ release the literal: we only held a weak // reference to it in the hashtable. - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv unregister-int [%p] %d", aInt, value)); @@ -1493,7 +1493,7 @@ RDFServiceImpl::RegisterDate(nsIRDFDate* aDate) entry->mDate = aDate; entry->mKey = value; - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv register-date [%p] %ld", aDate, value)); @@ -1514,7 +1514,7 @@ RDFServiceImpl::UnregisterDate(nsIRDFDate* aDate) // N.B. that we _don't_ release the literal: we only held a weak // reference to it in the hashtable. - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv unregister-date [%p] %ld", aDate, value)); @@ -1539,7 +1539,7 @@ RDFServiceImpl::RegisterBlob(BlobImpl *aBlob) // made will be owned by the callee. entry->mBlob = aBlob; - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv register-blob [%p] %s", aBlob, aBlob->mData.mBytes)); @@ -1556,7 +1556,7 @@ RDFServiceImpl::UnregisterBlob(BlobImpl *aBlob) // N.B. that we _don't_ release the literal: we only held a weak // reference to it in the hashtable. - PR_LOG(gLog, PR_LOG_DEBUG, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfserv unregister-blob [%p] %s", aBlob, aBlob->mData.mBytes)); diff --git a/rdf/base/nsRDFXMLDataSource.cpp b/rdf/base/nsRDFXMLDataSource.cpp index 6449c3c1b2..4579a1838f 100644 --- a/rdf/base/nsRDFXMLDataSource.cpp +++ b/rdf/base/nsRDFXMLDataSource.cpp @@ -827,10 +827,10 @@ RDFXMLDataSourceImpl::Flush(void) if (! mURL) return NS_ERROR_NOT_INITIALIZED; - if (PR_LOG_TEST(gLog, PR_LOG_NOTICE)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Debug)) { nsAutoCString spec; mURL->GetSpec(spec); - PR_LOG(gLog, PR_LOG_NOTICE, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfxml[%p] flush(%s)", this, spec.get())); } @@ -911,13 +911,13 @@ RDFXMLDataSourceImpl::Refresh(bool aBlocking) if (mURL) { mURL->GetSpec(spec); } - PR_LOG(gLog, PR_LOG_NOTICE, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfxml[%p] refresh(%s) %sblocking", this, spec.get(), (aBlocking ? "" : "non"))); // If an asynchronous load is already pending, then just let it do // the honors. if (IsLoading()) { - PR_LOG(gLog, PR_LOG_NOTICE, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfxml[%p] refresh(%s) a load was pending", this, spec.get())); if (aBlocking) { @@ -969,12 +969,12 @@ RDFXMLDataSourceImpl::Refresh(bool aBlocking) NS_IMETHODIMP RDFXMLDataSourceImpl::BeginLoad(void) { - if (PR_LOG_TEST(gLog, PR_LOG_NOTICE)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Debug)) { nsAutoCString spec; if (mURL) { mURL->GetSpec(spec); } - PR_LOG(gLog, PR_LOG_NOTICE, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfxml[%p] begin-load(%s)", this, spec.get())); } @@ -995,12 +995,12 @@ RDFXMLDataSourceImpl::BeginLoad(void) NS_IMETHODIMP RDFXMLDataSourceImpl::Interrupt(void) { - if (PR_LOG_TEST(gLog, PR_LOG_NOTICE)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Debug)) { nsAutoCString spec; if (mURL) { mURL->GetSpec(spec); } - PR_LOG(gLog, PR_LOG_NOTICE, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfxml[%p] interrupt(%s)", this, spec.get())); } @@ -1020,12 +1020,12 @@ RDFXMLDataSourceImpl::Interrupt(void) NS_IMETHODIMP RDFXMLDataSourceImpl::Resume(void) { - if (PR_LOG_TEST(gLog, PR_LOG_NOTICE)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Debug)) { nsAutoCString spec; if (mURL) { mURL->GetSpec(spec); } - PR_LOG(gLog, PR_LOG_NOTICE, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfxml[%p] resume(%s)", this, spec.get())); } @@ -1045,12 +1045,12 @@ RDFXMLDataSourceImpl::Resume(void) NS_IMETHODIMP RDFXMLDataSourceImpl::EndLoad(void) { - if (PR_LOG_TEST(gLog, PR_LOG_NOTICE)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Debug)) { nsAutoCString spec; if (mURL) { mURL->GetSpec(spec); } - PR_LOG(gLog, PR_LOG_NOTICE, + MOZ_LOG(gLog, LogLevel::Debug, ("rdfxml[%p] end-load(%s)", this, spec.get())); } diff --git a/security/apps/AppSignatureVerification.cpp b/security/apps/AppSignatureVerification.cpp index 4aa8afa097..e3a8a66ac9 100644 --- a/security/apps/AppSignatureVerification.cpp +++ b/security/apps/AppSignatureVerification.cpp @@ -775,7 +775,7 @@ OpenSignedAppFile(AppTrustedRoot aTrustedRoot, nsIFile* aJarFile, rv = entries->GetNext(entryFilename); NS_ENSURE_SUCCESS(rv, rv); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Verifying digests for %s", + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Verifying digests for %s", entryFilename.get())); // The files that comprise the signature mechanism are not covered by the diff --git a/security/certverifier/CertVerifier.cpp b/security/certverifier/CertVerifier.cpp index ccd2cca59b..e02c0a3969 100644 --- a/security/certverifier/CertVerifier.cpp +++ b/security/certverifier/CertVerifier.cpp @@ -67,7 +67,7 @@ IsCertBuiltInRoot(CERTCertificate* cert, bool& result) { } for (PK11SlotListElement* le = slots->head; le; le = le->next) { char* token = PK11_GetTokenName(le->slot); - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("BuiltInRoot? subject=%s token=%s",cert->subjectName, token)); if (strcmp("Builtin Object Token", token) == 0) { result = true; @@ -83,7 +83,7 @@ CertListContainsExpectedKeys(const CERTCertList* certList, CertVerifier::PinningMode pinningMode) { if (pinningMode == CertVerifier::pinningDisabled) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("Pinning is disabled; not checking keys.")); return Success; } @@ -173,7 +173,7 @@ CertVerifier::VerifyCert(CERTCertificate* cert, SECCertificateUsage usage, /*optional out*/ OCSPStaplingStatus* ocspStaplingStatus, /*optional out*/ KeySizeStatus* keySizeStatus) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, ("Top of VerifyCert\n")); + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("Top of VerifyCert\n")); PR_ASSERT(cert); PR_ASSERT(usage == certificateUsageSSLServer || !(flags & FLAG_MUST_BE_EV)); diff --git a/security/certverifier/NSSCertDBTrustDomain.cpp b/security/certverifier/NSSCertDBTrustDomain.cpp index ec12abd485..3fa71b6cbb 100644 --- a/security/certverifier/NSSCertDBTrustDomain.cpp +++ b/security/certverifier/NSSCertDBTrustDomain.cpp @@ -219,7 +219,7 @@ NSSCertDBTrustDomain::GetCertTrust(EndEntityOrCA endEntityOrCA, } if (isCertRevoked) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: certificate is in blocklist")); return Result::ERROR_REVOKED_CERTIFICATE; } @@ -360,7 +360,7 @@ NSSCertDBTrustDomain::CheckRevocation(EndEntityOrCA endEntityOrCA, // TODO: need to verify that IsRevoked isn't called for trust anchors AND // that that fact is documented in mozillapkix. - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: Top of CheckRevocation\n")); // Bug 991815: The BR allow OCSP for intermediates to be up to one year old. @@ -394,7 +394,7 @@ NSSCertDBTrustDomain::CheckRevocation(EndEntityOrCA endEntityOrCA, if (stapledOCSPResponseResult == Success) { // stapled OCSP response present and good mOCSPStaplingStatus = CertVerifier::OCSP_STAPLING_GOOD; - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: stapled OCSP response: good")); return Success; } @@ -402,19 +402,19 @@ NSSCertDBTrustDomain::CheckRevocation(EndEntityOrCA endEntityOrCA, expired) { // stapled OCSP response present but expired mOCSPStaplingStatus = CertVerifier::OCSP_STAPLING_EXPIRED; - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: expired stapled OCSP response")); } else { // stapled OCSP response present but invalid for some reason mOCSPStaplingStatus = CertVerifier::OCSP_STAPLING_INVALID; - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: stapled OCSP response: failure")); return stapledOCSPResponseResult; } } else if (endEntityOrCA == EndEntityOrCA::MustBeEndEntity) { // no stapled OCSP response mOCSPStaplingStatus = CertVerifier::OCSP_STAPLING_NONE; - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: no stapled OCSP response")); } @@ -425,20 +425,20 @@ NSSCertDBTrustDomain::CheckRevocation(EndEntityOrCA endEntityOrCA, cachedResponseValidThrough); if (cachedResponsePresent) { if (cachedResponseResult == Success && cachedResponseValidThrough >= time) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: cached OCSP response: good")); return Success; } // If we have a cached revoked response, use it. if (cachedResponseResult == Result::ERROR_REVOKED_CERTIFICATE) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: cached OCSP response: revoked")); return Result::ERROR_REVOKED_CERTIFICATE; } // The cached response may indicate an unknown certificate or it may be // expired. Don't return with either of these statuses yet - we may be // able to fetch a more recent one. - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: cached OCSP response: error %ld valid " "until %lld", cachedResponseResult, cachedResponseValidThrough)); // When a good cached response has expired, it is more convenient @@ -457,7 +457,7 @@ NSSCertDBTrustDomain::CheckRevocation(EndEntityOrCA endEntityOrCA, cachedResponsePresent = false; } } else { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: no cached OCSP response")); } // At this point, if and only if cachedErrorResult is Success, there was no @@ -579,25 +579,25 @@ NSSCertDBTrustDomain::CheckRevocation(EndEntityOrCA endEntityOrCA, } } if (mOCSPFetching != FetchOCSPForDVSoftFail) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: returning SECFailure after " "OCSP request failure")); return error; } if (cachedResponseResult == Result::ERROR_OCSP_UNKNOWN_CERT) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: returning SECFailure from cached " "response after OCSP request failure")); return cachedResponseResult; } if (stapledOCSPResponseResult != Success) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: returning SECFailure from expired " "stapled response after OCSP request failure")); return stapledOCSPResponseResult; } - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: returning SECSuccess after " "OCSP request failure")); return Success; // Soft fail -> success :( @@ -612,7 +612,7 @@ NSSCertDBTrustDomain::CheckRevocation(EndEntityOrCA endEntityOrCA, response, ResponseIsFromNetwork, expired); if (rv == Success || mOCSPFetching != FetchOCSPForDVSoftFail) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: returning after VerifyEncodedOCSPResponse")); return rv; } @@ -622,13 +622,13 @@ NSSCertDBTrustDomain::CheckRevocation(EndEntityOrCA endEntityOrCA, return rv; } if (stapledOCSPResponseResult != Success) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: returning SECFailure from expired stapled " "response after OCSP request verification failure")); return stapledOCSPResponseResult; } - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: end of CheckRevocation")); return Success; // Soft fail -> success :( @@ -666,7 +666,7 @@ NSSCertDBTrustDomain::VerifyAndMaybeCacheEncodedOCSPResponse( rv == Success || rv == Result::ERROR_REVOKED_CERTIFICATE || rv == Result::ERROR_OCSP_UNKNOWN_CERT) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: caching OCSP response")); Result putRV = mOCSPCache.Put(certID, rv, thisUpdate, validThrough); if (putRV != Success) { @@ -680,7 +680,7 @@ NSSCertDBTrustDomain::VerifyAndMaybeCacheEncodedOCSPResponse( Result NSSCertDBTrustDomain::IsChainValid(const DERArray& certArray, Time time) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("NSSCertDBTrustDomain: IsChainValid")); ScopedCERTCertList certList; diff --git a/security/certverifier/OCSPCache.cpp b/security/certverifier/OCSPCache.cpp index f5ca19e0f3..29796bc61d 100644 --- a/security/certverifier/OCSPCache.cpp +++ b/security/certverifier/OCSPCache.cpp @@ -138,7 +138,7 @@ OCSPCache::FindInternal(const CertID& aCertID, /*out*/ size_t& index, static inline void LogWithCertID(const char* aMessage, const CertID& aCertID) { - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, (aMessage, &aCertID)); + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, (aMessage, &aCertID)); } void @@ -261,7 +261,7 @@ void OCSPCache::Clear() { MutexAutoLock lock(mMutex); - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, ("OCSPCache::Clear: clearing cache")); + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("OCSPCache::Clear: clearing cache")); // First go through and delete the memory being pointed to by the pointers // in the vector. for (Entry** entry = mEntries.begin(); entry < mEntries.end(); diff --git a/security/certverifier/OCSPRequestor.cpp b/security/certverifier/OCSPRequestor.cpp index 953ab84b24..c750447e62 100644 --- a/security/certverifier/OCSPRequestor.cpp +++ b/security/certverifier/OCSPRequestor.cpp @@ -56,7 +56,7 @@ AppendEscapedBase64Item(const SECItem* encodedRequest, nsACString& path) return rv; } - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("Setting up OCSP GET path, pre path =%s\n", PromiseFlatCString(path).get())); @@ -159,7 +159,7 @@ DoOCSPRequest(PLArenaPool* arena, const char* url, } else { path.Assign("/"); } - PR_LOG(gCertVerifierLog, PR_LOG_DEBUG, + MOZ_LOG(gCertVerifierLog, LogLevel::Debug, ("Setting up OCSP request: pre all path =%s pathlen=%d\n", path.get(), pathLen)); nsAutoCString method("POST"); diff --git a/security/manager/ssl/CertBlocklist.cpp b/security/manager/ssl/CertBlocklist.cpp index f52c641eae..c1819cdc3c 100644 --- a/security/manager/ssl/CertBlocklist.cpp +++ b/security/manager/ssl/CertBlocklist.cpp @@ -22,6 +22,8 @@ NS_IMPL_ISUPPORTS(CertBlocklist, nsICertBlocklist) +using namespace mozilla; + static PRLogModuleInfo* gCertBlockPRLog; CertBlocklistItem::CertBlocklistItem(const uint8_t* DNData, @@ -125,11 +127,11 @@ CertBlocklist::~CertBlocklist() nsresult CertBlocklist::Init() { - PR_LOG(gCertBlockPRLog, PR_LOG_DEBUG, ("CertBlocklist::Init")); + MOZ_LOG(gCertBlockPRLog, LogLevel::Debug, ("CertBlocklist::Init")); // Init must be on main thread for getting the profile directory if (!NS_IsMainThread()) { - PR_LOG(gCertBlockPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCertBlockPRLog, LogLevel::Debug, ("CertBlocklist::Init - called off main thread")); return NS_ERROR_NOT_SAME_THREAD; } @@ -138,7 +140,7 @@ CertBlocklist::Init() nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(mBackingFile)); if (NS_FAILED(rv) || !mBackingFile) { - PR_LOG(gCertBlockPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCertBlockPRLog, LogLevel::Debug, ("CertBlocklist::Init - couldn't get profile dir")); // Since we're returning NS_OK here, set mBackingFile to a safe value. // (We need initialization to succeed and CertBlocklist to be in a @@ -155,7 +157,7 @@ CertBlocklist::Init() if (NS_FAILED(rv)) { return rv; } - PR_LOG(gCertBlockPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCertBlockPRLog, LogLevel::Debug, ("CertBlocklist::Init certList path: %s", path.get())); return NS_OK; @@ -164,13 +166,13 @@ CertBlocklist::Init() nsresult CertBlocklist::EnsureBackingFileInitialized(mozilla::MutexAutoLock& lock) { - PR_LOG(gCertBlockPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCertBlockPRLog, LogLevel::Debug, ("CertBlocklist::EnsureBackingFileInitialized")); if (mBackingFileIsInitialized || !mBackingFile) { return NS_OK; } - PR_LOG(gCertBlockPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCertBlockPRLog, LogLevel::Debug, ("CertBlocklist::EnsureBackingFileInitialized - not initialized")); bool exists = false; @@ -179,7 +181,7 @@ CertBlocklist::EnsureBackingFileInitialized(mozilla::MutexAutoLock& lock) return rv; } if (!exists) { - PR_LOG(gCertBlockPRLog, PR_LOG_WARN, + MOZ_LOG(gCertBlockPRLog, LogLevel::Warning, ("CertBlocklist::EnsureBackingFileInitialized no revocations file")); return NS_OK; } @@ -232,11 +234,11 @@ CertBlocklist::EnsureBackingFileInitialized(mozilla::MutexAutoLock& lock) if (DN.IsEmpty() || other.IsEmpty()) { continue; } - PR_LOG(gCertBlockPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCertBlockPRLog, LogLevel::Debug, ("CertBlocklist::EnsureBackingFileInitialized adding: %s %s", DN.get(), other.get())); - PR_LOG(gCertBlockPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCertBlockPRLog, LogLevel::Debug, ("CertBlocklist::EnsureBackingFileInitialized - pre-decode")); rv = AddRevokedCertInternal(DN, other, mechanism, CertOldFromLocalCache, @@ -245,7 +247,7 @@ CertBlocklist::EnsureBackingFileInitialized(mozilla::MutexAutoLock& lock) if (NS_FAILED(rv)) { // we warn here, rather than abandoning, since we need to // ensure that as many items as possible are read - PR_LOG(gCertBlockPRLog, PR_LOG_WARN, + MOZ_LOG(gCertBlockPRLog, LogLevel::Warning, ("CertBlocklist::EnsureBackingFileInitialized adding revoked cert " "failed")); } @@ -259,7 +261,7 @@ NS_IMETHODIMP CertBlocklist::RevokeCertBySubjectAndPubKey(const char* aSubject, const char* aPubKeyHash) { - PR_LOG(gCertBlockPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCertBlockPRLog, LogLevel::Debug, ("CertBlocklist::RevokeCertBySubjectAndPubKey - subject is: %s and pubKeyHash: %s", aSubject, aPubKeyHash)); mozilla::MutexAutoLock lock(mMutex); @@ -275,7 +277,7 @@ NS_IMETHODIMP CertBlocklist::RevokeCertByIssuerAndSerial(const char* aIssuer, const char* aSerialNumber) { - PR_LOG(gCertBlockPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCertBlockPRLog, LogLevel::Debug, ("CertBlocklist::RevokeCertByIssuerAndSerial - issuer is: %s and serial: %s", aIssuer, aSerialNumber)); mozilla::MutexAutoLock lock(mMutex); @@ -450,7 +452,7 @@ WriteIssuer(nsCStringHashKey* aHashKey, void* aUserArg) NS_IMETHODIMP CertBlocklist::SaveEntries() { - PR_LOG(gCertBlockPRLog, PR_LOG_DEBUG, + MOZ_LOG(gCertBlockPRLog, LogLevel::Debug, ("CertBlocklist::SaveEntries - not initialized")); mozilla::MutexAutoLock lock(mMutex); if (!mModified) { @@ -464,7 +466,7 @@ CertBlocklist::SaveEntries() if (!mBackingFile) { // We allow this to succeed with no profile directory for tests - PR_LOG(gCertBlockPRLog, PR_LOG_WARN, + MOZ_LOG(gCertBlockPRLog, LogLevel::Warning, ("CertBlocklist::SaveEntries no file in profile to write to")); return NS_OK; } @@ -484,14 +486,14 @@ CertBlocklist::SaveEntries() mBlocklist.EnumerateEntries(ProcessBlocklistEntry, &saveInfo); if (!saveInfo.success) { - PR_LOG(gCertBlockPRLog, PR_LOG_WARN, + MOZ_LOG(gCertBlockPRLog, LogLevel::Warning, ("CertBlocklist::SaveEntries writing revocation data failed")); return NS_ERROR_FAILURE; } saveInfo.issuers.EnumerateEntries(WriteIssuer, &saveInfo); if (!saveInfo.success) { - PR_LOG(gCertBlockPRLog, PR_LOG_WARN, + MOZ_LOG(gCertBlockPRLog, LogLevel::Warning, ("CertBlocklist::SaveEntries writing revocation data failed")); return NS_ERROR_FAILURE; } @@ -504,7 +506,7 @@ CertBlocklist::SaveEntries() } rv = safeStream->Finish(); if (NS_FAILED(rv)) { - PR_LOG(gCertBlockPRLog, PR_LOG_WARN, + MOZ_LOG(gCertBlockPRLog, LogLevel::Warning, ("CertBlocklist::SaveEntries saving revocation data failed")); return rv; } diff --git a/security/manager/ssl/PSMContentListener.cpp b/security/manager/ssl/PSMContentListener.cpp index f3991455a1..77a909b62a 100644 --- a/security/manager/ssl/PSMContentListener.cpp +++ b/security/manager/ssl/PSMContentListener.cpp @@ -109,7 +109,7 @@ NS_IMPL_ISUPPORTS(PSMContentStreamListener, nsIStreamListener, nsIRequestObserve NS_IMETHODIMP PSMContentStreamListener::OnStartRequest(nsIRequest* request, nsISupports* context) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("CertDownloader::OnStartRequest\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("CertDownloader::OnStartRequest\n")); int64_t contentLength = ComputeContentLength(request); if (contentLength < 0) { @@ -127,7 +127,7 @@ PSMContentStreamListener::OnDataAvailable(nsIRequest* request, uint64_t aSourceOffset, uint32_t aLength) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("CertDownloader::OnDataAvailable\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("CertDownloader::OnDataAvailable\n")); nsCString chunk; nsresult rv = NS_ReadInputStreamToString(aIStream, chunk, aLength); @@ -144,7 +144,7 @@ PSMContentStreamListener::OnStopRequest(nsIRequest* request, nsISupports* context, nsresult aStatus) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("CertDownloader::OnStopRequest\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("CertDownloader::OnStopRequest\n")); // Because importing the cert can spin the event loop (via alerts), we can't // do it here. Do it off the event loop instead. @@ -398,7 +398,7 @@ PSMContentListener::DoContent(const nsACString& aContentType, uint32_t type; type = getPSMContentType(PromiseFlatCString(aContentType).get()); if (gPIPNSSLog) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("PSMContentListener::DoContent\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("PSMContentListener::DoContent\n")); } if (type != UNKNOWN_TYPE) { nsCOMPtr downloader; diff --git a/security/manager/ssl/PublicKeyPinningService.cpp b/security/manager/ssl/PublicKeyPinningService.cpp index fae3276087..ba40448c32 100644 --- a/security/manager/ssl/PublicKeyPinningService.cpp +++ b/security/manager/ssl/PublicKeyPinningService.cpp @@ -59,7 +59,7 @@ EvalCertWithHashType(const CERTCertificate* cert, SECOidTag hashType, { certMatchesPinset = false; if (!dynamicFingerprints) { - PR_LOG(gPublicKeyPinningLog, PR_LOG_DEBUG, + MOZ_LOG(gPublicKeyPinningLog, LogLevel::Debug, ("pkpin: No hashes found for hash type: %d\n", hashType)); return NS_ERROR_INVALID_ARG; } @@ -67,14 +67,14 @@ EvalCertWithHashType(const CERTCertificate* cert, SECOidTag hashType, nsAutoCString base64Out; nsresult rv = GetBase64HashSPKI(cert, hashType, base64Out); if (NS_FAILED(rv)) { - PR_LOG(gPublicKeyPinningLog, PR_LOG_DEBUG, + MOZ_LOG(gPublicKeyPinningLog, LogLevel::Debug, ("pkpin: GetBase64HashSPKI failed!\n")); return rv; } for (size_t i = 0; i < dynamicFingerprints->Length(); i++) { if (base64Out.Equals((*dynamicFingerprints)[i])) { - PR_LOG(gPublicKeyPinningLog, PR_LOG_DEBUG, + MOZ_LOG(gPublicKeyPinningLog, LogLevel::Debug, ("pkpin: found pin base_64 ='%s'\n", base64Out.get())); certMatchesPinset = true; return NS_OK; @@ -104,9 +104,9 @@ EvalChainWithHashType(const CERTCertList* certList, SECOidTag hashType, for (node = CERT_LIST_HEAD(certList); !CERT_LIST_END(node, certList); node = CERT_LIST_NEXT(node)) { currentCert = node->cert; - PR_LOG(gPublicKeyPinningLog, PR_LOG_DEBUG, + MOZ_LOG(gPublicKeyPinningLog, LogLevel::Debug, ("pkpin: certArray subject: '%s'\n", currentCert->subjectName)); - PR_LOG(gPublicKeyPinningLog, PR_LOG_DEBUG, + MOZ_LOG(gPublicKeyPinningLog, LogLevel::Debug, ("pkpin: certArray issuer: '%s'\n", currentCert->issuerName)); nsresult rv = EvalCertWithHashType(currentCert, hashType, dynamicFingerprints, @@ -118,7 +118,7 @@ EvalChainWithHashType(const CERTCertList* certList, SECOidTag hashType, return NS_OK; } } - PR_LOG(gPublicKeyPinningLog, PR_LOG_DEBUG, ("pkpin: no matches found\n")); + MOZ_LOG(gPublicKeyPinningLog, LogLevel::Debug, ("pkpin: no matches found\n")); return NS_OK; } @@ -151,7 +151,7 @@ FindPinningInformation(const char* hostname, mozilla::pkix::Time time, char *evalPart; // Notice how the (xx = strchr) prevents pins for unqualified domain names. while (evalPart = strchr(evalHost, '.')) { - PR_LOG(gPublicKeyPinningLog, PR_LOG_DEBUG, + MOZ_LOG(gPublicKeyPinningLog, LogLevel::Debug, ("pkpin: Querying pinsets for host: '%s'\n", evalHost)); // Look up dynamic pins nsresult rv; @@ -164,12 +164,12 @@ FindPinningInformation(const char* hostname, mozilla::pkix::Time time, return rv; } if (found && (evalHost == hostname || includeSubdomains)) { - PR_LOG(gPublicKeyPinningLog, PR_LOG_DEBUG, + MOZ_LOG(gPublicKeyPinningLog, LogLevel::Debug, ("pkpin: Found dyn match for host: '%s'\n", evalHost)); dynamicFingerprints = pinArray; return NS_OK; } else { - PR_LOG(gPublicKeyPinningLog, PR_LOG_DEBUG, + MOZ_LOG(gPublicKeyPinningLog, LogLevel::Debug, ("pkpin: Didn't find pinset for host: '%s'\n", evalHost)); } // Add one for '.' @@ -219,7 +219,7 @@ CheckChainAgainstAllNames(const CERTCertList* certList, bool enforceTestMode, /*out*/ bool& chainHasValidPins) { chainHasValidPins = false; - PR_LOG(gPublicKeyPinningLog, PR_LOG_DEBUG, + MOZ_LOG(gPublicKeyPinningLog, LogLevel::Debug, ("pkpin: top of checkChainAgainstAllNames")); CERTCertListNode* node = CERT_LIST_HEAD(certList); if (!node) { diff --git a/security/manager/ssl/RootCertificateTelemetryUtils.cpp b/security/manager/ssl/RootCertificateTelemetryUtils.cpp index 1e4ca76468..2ca71627dd 100644 --- a/security/manager/ssl/RootCertificateTelemetryUtils.cpp +++ b/security/manager/ssl/RootCertificateTelemetryUtils.cpp @@ -60,7 +60,7 @@ RootCABinNumber(const SECItem* cert) // Compare against list of stored hashes size_t idx; - PR_LOG(gPublicKeyPinningTelemetryLog, PR_LOG_DEBUG, + MOZ_LOG(gPublicKeyPinningTelemetryLog, LogLevel::Debug, ("pkpinTelem: First bytes %02hx %02hx %02hx %02hx\n", digest.get().data[0], digest.get().data[1], digest.get().data[2], digest.get().data[3])); @@ -69,7 +69,7 @@ RootCABinNumber(const SECItem* cert) reinterpret_cast(digest.get().data), digest.get().len), &idx)) { - PR_LOG(gPublicKeyPinningTelemetryLog, PR_LOG_DEBUG, + MOZ_LOG(gPublicKeyPinningTelemetryLog, LogLevel::Debug, ("pkpinTelem: Telemetry index was %lu, bin is %d\n", idx, ROOT_TABLE[idx].binNumber)); return (int32_t) ROOT_TABLE[idx].binNumber; diff --git a/security/manager/ssl/SSLServerCertVerification.cpp b/security/manager/ssl/SSLServerCertVerification.cpp index f76aca1b07..cf0cf4636d 100644 --- a/security/manager/ssl/SSLServerCertVerification.cpp +++ b/security/manager/ssl/SSLServerCertVerification.cpp @@ -448,7 +448,7 @@ DetermineCertOverrideErrors(CERTCertificate* cert, const char* hostName, SSLServerCertVerificationResult* CertErrorRunnable::CheckCertOverrides() { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p][%p] top of CheckCertOverrides\n", + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p][%p] top of CheckCertOverrides\n", mFdForLogging, this)); // "Use" mFdForLogging in non-PR_LOGGING builds, too, to suppress // clang's -Wunused-private-field build warning for this variable: @@ -464,7 +464,7 @@ CertErrorRunnable::CheckCertOverrides() NS_ISUPPORTS_CAST(nsITransportSecurityInfo*, mInfoObject)); if (sslSocketControl && sslSocketControl->GetBypassAuthentication()) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p][%p] Bypass Auth in CheckCertOverrides\n", mFdForLogging, this)); return new SSLServerCertVerificationResult(mInfoObject, 0); @@ -487,7 +487,7 @@ CertErrorRunnable::CheckCertOverrides() bool hasPinningInformation = false; nsCOMPtr sss(do_GetService(NS_SSSERVICE_CONTRACTID)); if (!sss) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p][%p] couldn't get nsISiteSecurityService to check for HSTS/HPKP\n", mFdForLogging, this)); return new SSLServerCertVerificationResult(mInfoObject, @@ -498,7 +498,7 @@ CertErrorRunnable::CheckCertOverrides() mProviderFlags, &strictTransportSecurityEnabled); if (NS_FAILED(nsrv)) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p][%p] checking for HSTS failed\n", mFdForLogging, this)); return new SSLServerCertVerificationResult(mInfoObject, mDefaultErrorCodeToReport); @@ -508,14 +508,14 @@ CertErrorRunnable::CheckCertOverrides() mProviderFlags, &hasPinningInformation); if (NS_FAILED(nsrv)) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p][%p] checking for HPKP failed\n", mFdForLogging, this)); return new SSLServerCertVerificationResult(mInfoObject, mDefaultErrorCodeToReport); } if (!strictTransportSecurityEnabled && !hasPinningInformation) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p][%p] no HSTS or HPKP - overrides allowed\n", mFdForLogging, this)); nsCOMPtr overrideService = @@ -559,18 +559,18 @@ CertErrorRunnable::CheckCertOverrides() } // all errors are covered by override rules, so let's accept the cert - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p][%p] All errors covered by override rules\n", mFdForLogging, this)); return new SSLServerCertVerificationResult(mInfoObject, 0); } } else { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p][%p] HSTS or HPKP - no overrides allowed\n", mFdForLogging, this)); } - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p][%p] Certificate error was not overridden\n", mFdForLogging, this)); @@ -668,7 +668,7 @@ CreateCertErrorRunnable(CertVerifier& certVerifier, if (!collected_errors) { // This will happen when CERT_*Verify* only returned error(s) that are // not on our whitelist of overridable certificate errors. - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] !collected_errors: %d\n", + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] !collected_errors: %d\n", fdForLogging, static_cast(defaultErrorCodeToReport))); PR_SetError(defaultErrorCodeToReport, 0); return nullptr; @@ -818,7 +818,7 @@ BlockServerCertChangeForSpdy(nsNSSSocketInfo* infoObject, } // If GetNegotiatedNPN() failed we will assume spdy for safety's safe if (NS_FAILED(rv)) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("BlockServerCertChangeForSpdy failed GetNegotiatedNPN() call." " Assuming spdy.\n")); } @@ -832,7 +832,7 @@ BlockServerCertChangeForSpdy(nsNSSSocketInfo* infoObject, } // Report an error - changed cert is confirmed - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("SPDY Refused to allow new cert during renegotiation\n")); PR_SetError(SSL_ERROR_RENEGOTIATION_NOT_ALLOWED, 0); return SECFailure; @@ -846,7 +846,7 @@ AccumulateSubjectCommonNameTelemetry(const char* commonName, // 1 means no common name present Telemetry::Accumulate(Telemetry::BR_9_2_2_SUBJECT_COMMON_NAME, 1); } else if (!commonNameInSubjectAltNames) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("BR telemetry: common name '%s' not in subject alt. names " "(or the subject alt. names extension is not present)\n", commonName)); @@ -909,7 +909,7 @@ GatherBaselineRequirementsTelemetry(const ScopedCERTCertList& certList) bool isBuiltIn = false; SECStatus rv = IsCertBuiltInRoot(rootCert, isBuiltIn); if (rv != SECSuccess || !isBuiltIn) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("BR telemetry: root certificate for '%s' is not a built-in root " "(or IsCertBuiltInRoot failed)\n", commonName.get())); return; @@ -918,7 +918,7 @@ GatherBaselineRequirementsTelemetry(const ScopedCERTCertList& certList) rv = CERT_FindCertExtension(cert, SEC_OID_X509_SUBJECT_ALT_NAME, &altNameExtension); if (rv != SECSuccess) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("BR telemetry: no subject alt names extension for '%s'\n", commonName.get())); // 1 means there is no subject alt names extension @@ -936,7 +936,7 @@ GatherBaselineRequirementsTelemetry(const ScopedCERTCertList& certList) // manually reach in and free the memory. PORT_Free(altNameExtension.data); if (!subjectAltNames) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("BR telemetry: could not decode subject alt names for '%s'\n", commonName.get())); // 2 means the subject alt names extension could not be decoded @@ -968,7 +968,7 @@ GatherBaselineRequirementsTelemetry(const ScopedCERTCertList& certList) if (!net_IsValidHostName(altNameWithoutWildcard) || net_IsValidIPv4Addr(altName.get(), altName.Length()) || net_IsValidIPv6Addr(altName.get(), altName.Length())) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("BR telemetry: DNSName '%s' not valid (for '%s')\n", altName.get(), commonName.get())); malformedDNSNameOrIPAddressPresent = true; @@ -986,7 +986,7 @@ GatherBaselineRequirementsTelemetry(const ScopedCERTCertList& certList) memcpy(&addr.inet.ip, currentName->name.other.data, currentName->name.other.len); if (PR_NetAddrToString(&addr, buf, sizeof(buf) - 1) != PR_SUCCESS) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("BR telemetry: IPAddress (v4) not valid (for '%s')\n", commonName.get())); malformedDNSNameOrIPAddressPresent = true; @@ -998,7 +998,7 @@ GatherBaselineRequirementsTelemetry(const ScopedCERTCertList& certList) memcpy(&addr.ipv6.ip, currentName->name.other.data, currentName->name.other.len); if (PR_NetAddrToString(&addr, buf, sizeof(buf) - 1) != PR_SUCCESS) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("BR telemetry: IPAddress (v6) not valid (for '%s')\n", commonName.get())); malformedDNSNameOrIPAddressPresent = true; @@ -1006,13 +1006,13 @@ GatherBaselineRequirementsTelemetry(const ScopedCERTCertList& certList) altName.Assign(buf); } } else { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("BR telemetry: IPAddress not valid (for '%s')\n", commonName.get())); malformedDNSNameOrIPAddressPresent = true; } } else { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("BR telemetry: non-DNSName, non-IPAddress present for '%s'\n", commonName.get())); nonDNSNameOrIPAddressPresent = true; @@ -1252,7 +1252,7 @@ AuthCertificate(CertVerifier& certVerifier, } status->SetServerCert(nsc, evStatus); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("AuthCertificate setting NEW cert %p\n", nsc.get())); } } @@ -1330,7 +1330,7 @@ SSLServerCertVerificationJob::Run() { // Runs on a cert verification thread - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] SSLServerCertVerificationJob::Run\n", mInfoObject.get())); PRErrorCode error; @@ -1382,7 +1382,7 @@ SSLServerCertVerificationJob::Run() // will dispatch the result asynchronously, so we don't have to block // this thread waiting for it. - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p][%p] Before dispatching CertErrorRunnable\n", mFdForLogging, runnable.get())); @@ -1430,7 +1430,7 @@ AuthCertificateHook(void* arg, PRFileDesc* fd, PRBool checkSig, PRBool isServer) // Runs on the socket transport thread - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] starting AuthCertificateHook\n", fd)); // Modern libssl always passes PR_TRUE for checkSig, and we have no means of diff --git a/security/manager/ssl/nsCertTree.cpp b/security/manager/ssl/nsCertTree.cpp index 16a2f6b005..2d9c323da7 100644 --- a/security/manager/ssl/nsCertTree.cpp +++ b/security/manager/ssl/nsCertTree.cpp @@ -430,7 +430,7 @@ nsCertTree::GetCertsByTypeFromCertList(CERTCertList *aCertList, nsCertCompareFunc aCertCmpFn, void *aCertCmpFnArg) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("GetCertsByTypeFromCertList")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("GetCertsByTypeFromCertList")); if (!aCertList) return NS_ERROR_FAILURE; @@ -1322,23 +1322,23 @@ nsCertTree::dumpMap() { for (int i=0; iorgName); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("thread desc[%d]: %s", i, NS_LossyConvertUTF16toASCII(td).get())); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("thread desc[%d]: %s", i, NS_LossyConvertUTF16toASCII(td).get())); } nsCOMPtr ct = GetCertAtIndex(i); if (ct) { char16_t *goo; ct->GetCommonName(&goo); nsAutoString doo(goo); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("cert [%d]: %s", i, NS_LossyConvertUTF16toASCII(doo).get())); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("cert [%d]: %s", i, NS_LossyConvertUTF16toASCII(doo).get())); } } } diff --git a/security/manager/ssl/nsNSSCallbacks.cpp b/security/manager/ssl/nsNSSCallbacks.cpp index b980a87767..02f87f2f94 100644 --- a/security/manager/ssl/nsNSSCallbacks.cpp +++ b/security/manager/ssl/nsNSSCallbacks.cpp @@ -263,7 +263,7 @@ SECStatus nsNSSHttpRequestSession::trySendAndReceiveFcn(PRPollDesc **pPollDesc, const char **http_response_data, uint32_t *http_response_data_len) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSHttpRequestSession::trySendAndReceiveFcn to %s\n", mURL.get())); bool onSTSThread; @@ -301,7 +301,7 @@ SECStatus nsNSSHttpRequestSession::trySendAndReceiveFcn(PRPollDesc **pPollDesc, { if (retryable_error) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSHttpRequestSession::trySendAndReceiveFcn - sleeping and retrying: %d of %d\n", retry_count, max_retries)); } @@ -323,10 +323,10 @@ SECStatus nsNSSHttpRequestSession::trySendAndReceiveFcn(PRPollDesc **pPollDesc, if (retry_count > 1) { if (retryable_error) - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSHttpRequestSession::trySendAndReceiveFcn - still failing, giving up...\n")); else - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSHttpRequestSession::trySendAndReceiveFcn - success at attempt %d\n", retry_count)); } @@ -623,7 +623,7 @@ nsHTTPListener::OnStreamComplete(nsIStreamLoader* aLoader, if (NS_FAILED(aStatus)) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsHTTPListener::OnStreamComplete status failed %d", aStatus)); } @@ -916,7 +916,7 @@ CanFalseStartCallback(PRFileDesc* fd, void* client_data, PRBool *canFalseStart) SSLCipherSuiteInfo cipherInfo; if (SSL_GetCipherSuiteInfo(channelInfo.cipherSuite, &cipherInfo, sizeof (cipherInfo)) != SECSuccess) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("CanFalseStartCallback [%p] failed - " + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("CanFalseStartCallback [%p] failed - " " KEA %d\n", fd, static_cast(channelInfo.keaType))); return SECSuccess; @@ -927,7 +927,7 @@ CanFalseStartCallback(PRFileDesc* fd, void* client_data, PRBool *canFalseStart) // Prevent version downgrade attacks from TLS 1.2, and avoid False Start for // TLS 1.3 and later. See Bug 861310 for all the details as to why. if (channelInfo.protocolVersion != SSL_LIBRARY_VERSION_TLS_1_2) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("CanFalseStartCallback [%p] failed - " + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("CanFalseStartCallback [%p] failed - " "SSL Version must be TLS 1.2, was %x\n", fd, static_cast(channelInfo.protocolVersion))); reasonsForNotFalseStarting |= 1; @@ -935,7 +935,7 @@ CanFalseStartCallback(PRFileDesc* fd, void* client_data, PRBool *canFalseStart) // See bug 952863 for why ECDHE is allowed, but DHE (and RSA) are not. if (channelInfo.keaType != ssl_kea_ecdh) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("CanFalseStartCallback [%p] failed - " + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("CanFalseStartCallback [%p] failed - " "unsupported KEA %d\n", fd, static_cast(channelInfo.keaType))); reasonsForNotFalseStarting |= 2; @@ -945,7 +945,7 @@ CanFalseStartCallback(PRFileDesc* fd, void* client_data, PRBool *canFalseStart) // mode due to BEAST, POODLE, and other attacks on the MAC-then-Encrypt // design. See bug 1109766 for more details. if (cipherInfo.macAlgorithm != ssl_mac_aead) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("CanFalseStartCallback [%p] failed - non-AEAD cipher used, %d, " "is not supported with False Start.\n", fd, static_cast(cipherInfo.symCipher))); @@ -964,7 +964,7 @@ CanFalseStartCallback(PRFileDesc* fd, void* client_data, PRBool *canFalseStart) nsAutoCString negotiatedNPN; if (NS_FAILED(infoObject->GetNegotiatedNPN(negotiatedNPN)) || !negotiatedNPN.Length()) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("CanFalseStartCallback [%p] failed - " + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("CanFalseStartCallback [%p] failed - " "NPN cannot be verified\n", fd)); reasonsForNotFalseStarting |= 8; } @@ -974,7 +974,7 @@ CanFalseStartCallback(PRFileDesc* fd, void* client_data, PRBool *canFalseStart) *canFalseStart = PR_TRUE; infoObject->SetFalseStarted(); infoObject->NoteTimeUntilReady(); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("CanFalseStartCallback [%p] ok\n", fd)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("CanFalseStartCallback [%p] ok\n", fd)); } return SECSuccess; @@ -996,7 +996,7 @@ void HandshakeCallback(PRFileDesc* fd, void* client_data) { SSLVersionRange versions(infoObject->GetTLSVersionRange()); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] HandshakeCallback: succeeded using TLS version range (0x%04x,0x%04x)\n", fd, static_cast(versions.min), static_cast(versions.max))); @@ -1086,12 +1086,12 @@ void HandshakeCallback(PRFileDesc* fd, void* client_data) { status); if (status->HasServerCert()) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("HandshakeCallback KEEPING existing cert\n")); } else { ScopedCERTCertificate serverCert(SSL_PeerCertificate(fd)); RefPtr nssc(nsNSSCertificate::Create(serverCert.get())); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("HandshakeCallback using NEW cert %p\n", nssc.get())); status->SetServerCert(nssc, nsNSSCertificate::ev_status_unknown); } diff --git a/security/manager/ssl/nsNSSCertificate.cpp b/security/manager/ssl/nsNSSCertificate.cpp index bf3bc35f56..f08ed8e3a7 100644 --- a/security/manager/ssl/nsNSSCertificate.cpp +++ b/security/manager/ssl/nsNSSCertificate.cpp @@ -820,7 +820,7 @@ nsNSSCertificate::GetChain(nsIArray** _rvChain) NS_ENSURE_ARG(_rvChain); nsresult rv; - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Getting chain for \"%s\"\n", mCert->nickname)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Getting chain for \"%s\"\n", mCert->nickname)); mozilla::pkix::Time now(mozilla::pkix::Now()); @@ -854,7 +854,7 @@ nsNSSCertificate::GetChain(nsIArray** _rvChain) if ((usage & otherUsagesToTest) == 0) { continue; } - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("pipnss: PKIX attempting chain(%d) for '%s'\n", usage, mCert->nickname)); if (certVerifier->VerifyCert(mCert.get(), usage, now, @@ -872,7 +872,7 @@ nsNSSCertificate::GetChain(nsIArray** _rvChain) // There is not verified path for the chain, howeever we still want to // present to the user as much of a possible chain as possible, in the case // where there was a problem with the cert or the issuers. - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("pipnss: getchain :CertVerify failed to get chain for '%s'\n", mCert->nickname)); nssChain = CERT_GetCertChainFromCert(mCert.get(), PR_Now(), @@ -893,7 +893,7 @@ nsNSSCertificate::GetChain(nsIArray** _rvChain) for (node = CERT_LIST_HEAD(nssChain.get()); !CERT_LIST_END(node, nssChain.get()); node = CERT_LIST_NEXT(node)) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("adding %s to chain\n", node->cert->nickname)); nsCOMPtr cert = nsNSSCertificate::Create(node->cert); array->AppendElement(cert, false); @@ -919,7 +919,7 @@ nsNSSCertificate::GetAllTokenNames(uint32_t* aLength, char16_t*** aTokenNames) // Get the slots from NSS ScopedPK11SlotList slots; - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Getting slots for \"%s\"\n", mCert->nickname)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Getting slots for \"%s\"\n", mCert->nickname)); slots = PK11_GetAllSlotsForCert(mCert.get(), nullptr); if (!slots) { if (PORT_GetError() == SEC_ERROR_NO_TOKEN) @@ -1146,7 +1146,7 @@ nsNSSCertificate::ExportAsCMS(uint32_t chainMode, ScopedNSSCMSMessage cmsg(NSS_CMSMessage_Create(nullptr)); if (!cmsg) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSCertificate::ExportAsCMS - can't create CMS message\n")); return NS_ERROR_OUT_OF_MEMORY; } @@ -1155,7 +1155,7 @@ nsNSSCertificate::ExportAsCMS(uint32_t chainMode, ScopedNSSCMSSignedData sigd( NSS_CMSSignedData_CreateCertsOnly(cmsg, mCert.get(), false)); if (!sigd) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSCertificate::ExportAsCMS - can't create SignedData\n")); return NS_ERROR_FAILURE; } @@ -1181,7 +1181,7 @@ nsNSSCertificate::ExportAsCMS(uint32_t chainMode, certChain.forget(); } else { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSCertificate::ExportAsCMS - can't add chain\n")); return NS_ERROR_FAILURE; } @@ -1193,7 +1193,7 @@ nsNSSCertificate::ExportAsCMS(uint32_t chainMode, issuerCert.forget(); } else { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSCertificate::ExportAsCMS - can't add issuer cert\n")); return NS_ERROR_FAILURE; } @@ -1207,14 +1207,14 @@ nsNSSCertificate::ExportAsCMS(uint32_t chainMode, sigd.forget(); } else { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSCertificate::ExportAsCMS - can't attach SignedData\n")); return NS_ERROR_FAILURE; } ScopedPLArenaPool arena(PORT_NewArena(1024)); if (!arena) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSCertificate::ExportAsCMS - out of memory\n")); return NS_ERROR_OUT_OF_MEMORY; } @@ -1225,13 +1225,13 @@ nsNSSCertificate::ExportAsCMS(uint32_t chainMode, nullptr, nullptr, nullptr, nullptr, nullptr); if (!ecx) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSCertificate::ExportAsCMS - can't create encoder context\n")); return NS_ERROR_FAILURE; } if (NSS_CMSEncoder_Finish(ecx) != SECSuccess) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSCertificate::ExportAsCMS - failed to add encoded data\n")); return NS_ERROR_FAILURE; } diff --git a/security/manager/ssl/nsNSSCertificateDB.cpp b/security/manager/ssl/nsNSSCertificateDB.cpp index 4f112755c0..01a902494e 100644 --- a/security/manager/ssl/nsNSSCertificateDB.cpp +++ b/security/manager/ssl/nsNSSCertificateDB.cpp @@ -106,13 +106,13 @@ nsNSSCertificateDB::FindCertByNickname(nsISupports *aToken, char *asciiname = nullptr; NS_ConvertUTF16toUTF8 aUtf8Nickname(nickname); asciiname = const_cast(aUtf8Nickname.get()); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Getting \"%s\"\n", asciiname)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Getting \"%s\"\n", asciiname)); cert = PK11_FindCertFromNickname(asciiname, nullptr); if (!cert) { cert = CERT_FindCertByNickname(CERT_GetDefaultCertDB(), asciiname); } if (cert) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("got it\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("got it\n")); nsCOMPtr pCert = nsNSSCertificate::Create(cert.get()); if (pCert) { pCert.forget(_rvCert); @@ -345,7 +345,7 @@ nsNSSCertificateDB::handleCACertDownload(nsIArray *x509Certs, if (NS_FAILED(rv)) return rv; - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Creating temp cert\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Creating temp cert\n")); CERTCertDBHandle *certdb = CERT_GetDefaultCertDB(); ScopedCERTCertificate tmpCert(CERT_FindCertByDERCert(certdb, &der)); if (!tmpCert) { @@ -380,11 +380,11 @@ nsNSSCertificateDB::handleCACertDownload(nsIArray *x509Certs, if (!allows) return NS_ERROR_NOT_AVAILABLE; - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("trust is %d\n", trustBits)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("trust is %d\n", trustBits)); nsXPIDLCString nickname; nickname.Adopt(CERT_MakeCANickname(tmpCert.get())); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Created nick \"%s\"\n", nickname.get())); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Created nick \"%s\"\n", nickname.get())); nsNSSCertTrust trust; trust.SetValidCA(); @@ -966,7 +966,7 @@ nsNSSCertificateDB::DeleteCertificate(nsIX509Cert *aCert) srv = CERT_ChangeCertTrust(CERT_GetDefaultCertDB(), cert.get(), trust.GetTrust()); } - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("cert deleted: %d", srv)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("cert deleted: %d", srv)); return (srv) ? NS_ERROR_FAILURE : NS_OK; } @@ -1220,7 +1220,7 @@ nsNSSCertificateDB::getCertNames(CERTCertList *certList, uint32_t numcerts = 0, i=0; char16_t **tmpArray = nullptr; - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("List of certs %d:\n", type)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("List of certs %d:\n", type)); for (node = CERT_LIST_HEAD(certList); !CERT_LIST_END(node, certList); node = CERT_LIST_NEXT(node)) { @@ -1228,7 +1228,7 @@ nsNSSCertificateDB::getCertNames(CERTCertList *certList, numcerts++; } } - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("num certs: %d\n", numcerts)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("num certs: %d\n", numcerts)); int nc = (numcerts == 0) ? 1 : numcerts; tmpArray = (char16_t **)moz_xmalloc(sizeof(char16_t *) * nc); if (numcerts == 0) goto finish; @@ -1611,7 +1611,7 @@ NS_IMETHODIMP nsNSSCertificateDB::AddCertFromBase64(const char* aBase64, rv = newCert->GetRawDER(&der.len, (uint8_t **)&der.data); NS_ENSURE_SUCCESS(rv, rv); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Creating temp cert\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Creating temp cert\n")); CERTCertDBHandle *certdb = CERT_GetDefaultCertDB(); ScopedCERTCertificate tmpCert(CERT_FindCertByDERCert(certdb, &der)); if (!tmpCert) @@ -1635,7 +1635,7 @@ NS_IMETHODIMP nsNSSCertificateDB::AddCertFromBase64(const char* aBase64, nsXPIDLCString nickname; nickname.Adopt(CERT_MakeCANickname(tmpCert.get())); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Created nick \"%s\"\n", nickname.get())); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Created nick \"%s\"\n", nickname.get())); rv = attemptToLogInWithDefaultPassword(); if (NS_WARN_IF(rv != NS_OK)) { diff --git a/security/manager/ssl/nsNSSComponent.cpp b/security/manager/ssl/nsNSSComponent.cpp index 97f45ae85f..4041e72ec7 100644 --- a/security/manager/ssl/nsNSSComponent.cpp +++ b/security/manager/ssl/nsNSSComponent.cpp @@ -217,7 +217,7 @@ nsNSSComponent::nsNSSComponent() { if (!gPIPNSSLog) gPIPNSSLog = PR_NewLogModule("pipnss"); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsNSSComponent::ctor\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent::ctor\n")); mObserversRegistered = false; NS_ASSERTION( (0 == mInstanceCount), "nsNSSComponent is a singleton, but instantiated multiple times!"); @@ -255,7 +255,7 @@ nsNSSComponent::createBackgroundThreads() nsNSSComponent::~nsNSSComponent() { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsNSSComponent::dtor\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent::dtor\n")); deleteBackgroundThreads(); @@ -271,7 +271,7 @@ nsNSSComponent::~nsNSSComponent() // potential nss initialization later. EnsureNSSInitialized(nssShutdown); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsNSSComponent::dtor finished\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent::dtor finished\n")); } NS_IMETHODIMP @@ -361,7 +361,7 @@ nsNSSComponent::LaunchSmartCardThreads() SECMODModuleList* list; SECMODListLock* lock = SECMOD_GetDefaultModuleListLock(); if (!lock) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("Couldn't get the module list lock, can't launch smart card threads\n")); return; } @@ -429,7 +429,7 @@ nsNSSComponent::LoadLoadableRoots() SECMODModuleList* list; SECMODListLock* lock = SECMOD_GetDefaultModuleListLock(); if (!lock) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("Couldn't get the module list lock, can't install loadable roots\n")); return; } @@ -959,7 +959,7 @@ GetNSSProfilePath(nsAutoCString& aProfilePath) aProfilePath.Truncate(); const char* dbDirOverride = getenv("MOZPSM_NSSDBDIR_OVERRIDE"); if (dbDirOverride && strlen(dbDirOverride) > 0) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Using specified MOZPSM_NSSDBDIR_OVERRIDE as NSS DB dir: %s\n", dbDirOverride)); aProfilePath.Assign(dbDirOverride); @@ -970,7 +970,7 @@ GetNSSProfilePath(nsAutoCString& aProfilePath) nsresult rv = NS_GetSpecialDirectory(NS_APP_USER_PROFILE_50_DIR, getter_AddRefs(profileFile)); if (NS_FAILED(rv)) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("Unable to get profile directory - continuing with no NSS DB\n")); return NS_OK; } @@ -980,7 +980,7 @@ GetNSSProfilePath(nsAutoCString& aProfilePath) // codepage, using short (canonical) path as workaround. nsCOMPtr profileFileWin(do_QueryInterface(profileFile)); if (!profileFileWin) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("Could not get nsILocalFileWin for profile directory.\n")); return NS_ERROR_FAILURE; } @@ -989,7 +989,7 @@ GetNSSProfilePath(nsAutoCString& aProfilePath) rv = profileFile->GetNativePath(aProfilePath); #endif if (NS_FAILED(rv)) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("Could not get native path for profile directory.\n")); return rv; } @@ -1003,7 +1003,7 @@ nsNSSComponent::InitializeNSS() // Can be called both during init and profile change. // Needs mutex protection. - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsNSSComponent::InitializeNSS\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent::InitializeNSS\n")); static_assert(nsINSSErrorsService::NSS_SEC_ERROR_BASE == SEC_ERROR_BASE && nsINSSErrorsService::NSS_SEC_ERROR_LIMIT == SEC_ERROR_LIMIT && @@ -1020,7 +1020,7 @@ nsNSSComponent::InitializeNSS() return NS_ERROR_FAILURE; } - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("NSS Initialization beginning\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("NSS Initialization beginning\n")); // The call to ConfigureInternalPKCS11Token needs to be done before NSS is initialized, // but affects only static data. @@ -1043,11 +1043,11 @@ nsNSSComponent::InitializeNSS() SECStatus init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), false); // If that fails, attempt read-only mode. if (init_rv != SECSuccess) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("could not init NSS r/w in %s\n", profileStr.get())); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("could not init NSS r/w in %s\n", profileStr.get())); init_rv = ::mozilla::psm::InitializeNSS(profileStr.get(), true); } if (init_rv != SECSuccess) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("could not init in r/o either\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("could not init in r/o either\n")); } } // If we haven't succeeded in initializing the DB in our profile @@ -1057,7 +1057,7 @@ nsNSSComponent::InitializeNSS() init_rv = NSS_NoDB_Init(nullptr); } if (init_rv != SECSuccess) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("could not initialize NSS - panicking\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("could not initialize NSS - panicking\n")); nsPSMInitPanic::SetPanic(); return NS_ERROR_NOT_AVAILABLE; } @@ -1114,7 +1114,7 @@ nsNSSComponent::InitializeNSS() ENABLED_0RTT_DATA_DEFAULT)); if (NS_FAILED(InitializeCipherSuite())) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("Unable to initialize cipher suite settings\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("Unable to initialize cipher suite settings\n")); return NS_ERROR_FAILURE; } @@ -1139,12 +1139,12 @@ nsNSSComponent::InitializeNSS() nsCOMPtr sssService = do_GetService(NS_SSSERVICE_CONTRACTID); if (!sssService) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Cannot initialize site security service\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Cannot initialize site security service\n")); return NS_ERROR_FAILURE; } - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("NSS Initialization done\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("NSS Initialization done\n")); return NS_OK; } @@ -1154,7 +1154,7 @@ nsNSSComponent::ShutdownNSS() // Can be called both during init and profile change, // needs mutex protection. - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsNSSComponent::ShutdownNSS\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent::ShutdownNSS\n")); MutexAutoLock lock(mutex); @@ -1165,7 +1165,7 @@ nsNSSComponent::ShutdownNSS() Preferences::RemoveObserver(this, "security."); if (NS_FAILED(CipherSuiteChangeObserver::StopObserve())) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("nsNSSComponent::ShutdownNSS cannot stop observing cipher suite change\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("nsNSSComponent::ShutdownNSS cannot stop observing cipher suite change\n")); } #ifndef MOZ_NO_SMART_CARDS @@ -1176,14 +1176,14 @@ nsNSSComponent::ShutdownNSS() #ifndef MOZ_NO_EV_CERTS CleanupIdentityInfo(); #endif - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("evaporating psm resources\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("evaporating psm resources\n")); mShutdownObjectList->evaporateAllNSSResources(); EnsureNSSInitialized(nssShutdown); if (SECSuccess != ::NSS_Shutdown()) { - PR_LOG(gPIPNSSLog, PR_LOG_ALWAYS, ("NSS SHUTDOWN FAILURE\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("NSS SHUTDOWN FAILURE\n")); } else { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("NSS shutdown =====>> OK <<=====\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("NSS shutdown =====>> OK <<=====\n")); } } } @@ -1196,17 +1196,17 @@ nsNSSComponent::Init() nsresult rv = NS_OK; - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Beginning NSS initialization\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Beginning NSS initialization\n")); if (!mShutdownObjectList) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("NSS init, out of memory in constructor\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("NSS init, out of memory in constructor\n")); return NS_ERROR_OUT_OF_MEMORY; } rv = InitializePIPNSSBundle(); if (NS_FAILED(rv)) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("Unable to create pipnss bundle.\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("Unable to create pipnss bundle.\n")); return rv; } @@ -1228,7 +1228,7 @@ nsNSSComponent::Init() rv = InitializeNSS(); if (NS_FAILED(rv)) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("Unable to Initialize NSS.\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("Unable to Initialize NSS.\n")); DeregisterObservers(); mPIPNSSBundle = nullptr; @@ -1240,7 +1240,7 @@ nsNSSComponent::Init() createBackgroundThreads(); if (!mCertVerificationThread) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("NSS init, could not create threads\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("NSS init, could not create threads\n")); DeregisterObservers(); mPIPNSSBundle = nullptr; @@ -1303,11 +1303,11 @@ nsNSSComponent::Observe(nsISupports* aSubject, const char* aTopic, const char16_t* someData) { if (nsCRT::strcmp(aTopic, PROFILE_CHANGE_TEARDOWN_TOPIC) == 0) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("in PSM code, receiving change-teardown\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("in PSM code, receiving change-teardown\n")); DoProfileChangeTeardown(aSubject); } else if (nsCRT::strcmp(aTopic, PROFILE_BEFORE_CHANGE_TOPIC) == 0) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("receiving profile change topic\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("receiving profile change topic\n")); DoProfileBeforeChange(aSubject); } else if (nsCRT::strcmp(aTopic, PROFILE_DO_CHANGE_TOPIC) == 0) { @@ -1339,13 +1339,13 @@ nsNSSComponent::Observe(nsISupports* aSubject, const char* aTopic, if (needsInit) { if (NS_FAILED(InitializeNSS())) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("Unable to Initialize NSS after profile switch.\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("Unable to Initialize NSS after profile switch.\n")); } } } else if (nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID) == 0) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsNSSComponent: XPCom shutdown observed\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent: XPCom shutdown observed\n")); // Cleanup code that requires services, it's too late in destructor. @@ -1405,11 +1405,11 @@ nsNSSComponent::Observe(nsISupports* aSubject, const char* aTopic, SSL_ClearSessionCache(); } else if (nsCRT::strcmp(aTopic, PROFILE_CHANGE_NET_TEARDOWN_TOPIC) == 0) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("receiving network teardown topic\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("receiving network teardown topic\n")); DoProfileChangeNetTeardown(); } else if (nsCRT::strcmp(aTopic, PROFILE_CHANGE_NET_RESTORE_TOPIC) == 0) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("receiving network restore topic\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("receiving network restore topic\n")); DoProfileChangeNetRestore(); } @@ -1493,7 +1493,7 @@ nsNSSComponent::RegisterObservers() NS_ASSERTION(observerService, "could not get observer service"); if (observerService) { mObserversRegistered = true; - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsNSSComponent: adding observers\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent: adding observers\n")); // We are a service. // Once we are loaded, don't allow being removed from memory. @@ -1523,7 +1523,7 @@ nsNSSComponent::DeregisterObservers() NS_ASSERTION(observerService, "could not get observer service"); if (observerService) { mObserversRegistered = false; - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("nsNSSComponent: removing observers\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("nsNSSComponent: removing observers\n")); observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID); diff --git a/security/manager/ssl/nsNSSIOLayer.cpp b/security/manager/ssl/nsNSSIOLayer.cpp index 908ac364fa..2351799f25 100644 --- a/security/manager/ssl/nsNSSIOLayer.cpp +++ b/security/manager/ssl/nsNSSIOLayer.cpp @@ -243,7 +243,7 @@ nsNSSSocketInfo::NoteTimeUntilReady() mNotedTimeUntilReady = true; - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] nsNSSSocketInfo::NoteTimeUntilReady\n", mFd)); } @@ -262,7 +262,7 @@ nsNSSSocketInfo::SetHandshakeCompleted() mHandshakeCompleted = true; - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] nsNSSSocketInfo::SetHandshakeCompleted\n", (void*) mFd)); mIsFullHandshake = false; // reset for next handshake on this connection @@ -686,7 +686,7 @@ static PRStatus nsSSLIOLayerConnect(PRFileDesc* fd, const PRNetAddr* addr, PRIntervalTime timeout) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] connecting SSL socket\n", + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] connecting SSL socket\n", (void*) fd)); nsNSSShutDownPreventionLock locker; if (!getSocketInfoIfRunning(fd, not_reading_or_writing, locker)) @@ -694,12 +694,12 @@ nsSSLIOLayerConnect(PRFileDesc* fd, const PRNetAddr* addr, PRStatus status = fd->lower->methods->connect(fd->lower, addr, timeout); if (status != PR_SUCCESS) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, ("[%p] Lower layer connect error: %d\n", + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("[%p] Lower layer connect error: %d\n", (void*) fd, PR_GetError())); return status; } - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] Connect\n", (void*) fd)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] Connect\n", (void*) fd)); return status; } @@ -906,7 +906,7 @@ nsSSLIOLayerClose(PRFileDesc* fd) if (!fd) return PR_FAILURE; - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] Shutting down socket\n", + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] Shutting down socket\n", (void*) fd)); nsNSSSocketInfo* socketInfo = (nsNSSSocketInfo*) fd->secret; @@ -980,7 +980,7 @@ nsDumpBuffer(unsigned char* buf, int len) ch = buf[i]; if (l == DUMPBUF_LINESIZE) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("%s%s\n", hexbuf, chrbuf)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("%s%s\n", hexbuf, chrbuf)); (void) memset(hexbuf, 0x20, DUMPBUF_LINESIZE*3); (void) memset(chrbuf, 0x20, DUMPBUF_LINESIZE); h = hexbuf; @@ -1001,7 +1001,7 @@ nsDumpBuffer(unsigned char* buf, int len) } i++; l++; } - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("%s%s\n", hexbuf, chrbuf)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("%s%s\n", hexbuf, chrbuf)); } #define DEBUG_DUMP_BUFFER(buf,len) nsDumpBuffer(buf,len) @@ -1171,7 +1171,7 @@ checkHandshake(int32_t bytesTransfered, bool wasReading, } if (wantRetry) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] checkHandshake: will retry with lower max TLS version\n", ssl_layer_fd)); // We want to cause the network layer to retry the connection. @@ -1222,7 +1222,7 @@ nsSSLIOLayerPoll(PRFileDesc* fd, int16_t in_flags, int16_t* out_flags) if (!socketInfo) { // If we get here, it is probably because certificate validation failed // and this is the first I/O operation after the failure. - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] polling SSL socket right after certificate verification failed " "or NSS shutdown or SDR logout %d\n", fd, (int) in_flags)); @@ -1236,7 +1236,7 @@ nsSSLIOLayerPoll(PRFileDesc* fd, int16_t in_flags, int16_t* out_flags) return in_flags; } - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, (socketInfo->IsWaitingForCertVerification() ? "[%p] polling SSL socket during certificate verification using lower %d\n" : "[%p] poll SSL socket using lower %d\n", @@ -1247,7 +1247,7 @@ nsSSLIOLayerPoll(PRFileDesc* fd, int16_t in_flags, int16_t* out_flags) // it reaches any point that would be unsafe to send/receive something before // cert validation is complete. int16_t result = fd->lower->methods->poll(fd->lower, in_flags, out_flags); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] poll SSL socket returned %d\n", + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] poll SSL socket returned %d\n", (void*) fd, (int) result)); return result; } @@ -1353,7 +1353,7 @@ PSMRecv(PRFileDesc* fd, void* buf, int32_t amount, int flags, int32_t bytesRead = fd->lower->methods->recv(fd->lower, buf, amount, flags, timeout); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] read %d bytes\n", (void*) fd, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] read %d bytes\n", (void*) fd, bytesRead)); #ifdef DEBUG_SSL_VERBOSE @@ -1384,7 +1384,7 @@ PSMSend(PRFileDesc* fd, const void* buf, int32_t amount, int flags, int32_t bytesWritten = fd->lower->methods->send(fd->lower, buf, amount, flags, timeout); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] wrote %d bytes\n", + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] wrote %d bytes\n", fd, bytesWritten)); return checkHandshake(bytesWritten, false, fd, socketInfo); @@ -1973,7 +1973,7 @@ nsNSS_SSLGetClientAuthData(void* arg, PRFileDesc* socket, // joined on this connection, because we only show the user one hostname // (mHostName) in the client certificate UI. - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] Not returning client cert due to previous join\n", socket)); *pRetCert = nullptr; *pRetKey = nullptr; @@ -2406,7 +2406,7 @@ nsSSLIOLayerImportFD(PRFileDesc* fd, infoObject); } if (flags & nsISocketProvider::MITM_OK) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] nsSSLIOLayerImportFD: bypass authentication flag\n", fd)); infoObject->SetBypassAuthentication(true); } @@ -2457,7 +2457,7 @@ nsSSLIOLayerSetOptions(PRFileDesc* fd, bool forSTARTTLS, // Set TLS 1.3 compat mode. if (SECSuccess != SSL_OptionSet(fd, SSL_ENABLE_TLS13_COMPAT_MODE, PR_TRUE)) { - PR_LOG(gPIPNSSLog, PR_LOG_ERROR, + MOZ_LOG(gPIPNSSLog, LogLevel::Error, ("[%p] nsSSLIOLayerSetOptions: Setting compat mode failed\n", fd)); } @@ -2466,7 +2466,7 @@ nsSSLIOLayerSetOptions(PRFileDesc* fd, bool forSTARTTLS, infoObject->SharedState().IOLayerHelpers() .adjustForTLSIntolerance(infoObject->GetHostName(), infoObject->GetPort(), range, strongCiphersStatus); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] nsSSLIOLayerSetOptions: using TLS version range (0x%04x,0x%04x)%s\n", fd, static_cast(range.min), static_cast(range.max), @@ -2484,7 +2484,7 @@ nsSSLIOLayerSetOptions(PRFileDesc* fd, bool forSTARTTLS, // when adjustForTLSIntolerance tweaks the maximum version downward, // we tell the server using this SCSV so they can detect a downgrade attack if (range.max < maxEnabledVersion) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] nsSSLIOLayerSetOptions: enabling TLS_FALLBACK_SCSV\n", fd)); // Some servers will choke if we send the fallback SCSV with TLS 1.2. if (range.max < SSL_LIBRARY_VERSION_TLS_1_2) { @@ -2601,7 +2601,7 @@ nsSSLIOLayerAddToSocket(int32_t family, nsNSSShutDownList::trackSSLSocketCreate(); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("[%p] Socket set up\n", (void*) sslSock)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("[%p] Socket set up\n", (void*) sslSock)); infoObject->QueryInterface(NS_GET_IID(nsISupports), (void**) (info)); // We are going use a clear connection first // diff --git a/security/manager/ssl/nsNSSShutDown.cpp b/security/manager/ssl/nsNSSShutDown.cpp index 290cd0b8b8..d1fd24aecc 100644 --- a/security/manager/ssl/nsNSSShutDown.cpp +++ b/security/manager/ssl/nsNSSShutDown.cpp @@ -126,7 +126,7 @@ bool nsNSSShutDownList::areSSLSocketsActive() nsresult nsNSSShutDownList::doPK11Logout() { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("canceling all open SSL sockets to disallow future IO\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("canceling all open SSL sockets to disallow future IO\n")); // During our iteration we will set a bunch of PRBools to true. // Nobody else ever modifies that bool, only we do. // We only must ensure that our objects do not go away. @@ -166,11 +166,11 @@ void nsNSSShutDownList::allowUI() nsresult nsNSSShutDownList::evaporateAllNSSResources() { if (PR_SUCCESS != mActivityState.restrictActivityToCurrentThread()) { - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("failed to restrict activity to current thread\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("failed to restrict activity to current thread\n")); return NS_ERROR_FAILURE; } - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("now evaporating NSS resources\n")); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("now evaporating NSS resources\n")); // Never free more than one entry, because other threads might be calling // us and remove themselves while we are iterating over the list, diff --git a/security/manager/ssl/nsNTLMAuthModule.cpp b/security/manager/ssl/nsNTLMAuthModule.cpp index 5e24f2594e..0a16a5bf48 100644 --- a/security/manager/ssl/nsNTLMAuthModule.cpp +++ b/security/manager/ssl/nsNTLMAuthModule.cpp @@ -37,8 +37,8 @@ GetNTLMLog() return sNTLMLog; } -#define LOG(x) PR_LOG(GetNTLMLog(), PR_LOG_DEBUG, x) -#define LOG_ENABLED() PR_LOG_TEST(GetNTLMLog(), PR_LOG_DEBUG) +#define LOG(x) MOZ_LOG(GetNTLMLog(), mozilla::LogLevel::Debug, x) +#define LOG_ENABLED() MOZ_LOG_TEST(GetNTLMLog(), mozilla::LogLevel::Debug) static void des_makekey(const uint8_t *raw, uint8_t *key); static void des_encrypt(const uint8_t *key, const uint8_t *src, uint8_t *hash); diff --git a/security/manager/ssl/nsPKCS11Slot.cpp b/security/manager/ssl/nsPKCS11Slot.cpp index f9b53147bc..c2aac0ecb0 100644 --- a/security/manager/ssl/nsPKCS11Slot.cpp +++ b/security/manager/ssl/nsPKCS11Slot.cpp @@ -13,6 +13,10 @@ #include "secmod.h" +#include "mozilla/Logging.h" + +using mozilla::LogLevel; + extern PRLogModuleInfo* gPIPNSSLog; NS_IMPL_ISUPPORTS(nsPKCS11Slot, nsIPKCS11Slot) @@ -294,7 +298,7 @@ nsPKCS11Module::FindSlotByName(const char16_t *aName, return NS_ERROR_NOT_AVAILABLE; char *asciiname = ToNewUTF8String(nsDependentString(aName)); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("Getting \"%s\"\n", asciiname)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("Getting \"%s\"\n", asciiname)); PK11SlotInfo *slotinfo = nullptr; PK11SlotList *slotList = PK11_FindSlotsByNames(mModule->dllName, asciiname /* slotName */, nullptr /* token Name */, false); diff --git a/security/manager/ssl/nsPKCS12Blob.cpp b/security/manager/ssl/nsPKCS12Blob.cpp index 0ce8beeb1c..4433c878da 100644 --- a/security/manager/ssl/nsPKCS12Blob.cpp +++ b/security/manager/ssl/nsPKCS12Blob.cpp @@ -726,8 +726,8 @@ nsPKCS12Blob::handleError(int myerr) } int prerr = PORT_GetError(); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("PKCS12: NSS/NSPR error(%d)", prerr)); - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, ("PKCS12: I called(%d)", myerr)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("PKCS12: NSS/NSPR error(%d)", prerr)); + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("PKCS12: I called(%d)", myerr)); const char * msgID = nullptr; diff --git a/security/manager/ssl/nsSecureBrowserUIImpl.cpp b/security/manager/ssl/nsSecureBrowserUIImpl.cpp index 02b5758918..bfeca26293 100644 --- a/security/manager/ssl/nsSecureBrowserUIImpl.cpp +++ b/security/manager/ssl/nsSecureBrowserUIImpl.cpp @@ -44,7 +44,7 @@ using namespace mozilla; // set NSPR_LOG_MODULES=nsSecureBrowserUI:5 // set NSPR_LOG_FILE=nspr.log // -// this enables PR_LOG_DEBUG level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file nspr.log // PRLogModuleInfo* gSecureDocLog = nullptr; @@ -128,10 +128,10 @@ NS_IMPL_ISUPPORTS(nsSecureBrowserUIImpl, NS_IMETHODIMP nsSecureBrowserUIImpl::Init(nsIDOMWindow *aWindow) { - if (PR_LOG_TEST(gSecureDocLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gSecureDocLog, LogLevel::Debug)) { nsCOMPtr window(do_QueryReferent(mWindow)); - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: Init: mWindow: %p, aWindow: %p\n", this, window.get(), aWindow)); } @@ -310,16 +310,16 @@ static uint32_t GetSecurityStateFromSecurityInfoAndRequest(nsISupports* info, nsCOMPtr psmInfo(do_QueryInterface(info)); if (!psmInfo) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI: GetSecurityState: - no nsITransportSecurityInfo for %p\n", + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI: GetSecurityState: - no nsITransportSecurityInfo for %p\n", (nsISupports *)info)); return nsIWebProgressListener::STATE_IS_INSECURE; } - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI: GetSecurityState: - info is %p\n", + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI: GetSecurityState: - info is %p\n", (nsISupports *)info)); res = psmInfo->GetSecurityState(&securityState); if (NS_FAILED(res)) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI: GetSecurityState: - GetSecurityState failed: %d\n", + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI: GetSecurityState: - GetSecurityState failed: %d\n", res)); securityState = nsIWebProgressListener::STATE_IS_BROKEN; } @@ -342,14 +342,14 @@ static uint32_t GetSecurityStateFromSecurityInfoAndRequest(nsISupports* info, bool isHttp, isFtp; if ((NS_SUCCEEDED(uri->SchemeIs("http", &isHttp)) && isHttp) || (NS_SUCCEEDED(uri->SchemeIs("ftp", &isFtp)) && isFtp)) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI: GetSecurityState: - " + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI: GetSecurityState: - " "channel scheme is insecure.\n")); securityState = nsIWebProgressListener::STATE_IS_INSECURE; } } } - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI: GetSecurityState: - Returning %d\n", + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI: GetSecurityState: - Returning %d\n", securityState)); return securityState; } @@ -395,7 +395,7 @@ nsSecureBrowserUIImpl::EvaluateAndUpdateSecurityState(nsIRequest* aRequest, temp_NewToplevelSecurityState = GetSecurityStateFromSecurityInfoAndRequest(info, aRequest); - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: remember mNewToplevelSecurityState => %x\n", this, temp_NewToplevelSecurityState)); @@ -423,7 +423,7 @@ nsSecureBrowserUIImpl::EvaluateAndUpdateSecurityState(nsIRequest* aRequest, if (updateStatus) { mSSLStatus = temp_SSLStatus; } - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: remember securityInfo %p\n", this, info)); nsCOMPtr associatedContentSecurityFromRequest = @@ -457,11 +457,11 @@ nsSecureBrowserUIImpl::UpdateSubrequestMembers(nsISupports* securityInfo, if (reqState & STATE_IS_SECURE) { // do nothing } else if (reqState & STATE_IS_BROKEN) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: subreq BROKEN\n", this)); ++mSubRequestsBrokenSecurity; } else { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: subreq INSECURE\n", this)); ++mSubRequestsNoSecurity; } @@ -608,22 +608,22 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, { if (isToplevelProgress) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: progress: for toplevel\n", this)); } else { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: progress: for something else\n", this)); } } else { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: progress: no window known\n", this)); } - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange\n", this)); if (isViewSource) @@ -631,15 +631,15 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, if (!aRequest) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange with null request\n", this)); return NS_ERROR_NULL_POINTER; } - if (PR_LOG_TEST(gSecureDocLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gSecureDocLog, LogLevel::Debug)) { nsXPIDLCString reqname; aRequest->GetName(reqname); - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: %p %p OnStateChange %x %s\n", this, aWebProgress, aRequest, aProgressStateFlags, reqname.get())); } @@ -679,7 +679,7 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, && loadFlags & nsIChannel::LOAD_DOCUMENT_URI) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: SOMETHING STARTS FOR TOPMOST DOCUMENT\n", this)); } @@ -691,7 +691,7 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, && loadFlags & nsIChannel::LOAD_DOCUMENT_URI) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: SOMETHING STOPS FOR TOPMOST DOCUMENT\n", this)); } @@ -707,7 +707,7 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, if (!wyciwygRequest) { nsCOMPtr ftpRequest(do_QueryInterface(aRequest)); if (!ftpRequest) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: not relevant for sub content\n", this)); isSubDocumentRelevant = false; } @@ -829,7 +829,7 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, info.AppendLiteral("f contains unknown flag!"); } - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: %s %s -- %s\n", this, _status, info.get(), info2.get())); @@ -837,7 +837,7 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, && channel) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: seeing STOP with security state: %d\n", this, GetSecurityStateFromSecurityInfoAndRequest(securityInfo, aRequest) )); @@ -928,13 +928,13 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, if (allowSecurityStateChange && !inProgress) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: start for toplevel document\n", this )); if (prevContentSecurity) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: start, saving current sub state\n", this )); @@ -943,7 +943,7 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, prevContentSecurity->SetCountSubRequestsBrokenSecurity(saveSubBroken); prevContentSecurity->SetCountSubRequestsNoSecurity(saveSubNo); prevContentSecurity->Flush(); - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI:%p: Saving subs in START to %p as %d,%d\n", + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: Saving subs in START to %p as %d,%d\n", this, prevContentSecurity.get(), saveSubBroken, saveSubNo)); } @@ -970,13 +970,13 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, if (newContentSecurity) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: start, loading old sub state\n", this )); newContentSecurity->GetCountSubRequestsBrokenSecurity(&newSubBroken); newContentSecurity->GetCountSubRequestsNoSecurity(&newSubNo); - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI:%p: Restoring subs in START from %p to %d,%d\n", + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: Restoring subs in START from %p to %d,%d\n", this, newContentSecurity.get(), newSubBroken, newSubNo)); } } @@ -1005,7 +1005,7 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, // By using a counter, this code also works when the toplevel // document get's redirected, but the STOP request for the // previous toplevel document has not yet have been received. - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: ++mDocumentRequestsInProgress\n", this )); ++mDocumentRequestsInProgress; @@ -1041,7 +1041,7 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, return NS_OK; } - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnStateChange: --mDocumentRequestsInProgress\n", this )); @@ -1111,7 +1111,7 @@ nsSecureBrowserUIImpl::OnStateChange(nsIWebProgress* aWebProgress, { currentContentSecurity->GetCountSubRequestsBrokenSecurity(&subBroken); currentContentSecurity->GetCountSubRequestsNoSecurity(&subNo); - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, ("SecureUI:%p: Restoring subs in STOP from %p to %d,%d\n", + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: Restoring subs in STOP from %p to %d,%d\n", this, currentContentSecurity.get(), subBroken, subNo)); } @@ -1195,7 +1195,7 @@ nsSecureBrowserUIImpl::UpdateSecurityState(nsIRequest* aRequest, newSecurityState = lis_broken_security; } - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: UpdateSecurityState: old-new %d - %d\n", this, mNotifiedSecurityState, newSecurityState)); @@ -1233,13 +1233,13 @@ nsSecureBrowserUIImpl::TellTheWorld(nsIRequest* aRequest) } if (toplevelEventSink) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: UpdateSecurityState: calling OnSecurityChange\n", this)); toplevelEventSink->OnSecurityChange(aRequest, state); } else { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: UpdateSecurityState: NO mToplevelEventSink!\n", this)); @@ -1257,7 +1257,7 @@ nsSecureBrowserUIImpl::OnLocationChange(nsIWebProgress* aWebProgress, NS_ASSERTION(mOnStateLocationChangeReentranceDetection == 1, "unexpected parallel nsIWebProgress OnStateChange and/or OnLocationChange notification"); #endif - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnLocationChange\n", this)); bool updateIsViewSource = false; @@ -1272,7 +1272,7 @@ nsSecureBrowserUIImpl::OnLocationChange(nsIWebProgress* aWebProgress, NS_ENSURE_SUCCESS(rv, rv); if (vs) { - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnLocationChange: view-source\n", this)); } @@ -1369,7 +1369,7 @@ nsSecureBrowserUIImpl::OnSecurityChange(nsIWebProgress *aWebProgress, if (aURI) { nsAutoCString temp; aURI->GetSpec(temp); - PR_LOG(gSecureDocLog, PR_LOG_DEBUG, + MOZ_LOG(gSecureDocLog, LogLevel::Debug, ("SecureUI:%p: OnSecurityChange: (%x) %s\n", this, state, temp.get())); } diff --git a/security/manager/ssl/nsSecurityHeaderParser.cpp b/security/manager/ssl/nsSecurityHeaderParser.cpp index 514742bf2e..7fc7e16d98 100644 --- a/security/manager/ssl/nsSecurityHeaderParser.cpp +++ b/security/manager/ssl/nsSecurityHeaderParser.cpp @@ -56,7 +56,7 @@ GetSHParserLog() return sSHParserLog; } -#define SHPARSERLOG(args) PR_LOG(GetSHParserLog(), PR_LOG_DEBUG, args) +#define SHPARSERLOG(args) MOZ_LOG(GetSHParserLog(), mozilla::LogLevel::Debug, args) nsSecurityHeaderParser::nsSecurityHeaderParser(const char *aHeader) : mCursor(aHeader) diff --git a/security/manager/ssl/nsSiteSecurityService.cpp b/security/manager/ssl/nsSiteSecurityService.cpp index 8079bb482b..602ddd269f 100644 --- a/security/manager/ssl/nsSiteSecurityService.cpp +++ b/security/manager/ssl/nsSiteSecurityService.cpp @@ -49,7 +49,7 @@ GetSSSLog() return gSSSLog; } -#define SSSLOG(args) PR_LOG(GetSSSLog(), 4, args) +#define SSSLOG(args) MOZ_LOG(GetSSSLog(), mozilla::LogLevel::Debug, args) //////////////////////////////////////////////////////////////////////////////// diff --git a/security/manager/ssl/nsUsageArrayHelper.cpp b/security/manager/ssl/nsUsageArrayHelper.cpp index f35734fbca..dc598431b9 100644 --- a/security/manager/ssl/nsUsageArrayHelper.cpp +++ b/security/manager/ssl/nsUsageArrayHelper.cpp @@ -129,7 +129,7 @@ nsUsageArrayHelper::check(uint32_t previousCheckResult, result = previousCheckResult; } - PR_LOG(gPIPNSSLog, PR_LOG_DEBUG, + MOZ_LOG(gPIPNSSLog, LogLevel::Debug, ("error validating certificate for usage %s: %s (%d) -> %ud \n", typestr.get(), PR_ErrorToName(error), (int) error, (int) result)); diff --git a/storage/VacuumManager.cpp b/storage/VacuumManager.cpp index f2322dacfd..dfd3428c12 100644 --- a/storage/VacuumManager.cpp +++ b/storage/VacuumManager.cpp @@ -244,14 +244,14 @@ Vacuumer::HandleError(mozIStorageError *aError) NS_WARNING(warnMsg.get()); #endif - if (PR_LOG_TEST(gStorageLog, PR_LOG_ERROR)) { + if (MOZ_LOG_TEST(gStorageLog, LogLevel::Error)) { int32_t result; nsresult rv = aError->GetResult(&result); NS_ENSURE_SUCCESS(rv, rv); nsAutoCString message; rv = aError->GetMessage(message); NS_ENSURE_SUCCESS(rv, rv); - PR_LOG(gStorageLog, PR_LOG_ERROR, + MOZ_LOG(gStorageLog, LogLevel::Error, ("Vacuum failed with error: %d '%s'. Database was: '%s'", result, message.get(), mDBFilename.get())); } diff --git a/storage/mozStorageAsyncStatement.cpp b/storage/mozStorageAsyncStatement.cpp index 08c64fe269..f63ed6a40a 100644 --- a/storage/mozStorageAsyncStatement.cpp +++ b/storage/mozStorageAsyncStatement.cpp @@ -125,7 +125,7 @@ AsyncStatement::initialize(Connection *aDBConnection, mNativeConnection = aNativeConnection; mSQLString = aSQLStatement; - PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Inited async statement '%s' (0x%p)", + MOZ_LOG(gStorageLog, LogLevel::Debug, ("Inited async statement '%s' (0x%p)", mSQLString.get())); #ifdef DEBUG @@ -270,15 +270,15 @@ AsyncStatement::getAsyncStatement(sqlite3_stmt **_stmt) int rc = mDBConnection->prepareStatement(mNativeConnection, mSQLString, &mAsyncStatement); if (rc != SQLITE_OK) { - PR_LOG(gStorageLog, PR_LOG_ERROR, + MOZ_LOG(gStorageLog, LogLevel::Error, ("Sqlite statement prepare error: %d '%s'", rc, ::sqlite3_errmsg(mNativeConnection))); - PR_LOG(gStorageLog, PR_LOG_ERROR, + MOZ_LOG(gStorageLog, LogLevel::Error, ("Statement was: '%s'", mSQLString.get())); *_stmt = nullptr; return rc; } - PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Initialized statement '%s' (0x%p)", + MOZ_LOG(gStorageLog, LogLevel::Debug, ("Initialized statement '%s' (0x%p)", mSQLString.get(), mAsyncStatement)); } @@ -332,7 +332,7 @@ AsyncStatement::Finalize() mFinalized = true; - PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Finalizing statement '%s'", + MOZ_LOG(gStorageLog, LogLevel::Debug, ("Finalizing statement '%s'", mSQLString.get())); asyncFinalize(); diff --git a/storage/mozStorageConnection.cpp b/storage/mozStorageConnection.cpp index 8f26293b90..d76b5e9816 100644 --- a/storage/mozStorageConnection.cpp +++ b/storage/mozStorageConnection.cpp @@ -152,7 +152,7 @@ Module gModules[] = { void tracefunc (void *aClosure, const char *aStmt) { - PR_LOG(gStorageLog, PR_LOG_DEBUG, ("sqlite3_trace on %p for '%s'", aClosure, + MOZ_LOG(gStorageLog, LogLevel::Debug, ("sqlite3_trace on %p for '%s'", aClosure, aStmt)); } @@ -686,10 +686,10 @@ Connection::initializeInternal() // SQLite tracing can slow down queries (especially long queries) // significantly. Don't trace unless the user is actively monitoring SQLite. - if (PR_LOG_TEST(gStorageLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gStorageLog, LogLevel::Debug)) { ::sqlite3_trace(mDBConn, tracefunc, this); - PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Opening connection to '%s' (%p)", + MOZ_LOG(gStorageLog, LogLevel::Debug, ("Opening connection to '%s' (%p)", mTelemetryFilename.get(), this)); } @@ -904,11 +904,11 @@ Connection::internalClose(sqlite3 *aNativeConnection) } #endif // DEBUG - if (PR_LOG_TEST(gStorageLog, PR_LOG_NOTICE)) { + if (MOZ_LOG_TEST(gStorageLog, LogLevel::Debug)) { nsAutoCString leafName(":memory"); if (mDatabaseFile) (void)mDatabaseFile->GetNativeLeafName(leafName); - PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Closing connection to '%s'", + MOZ_LOG(gStorageLog, LogLevel::Debug, ("Closing connection to '%s'", leafName.get())); } @@ -934,7 +934,7 @@ Connection::internalClose(sqlite3 *aNativeConnection) sqlite3_stmt *stmt = nullptr; while ((stmt = ::sqlite3_next_stmt(aNativeConnection, stmt))) { - PR_LOG(gStorageLog, PR_LOG_NOTICE, + MOZ_LOG(gStorageLog, LogLevel::Debug, ("Auto-finalizing SQL statement '%s' (%x)", ::sqlite3_sql(stmt), stmt)); @@ -1084,7 +1084,7 @@ Connection::prepareStatement(sqlite3 *aNativeConnection, const nsCString &aSQL, #ifdef DEBUG NS_WARNING(warnMsg.get()); #endif - PR_LOG(gStorageLog, PR_LOG_ERROR, ("%s", warnMsg.get())); + MOZ_LOG(gStorageLog, LogLevel::Error, ("%s", warnMsg.get())); } (void)::sqlite3_extended_result_codes(aNativeConnection, 0); diff --git a/storage/mozStorageStatement.cpp b/storage/mozStorageStatement.cpp index 3c01a6933b..4456d49a94 100644 --- a/storage/mozStorageStatement.cpp +++ b/storage/mozStorageStatement.cpp @@ -130,15 +130,15 @@ Statement::initialize(Connection *aDBConnection, PromiseFlatCString(aSQLStatement), &mDBStatement); if (srv != SQLITE_OK) { - PR_LOG(gStorageLog, PR_LOG_ERROR, + MOZ_LOG(gStorageLog, LogLevel::Error, ("Sqlite statement prepare error: %d '%s'", srv, ::sqlite3_errmsg(aNativeConnection))); - PR_LOG(gStorageLog, PR_LOG_ERROR, + MOZ_LOG(gStorageLog, LogLevel::Error, ("Statement was: '%s'", PromiseFlatCString(aSQLStatement).get())); return NS_ERROR_FAILURE; } - PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Initialized statement '%s' (0x%p)", + MOZ_LOG(gStorageLog, LogLevel::Debug, ("Initialized statement '%s' (0x%p)", PromiseFlatCString(aSQLStatement).get(), mDBStatement)); @@ -276,7 +276,7 @@ Statement::getAsyncStatement(sqlite3_stmt **_stmt) return rc; } - PR_LOG(gStorageLog, PR_LOG_NOTICE, + MOZ_LOG(gStorageLog, LogLevel::Debug, ("Cloned statement 0x%p to 0x%p", mDBStatement, mAsyncStatement)); } @@ -366,7 +366,7 @@ Statement::internalFinalize(bool aDestructing) // In either case, the connection is still valid, hence closing // here is safe. // - PR_LOG(gStorageLog, PR_LOG_NOTICE, ("Finalizing statement '%s' during garbage-collection", + MOZ_LOG(gStorageLog, LogLevel::Debug, ("Finalizing statement '%s' during garbage-collection", ::sqlite3_sql(mDBStatement))); srv = ::sqlite3_finalize(mDBStatement); } @@ -398,7 +398,7 @@ Statement::internalFinalize(bool aDestructing) NS_WARNING(msg); #endif // 0 - PR_LOG(gStorageLog, PR_LOG_WARNING, (msg)); + MOZ_LOG(gStorageLog, LogLevel::Warning, (msg)); ::PR_smprintf_free(msg); } @@ -526,7 +526,7 @@ Statement::Reset() return NS_ERROR_NOT_INITIALIZED; #ifdef DEBUG - PR_LOG(gStorageLog, PR_LOG_DEBUG, ("Resetting statement: '%s'", + MOZ_LOG(gStorageLog, LogLevel::Debug, ("Resetting statement: '%s'", ::sqlite3_sql(mDBStatement))); checkAndLogStatementPerformance(mDBStatement); @@ -604,10 +604,10 @@ Statement::ExecuteStep(bool *_moreResults) } int srv = mDBConnection->stepStatement(mNativeConnection, mDBStatement); - if (srv != SQLITE_ROW && srv != SQLITE_DONE && PR_LOG_TEST(gStorageLog, PR_LOG_DEBUG)) { + if (srv != SQLITE_ROW && srv != SQLITE_DONE && MOZ_LOG_TEST(gStorageLog, LogLevel::Debug)) { nsAutoCString errStr; (void)mDBConnection->GetLastErrorString(errStr); - PR_LOG(gStorageLog, PR_LOG_DEBUG, + MOZ_LOG(gStorageLog, LogLevel::Debug, ("Statement::ExecuteStep error: %s", errStr.get())); } @@ -628,7 +628,7 @@ Statement::ExecuteStep(bool *_moreResults) mExecuting = false; } else if (mExecuting) { - PR_LOG(gStorageLog, PR_LOG_ERROR, + MOZ_LOG(gStorageLog, LogLevel::Error, ("SQLite error after mExecuting was true!")); mExecuting = false; } diff --git a/toolkit/components/downloads/ApplicationReputation.cpp b/toolkit/components/downloads/ApplicationReputation.cpp index ee7a0cb161..96f1407b36 100644 --- a/toolkit/components/downloads/ApplicationReputation.cpp +++ b/toolkit/components/downloads/ApplicationReputation.cpp @@ -66,8 +66,8 @@ using safe_browsing::ClientDownloadRequest_SignatureInfo; // NSPR_LOG_MODULES=ApplicationReputation:5 PRLogModuleInfo *ApplicationReputationService::prlog = nullptr; -#define LOG(args) PR_LOG(ApplicationReputationService::prlog, PR_LOG_DEBUG, args) -#define LOG_ENABLED() PR_LOG_TEST(ApplicationReputationService::prlog, PR_LOG_DEBUG) +#define LOG(args) MOZ_LOG(ApplicationReputationService::prlog, mozilla::LogLevel::Debug, args) +#define LOG_ENABLED() MOZ_LOG_TEST(ApplicationReputationService::prlog, mozilla::LogLevel::Debug) class PendingDBLookup; diff --git a/toolkit/components/filewatcher/NativeFileWatcherWin.cpp b/toolkit/components/filewatcher/NativeFileWatcherWin.cpp index 9f319628da..f638dc8456 100644 --- a/toolkit/components/filewatcher/NativeFileWatcherWin.cpp +++ b/toolkit/components/filewatcher/NativeFileWatcherWin.cpp @@ -139,7 +139,7 @@ static PRLogModuleInfo* GetFileWatcherContextLog() return gNativeWatcherPRLog; } -#define FILEWATCHERLOG(...) PR_LOG(GetFileWatcherContextLog(), PR_LOG_DEBUG, (__VA_ARGS__)) +#define FILEWATCHERLOG(...) MOZ_LOG(GetFileWatcherContextLog(), mozilla::LogLevel::Debug, (__VA_ARGS__)) // The number of notifications to store within WatchedResourceDescriptor:mNotificationBuffer. // If the buffer overflows, its contents are discarded and a change callback is dispatched diff --git a/toolkit/xre/nsUpdateDriver.cpp b/toolkit/xre/nsUpdateDriver.cpp index 0979815b32..50e2f063c5 100644 --- a/toolkit/xre/nsUpdateDriver.cpp +++ b/toolkit/xre/nsUpdateDriver.cpp @@ -79,7 +79,7 @@ GetUpdateLog() sUpdateLog = PR_NewLogModule("updatedriver"); return sUpdateLog; } -#define LOG(args) PR_LOG(GetUpdateLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(GetUpdateLog(), mozilla::LogLevel::Debug, args) #ifdef XP_WIN #define UPDATER_BIN "updater.exe" diff --git a/uriloader/base/nsDocLoader.cpp b/uriloader/base/nsDocLoader.cpp index dceab47bf0..0dfb64cb8d 100644 --- a/uriloader/base/nsDocLoader.cpp +++ b/uriloader/base/nsDocLoader.cpp @@ -35,6 +35,8 @@ #include "nsPresContext.h" #include "nsIAsyncVerifyRedirectCallback.h" +using mozilla::LogLevel; + static NS_DEFINE_CID(kThisImplCID, NS_THIS_DOCLOADER_IMPL_CID); // @@ -45,7 +47,7 @@ static NS_DEFINE_CID(kThisImplCID, NS_THIS_DOCLOADER_IMPL_CID); // set NSPR_LOG_MODULES=DocLoader:5 // set NSPR_LOG_FILE=nspr.log // -// this enables PR_LOG_DEBUG level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file nspr.log // PRLogModuleInfo* gDocLoaderLog = nullptr; @@ -119,7 +121,7 @@ nsDocLoader::nsDocLoader() ClearInternalProgress(); - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: created.\n", this)); } @@ -136,7 +138,7 @@ nsDocLoader::Init() nsresult rv = NS_NewLoadGroup(getter_AddRefs(mLoadGroup), this); if (NS_FAILED(rv)) return rv; - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: load group %x.\n", this, mLoadGroup.get())); return NS_OK; @@ -159,7 +161,7 @@ nsDocLoader::~nsDocLoader() Destroy(); - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: deleted.\n", this)); } @@ -235,7 +237,7 @@ nsDocLoader::Stop(void) { nsresult rv = NS_OK; - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: Stop() called\n", this)); NS_OBSERVER_ARRAY_NOTIFY_XPCOM_OBSERVERS(mChildList, nsDocLoader, Stop, ()); @@ -389,7 +391,7 @@ nsDocLoader::OnStartRequest(nsIRequest *request, nsISupports *aCtxt) { // called each time a request is added to the group. - if (PR_LOG_TEST(gDocLoaderLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gDocLoaderLog, LogLevel::Debug)) { nsAutoCString name; request->GetName(name); @@ -397,7 +399,7 @@ nsDocLoader::OnStartRequest(nsIRequest *request, nsISupports *aCtxt) if (mLoadGroup) mLoadGroup->GetActiveCount(&count); - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: OnStartRequest[%p](%s) mIsLoadingDocument=%s, %u active URLs", this, request, name.get(), (mIsLoadingDocument ? "true" : "false"), @@ -469,7 +471,7 @@ nsDocLoader::OnStopRequest(nsIRequest *aRequest, { nsresult rv = NS_OK; - if (PR_LOG_TEST(gDocLoaderLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(gDocLoaderLog, LogLevel::Debug)) { nsAutoCString name; aRequest->GetName(name); @@ -477,7 +479,7 @@ nsDocLoader::OnStopRequest(nsIRequest *aRequest, if (mLoadGroup) mLoadGroup->GetActiveCount(&count); - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: OnStopRequest[%p](%s) status=%x mIsLoadingDocument=%s, %u active URLs", this, aRequest, name.get(), aStatus, (mIsLoadingDocument ? "true" : "false"), @@ -682,7 +684,7 @@ void nsDocLoader::DocLoaderIsEmpty(bool aFlushLayout) // we don't need it anymore to CalculateMaxProgress(). ClearInternalProgress(); - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: Is now idle...\n", this)); nsCOMPtr docRequest = mDocumentRequest; @@ -733,7 +735,7 @@ void nsDocLoader::doStartDocumentLoad(void) nsAutoCString buffer; GetURIStringFromRequest(mDocumentRequest, buffer); - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: ++ Firing OnStateChange for start document load (...)." "\tURI: %s \n", this, buffer.get())); @@ -758,7 +760,7 @@ void nsDocLoader::doStartURLLoad(nsIRequest *request) nsAutoCString buffer; GetURIStringFromRequest(request, buffer); - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: ++ Firing OnStateChange start url load (...)." "\tURI: %s\n", this, buffer.get())); @@ -777,7 +779,7 @@ void nsDocLoader::doStopURLLoad(nsIRequest *request, nsresult aStatus) nsAutoCString buffer; GetURIStringFromRequest(request, buffer); - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: ++ Firing OnStateChange for end url load (...)." "\tURI: %s status=%x\n", this, buffer.get(), aStatus)); @@ -806,7 +808,7 @@ void nsDocLoader::doStopDocumentLoad(nsIRequest *request, nsAutoCString buffer; GetURIStringFromRequest(request, buffer); - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: ++ Firing OnStateChange for end document load (...)." "\tURI: %s Status=%x\n", this, buffer.get(), aStatus)); @@ -990,7 +992,7 @@ NS_IMETHODIMP nsDocLoader::OnProgress(nsIRequest *aRequest, nsISupports* ctxt, nsLoadFlags lf = 0; aRequest->GetLoadFlags(&lf); if ((lf & nsIChannel::LOAD_DOCUMENT_URI) && !(lf & nsIChannel::LOAD_TARGETED)) { - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p Ignoring OnProgress while load is not targeted\n", this)); return NS_OK; } @@ -1039,7 +1041,7 @@ NS_IMETHODIMP nsDocLoader::OnProgress(nsIRequest *aRequest, nsISupports* ctxt, nsAutoCString buffer; GetURIStringFromRequest(aRequest, buffer); - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p OOPS - No Request Info for: %s\n", this, buffer.get())); #endif /* DEBUG */ @@ -1169,7 +1171,7 @@ void nsDocLoader::FireOnProgressChange(nsDocLoader *aLoadInitiator, nsAutoCString buffer; GetURIStringFromRequest(request, buffer); - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: Progress (%s): curSelf: %d maxSelf: %d curTotal: %d maxTotal %d\n", this, buffer.get(), aProgress, aProgressMax, aTotalProgress, aMaxTotalProgress)); #endif /* DEBUG */ @@ -1235,7 +1237,7 @@ void nsDocLoader::DoFireOnStateChange(nsIWebProgress * const aProgress, nsAutoCString buffer; GetURIStringFromRequest(aRequest, buffer); - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: Status (%s): code: %x\n", this, buffer.get(), aStateFlags)); #endif /* DEBUG */ @@ -1256,7 +1258,7 @@ nsDocLoader::FireOnLocationChange(nsIWebProgress* aWebProgress, uint32_t aFlags) { NOTIFY_LISTENERS(nsIWebProgress::NOTIFY_LOCATION, - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, ("DocLoader [%p] calling %p->OnLocationChange", this, listener.get())); + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader [%p] calling %p->OnLocationChange", this, listener.get())); listener->OnLocationChange(aWebProgress, aRequest, aUri, aFlags); ); @@ -1435,7 +1437,7 @@ NS_IMETHODIMP nsDocLoader::GetPriority(int32_t *aPriority) NS_IMETHODIMP nsDocLoader::SetPriority(int32_t aPriority) { - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: SetPriority(%d) called\n", this, aPriority)); nsCOMPtr p = do_QueryInterface(mLoadGroup); @@ -1450,7 +1452,7 @@ NS_IMETHODIMP nsDocLoader::SetPriority(int32_t aPriority) NS_IMETHODIMP nsDocLoader::AdjustPriority(int32_t aDelta) { - PR_LOG(gDocLoaderLog, PR_LOG_DEBUG, + MOZ_LOG(gDocLoaderLog, LogLevel::Debug, ("DocLoader:%p: AdjustPriority(%d) called\n", this, aDelta)); nsCOMPtr p = do_QueryInterface(mLoadGroup); diff --git a/uriloader/base/nsURILoader.cpp b/uriloader/base/nsURILoader.cpp index d0dde71646..ff2bf26e6d 100644 --- a/uriloader/base/nsURILoader.cpp +++ b/uriloader/base/nsURILoader.cpp @@ -53,9 +53,9 @@ PRLogModuleInfo* nsURILoader::mLog = nullptr; -#define LOG(args) PR_LOG(nsURILoader::mLog, PR_LOG_DEBUG, args) -#define LOG_ERROR(args) PR_LOG(nsURILoader::mLog, PR_LOG_ERROR, args) -#define LOG_ENABLED() PR_LOG_TEST(nsURILoader::mLog, PR_LOG_DEBUG) +#define LOG(args) MOZ_LOG(nsURILoader::mLog, mozilla::LogLevel::Debug, args) +#define LOG_ERROR(args) MOZ_LOG(nsURILoader::mLog, mozilla::LogLevel::Error, args) +#define LOG_ENABLED() MOZ_LOG_TEST(nsURILoader::mLog, mozilla::LogLevel::Debug) #define NS_PREF_DISABLE_BACKGROUND_HANDLING \ "security.exthelperapp.disable_background_handling" diff --git a/uriloader/exthandler/mac/nsOSHelperAppService.mm b/uriloader/exthandler/mac/nsOSHelperAppService.mm index 9b7417cab2..a92ba82c17 100644 --- a/uriloader/exthandler/mac/nsOSHelperAppService.mm +++ b/uriloader/exthandler/mac/nsOSHelperAppService.mm @@ -30,6 +30,8 @@ #define HELPERAPPLAUNCHER_BUNDLE_URL "chrome://global/locale/helperAppLauncher.properties" #define BRAND_BUNDLE_URL "chrome://branding/locale/brand.properties" +using mozilla::LogLevel; + /* This is an undocumented interface (in the Foundation framework) that has * been stable since at least 10.2.8 and is still present on SnowLeopard. * Furthermore WebKit has three public methods (in WebKitSystemInterface.h) @@ -306,7 +308,7 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType, const nsCString& flatType = PromiseFlatCString(aMIMEType); const nsCString& flatExt = PromiseFlatCString(aFileExt); - PR_LOG(mLog, PR_LOG_DEBUG, ("Mac: HelperAppService lookup for type '%s' ext '%s'\n", + MOZ_LOG(mLog, LogLevel::Debug, ("Mac: HelperAppService lookup for type '%s' ext '%s'\n", flatType.get(), flatExt.get())); // Create a Mac-specific MIME info so we can use Mac-specific members. @@ -336,7 +338,7 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType, err = ::LSCopyApplicationForMIMEType(cfMIMEType, kLSRolesAll, &appURL); if ((err == noErr) && appURL && ::CFURLGetFSRef(appURL, &typeAppFSRef)) { haveAppForType = true; - PR_LOG(mLog, PR_LOG_DEBUG, ("LSCopyApplicationForMIMEType found a default application\n")); + MOZ_LOG(mLog, LogLevel::Debug, ("LSCopyApplicationForMIMEType found a default application\n")); } if (appURL) { ::CFRelease(appURL); @@ -354,7 +356,7 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType, kLSRolesAll, &extAppFSRef, nullptr); if (err == noErr) { haveAppForExt = true; - PR_LOG(mLog, PR_LOG_DEBUG, ("LSGetApplicationForInfo found a default application\n")); + MOZ_LOG(mLog, LogLevel::Debug, ("LSGetApplicationForInfo found a default application\n")); } ::CFRelease(cfExt); } @@ -526,7 +528,7 @@ nsOSHelperAppService::GetMIMEInfoFromOS(const nsACString& aMIMEType, } } - PR_LOG(mLog, PR_LOG_DEBUG, ("OS gave us: type '%s' found '%i'\n", mimeType.get(), *aFound)); + MOZ_LOG(mLog, LogLevel::Debug, ("OS gave us: type '%s' found '%i'\n", mimeType.get(), *aFound)); [localPool release]; return mimeInfoMac.forget(); diff --git a/uriloader/exthandler/nsExternalHelperAppService.cpp b/uriloader/exthandler/nsExternalHelperAppService.cpp index 582d744836..467a611369 100644 --- a/uriloader/exthandler/nsExternalHelperAppService.cpp +++ b/uriloader/exthandler/nsExternalHelperAppService.cpp @@ -125,11 +125,11 @@ enum { PRLogModuleInfo* nsExternalHelperAppService::mLog = nullptr; // Using level 3 here because the OSHelperAppServices use a log level -// of PR_LOG_DEBUG (4), and we want less detailed output here -// Using 3 instead of PR_LOG_WARN because we don't output warnings +// of LogLevel::Debug (4), and we want less detailed output here +// Using 3 instead of LogLevel::Warning because we don't output warnings #undef LOG -#define LOG(args) PR_LOG(nsExternalHelperAppService::mLog, 3, args) -#define LOG_ENABLED() PR_LOG_TEST(nsExternalHelperAppService::mLog, 3) +#define LOG(args) MOZ_LOG(nsExternalHelperAppService::mLog, mozilla::LogLevel::Info, args) +#define LOG_ENABLED() MOZ_LOG_TEST(nsExternalHelperAppService::mLog, mozilla::LogLevel::Info) static const char NEVER_ASK_FOR_SAVE_TO_DISK_PREF[] = "browser.helperApps.neverAsk.saveToDisk"; @@ -1828,10 +1828,10 @@ void nsExternalAppHandler::SendStatusChange(ErrorType type, nsresult rv, nsIRequ } break; } - PR_LOG(nsExternalHelperAppService::mLog, PR_LOG_ERROR, + MOZ_LOG(nsExternalHelperAppService::mLog, LogLevel::Error, ("Error: %s, type=%i, listener=0x%p, transfer=0x%p, rv=0x%08X\n", NS_LossyConvertUTF16toASCII(msgId).get(), type, mDialogProgressListener.get(), mTransfer.get(), rv)); - PR_LOG(nsExternalHelperAppService::mLog, PR_LOG_ERROR, + MOZ_LOG(nsExternalHelperAppService::mLog, LogLevel::Error, (" path='%s'\n", NS_ConvertUTF16toUTF8(path).get())); // Get properties file bundle and extract status string. @@ -1860,7 +1860,7 @@ void nsExternalAppHandler::SendStatusChange(ErrorType type, nsresult rv, nsIRequ 1, getter_Copies(title)); - PR_LOG(nsExternalHelperAppService::mLog, PR_LOG_DEBUG, + MOZ_LOG(nsExternalHelperAppService::mLog, LogLevel::Debug, ("mContentContext=0x%p, prompter=0x%p, qi rv=0x%08X, title='%s', msg='%s'", mContentContext.get(), prompter.get(), @@ -1878,7 +1878,7 @@ void nsExternalAppHandler::SendStatusChange(ErrorType type, nsresult rv, nsIRequ prompter = do_GetInterface(window->GetDocShell(), &qiRv); - PR_LOG(nsExternalHelperAppService::mLog, PR_LOG_DEBUG, + MOZ_LOG(nsExternalHelperAppService::mLog, LogLevel::Debug, ("No prompter from mContentContext, using DocShell, " \ "window=0x%p, docShell=0x%p, " \ "prompter=0x%p, qi rv=0x%08X", @@ -1890,7 +1890,7 @@ void nsExternalAppHandler::SendStatusChange(ErrorType type, nsresult rv, nsIRequ // If we still don't have a prompter, there's nothing else we // can do so just return. if (!prompter) { - PR_LOG(nsExternalHelperAppService::mLog, PR_LOG_ERROR, + MOZ_LOG(nsExternalHelperAppService::mLog, LogLevel::Error, ("No prompter from DocShell, no way to alert user")); return; } diff --git a/uriloader/exthandler/unix/nsOSHelperAppService.cpp b/uriloader/exthandler/unix/nsOSHelperAppService.cpp index 9ca76f34ba..77a285ffbe 100644 --- a/uriloader/exthandler/unix/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/unix/nsOSHelperAppService.cpp @@ -39,8 +39,8 @@ using namespace mozilla; -#define LOG(args) PR_LOG(mLog, PR_LOG_DEBUG, args) -#define LOG_ENABLED() PR_LOG_TEST(mLog, PR_LOG_DEBUG) +#define LOG(args) MOZ_LOG(mLog, mozilla::LogLevel::Debug, args) +#define LOG_ENABLED() MOZ_LOG_TEST(mLog, mozilla::LogLevel::Debug) static nsresult FindSemicolon(nsAString::const_iterator& aSemicolon_iter, diff --git a/uriloader/exthandler/win/nsOSHelperAppService.cpp b/uriloader/exthandler/win/nsOSHelperAppService.cpp index 43c2c2a314..da3503233a 100644 --- a/uriloader/exthandler/win/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/win/nsOSHelperAppService.cpp @@ -23,7 +23,7 @@ // shellapi.h is needed to build with WIN32_LEAN_AND_MEAN #include -#define LOG(args) PR_LOG(mLog, PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(mLog, mozilla::LogLevel::Debug, args) // helper methods: forward declarations... static nsresult GetExtensionFrom4xRegistryInfo(const nsACString& aMimeType, diff --git a/uriloader/prefetch/OfflineCacheUpdateChild.cpp b/uriloader/prefetch/OfflineCacheUpdateChild.cpp index 286d176f18..7285cf9d5a 100644 --- a/uriloader/prefetch/OfflineCacheUpdateChild.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateChild.cpp @@ -42,16 +42,16 @@ using mozilla::dom::ContentChild; // set NSPR_LOG_MODULES=nsOfflineCacheUpdate:5 // set NSPR_LOG_FILE=offlineupdate.log // -// this enables PR_LOG_ALWAYS level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file offlineupdate.log // extern PRLogModuleInfo *gOfflineCacheUpdateLog; #undef LOG -#define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args) +#define LOG(args) MOZ_LOG(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug, args) #undef LOG_ENABLED -#define LOG_ENABLED() PR_LOG_TEST(gOfflineCacheUpdateLog, 4) +#define LOG_ENABLED() MOZ_LOG_TEST(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug) namespace mozilla { namespace docshell { diff --git a/uriloader/prefetch/OfflineCacheUpdateGlue.cpp b/uriloader/prefetch/OfflineCacheUpdateGlue.cpp index 9a8374bdc6..8ffac3811d 100644 --- a/uriloader/prefetch/OfflineCacheUpdateGlue.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateGlue.cpp @@ -20,16 +20,16 @@ // set NSPR_LOG_MODULES=nsOfflineCacheUpdate:5 // set NSPR_LOG_FILE=offlineupdate.log // -// this enables PR_LOG_ALWAYS level information and places all output in +// this enables LogLevel::Info level information and places all output in // the file offlineupdate.log // extern PRLogModuleInfo *gOfflineCacheUpdateLog; #undef LOG -#define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args) +#define LOG(args) MOZ_LOG(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug, args) #undef LOG_ENABLED -#define LOG_ENABLED() PR_LOG_TEST(gOfflineCacheUpdateLog, 4) +#define LOG_ENABLED() MOZ_LOG_TEST(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug) namespace mozilla { namespace docshell { diff --git a/uriloader/prefetch/OfflineCacheUpdateParent.cpp b/uriloader/prefetch/OfflineCacheUpdateParent.cpp index cbb210ab18..56ad75fbdc 100644 --- a/uriloader/prefetch/OfflineCacheUpdateParent.cpp +++ b/uriloader/prefetch/OfflineCacheUpdateParent.cpp @@ -23,16 +23,16 @@ using mozilla::dom::TabParent; // set NSPR_LOG_MODULES=nsOfflineCacheUpdate:5 // set NSPR_LOG_FILE=offlineupdate.log // -// this enables PR_LOG_ALWAYS level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file offlineupdate.log // extern PRLogModuleInfo *gOfflineCacheUpdateLog; #undef LOG -#define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args) +#define LOG(args) MOZ_LOG(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug, args) #undef LOG_ENABLED -#define LOG_ENABLED() PR_LOG_TEST(gOfflineCacheUpdateLog, 4) +#define LOG_ENABLED() MOZ_LOG_TEST(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug) namespace mozilla { namespace docshell { diff --git a/uriloader/prefetch/nsOfflineCacheUpdate.cpp b/uriloader/prefetch/nsOfflineCacheUpdate.cpp index b8656d4b2c..82123fb662 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp @@ -57,16 +57,16 @@ static const int32_t kCustomProfileQuota = 512000; // set NSPR_LOG_MODULES=nsOfflineCacheUpdate:5 // set NSPR_LOG_FILE=offlineupdate.log // -// this enables PR_LOG_ALWAYS level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file offlineupdate.log // extern PRLogModuleInfo *gOfflineCacheUpdateLog; #undef LOG -#define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args) +#define LOG(args) MOZ_LOG(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug, args) #undef LOG_ENABLED -#define LOG_ENABLED() PR_LOG_TEST(gOfflineCacheUpdateLog, 4) +#define LOG_ENABLED() MOZ_LOG_TEST(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug) class AutoFreeArray { public: diff --git a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp index 04514e6215..8094a69c4a 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp @@ -76,16 +76,16 @@ typedef mozilla::docshell::OfflineCacheUpdateGlue OfflineCacheUpdateGlue; // set NSPR_LOG_MODULES=nsOfflineCacheUpdate:5 // set NSPR_LOG_FILE=offlineupdate.log // -// this enables PR_LOG_ALWAYS level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file offlineupdate.log // PRLogModuleInfo *gOfflineCacheUpdateLog; #undef LOG -#define LOG(args) PR_LOG(gOfflineCacheUpdateLog, 4, args) +#define LOG(args) MOZ_LOG(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug, args) #undef LOG_ENABLED -#define LOG_ENABLED() PR_LOG_TEST(gOfflineCacheUpdateLog, 4) +#define LOG_ENABLED() MOZ_LOG_TEST(gOfflineCacheUpdateLog, mozilla::LogLevel::Debug) namespace { diff --git a/uriloader/prefetch/nsPrefetchService.cpp b/uriloader/prefetch/nsPrefetchService.cpp index ab957c72e0..15d9f952f9 100644 --- a/uriloader/prefetch/nsPrefetchService.cpp +++ b/uriloader/prefetch/nsPrefetchService.cpp @@ -38,16 +38,16 @@ using namespace mozilla; // set NSPR_LOG_MODULES=nsPrefetch:5 // set NSPR_LOG_FILE=prefetch.log // -// this enables PR_LOG_ALWAYS level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file http.log // static PRLogModuleInfo *gPrefetchLog; #undef LOG -#define LOG(args) PR_LOG(gPrefetchLog, 4, args) +#define LOG(args) MOZ_LOG(gPrefetchLog, mozilla::LogLevel::Debug, args) #undef LOG_ENABLED -#define LOG_ENABLED() PR_LOG_TEST(gPrefetchLog, 4) +#define LOG_ENABLED() MOZ_LOG_TEST(gPrefetchLog, mozilla::LogLevel::Debug) #define PREFETCH_PREF "network.prefetch-next" diff --git a/widget/cocoa/NativeKeyBindings.mm b/widget/cocoa/NativeKeyBindings.mm index b1e32a5b9e..173a48b66e 100644 --- a/widget/cocoa/NativeKeyBindings.mm +++ b/widget/cocoa/NativeKeyBindings.mm @@ -67,7 +67,7 @@ NativeKeyBindings::Init(NativeKeyBindingsType aType) gNativeKeyBindingsLog = PR_NewLogModule("NativeKeyBindings"); } - PR_LOG(gNativeKeyBindingsLog, PR_LOG_ALWAYS, + MOZ_LOG(gNativeKeyBindingsLog, LogLevel::Info, ("%p NativeKeyBindings::Init", this)); // Many selectors have a one-to-one mapping to a Gecko command. Those mappings @@ -203,7 +203,7 @@ NativeKeyBindings::Execute(const WidgetKeyboardEvent& aEvent, DoCommandCallback aCallback, void* aCallbackData) { - PR_LOG(gNativeKeyBindingsLog, PR_LOG_ALWAYS, + MOZ_LOG(gNativeKeyBindingsLog, LogLevel::Info, ("%p NativeKeyBindings::KeyPress", this)); // Recover the current event, which should always be the key down we are @@ -212,19 +212,19 @@ NativeKeyBindings::Execute(const WidgetKeyboardEvent& aEvent, NSEvent* cocoaEvent = reinterpret_cast(aEvent.mNativeKeyEvent); if (!cocoaEvent || [cocoaEvent type] != NSKeyDown) { - PR_LOG(gNativeKeyBindingsLog, PR_LOG_ALWAYS, + MOZ_LOG(gNativeKeyBindingsLog, LogLevel::Info, ("%p NativeKeyBindings::KeyPress, no Cocoa key down event", this)); return false; } - PR_LOG(gNativeKeyBindingsLog, PR_LOG_ALWAYS, + MOZ_LOG(gNativeKeyBindingsLog, LogLevel::Info, ("%p NativeKeyBindings::KeyPress, interpreting", this)); nsAutoTArray bindingCommands; nsCocoaUtils::GetCommandsFromKeyEvent(cocoaEvent, bindingCommands); - PR_LOG(gNativeKeyBindingsLog, PR_LOG_ALWAYS, + MOZ_LOG(gNativeKeyBindingsLog, LogLevel::Info, ("%p NativeKeyBindings::KeyPress, bindingCommands=%u", this, bindingCommands.Length())); @@ -233,12 +233,12 @@ NativeKeyBindings::Execute(const WidgetKeyboardEvent& aEvent, for (uint32_t i = 0; i < bindingCommands.Length(); i++) { SEL selector = bindingCommands[i].selector; - if (PR_LOG_TEST(gNativeKeyBindingsLog, PR_LOG_ALWAYS)) { + if (MOZ_LOG_TEST(gNativeKeyBindingsLog, LogLevel::Info)) { NSString* selectorString = NSStringFromSelector(selector); nsAutoString nsSelectorString; nsCocoaUtils::GetStringForNSString(selectorString, nsSelectorString); - PR_LOG(gNativeKeyBindingsLog, PR_LOG_ALWAYS, + MOZ_LOG(gNativeKeyBindingsLog, LogLevel::Info, ("%p NativeKeyBindings::KeyPress, selector=%s", this, NS_LossyConvertUTF16toASCII(nsSelectorString).get())); } @@ -265,7 +265,7 @@ NativeKeyBindings::Execute(const WidgetKeyboardEvent& aEvent, } if (geckoCommands.IsEmpty()) { - PR_LOG(gNativeKeyBindingsLog, PR_LOG_ALWAYS, + MOZ_LOG(gNativeKeyBindingsLog, LogLevel::Info, ("%p NativeKeyBindings::KeyPress, handled=false", this)); return false; @@ -274,7 +274,7 @@ NativeKeyBindings::Execute(const WidgetKeyboardEvent& aEvent, for (uint32_t i = 0; i < geckoCommands.Length(); i++) { Command geckoCommand = geckoCommands[i]; - PR_LOG(gNativeKeyBindingsLog, PR_LOG_ALWAYS, + MOZ_LOG(gNativeKeyBindingsLog, LogLevel::Info, ("%p NativeKeyBindings::KeyPress, command=%s", this, WidgetKeyboardEvent::GetCommandStr(geckoCommand))); @@ -282,7 +282,7 @@ NativeKeyBindings::Execute(const WidgetKeyboardEvent& aEvent, aCallback(geckoCommand, aCallbackData); } - PR_LOG(gNativeKeyBindingsLog, PR_LOG_ALWAYS, + MOZ_LOG(gNativeKeyBindingsLog, LogLevel::Info, ("%p NativeKeyBindings::KeyPress, handled=true", this)); return true; diff --git a/widget/cocoa/TextInputHandler.mm b/widget/cocoa/TextInputHandler.mm index 16fae2aa94..b8f6be852b 100644 --- a/widget/cocoa/TextInputHandler.mm +++ b/widget/cocoa/TextInputHandler.mm @@ -364,7 +364,7 @@ TISInputSourceWrapper::TranslateToString(UInt32 aKeyCode, UInt32 aModifiers, const UCKeyboardLayout* UCKey = GetUCKeyboardLayout(); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::TranslateToString, aKeyCode=0x%X, " "aModifiers=0x%X, aKbType=0x%X UCKey=%p\n " "Shift: %s, Ctrl: %s, Opt: %s, Cmd: %s, CapsLock: %s, NumLock: %s", @@ -384,7 +384,7 @@ TISInputSourceWrapper::TranslateToString(UInt32 aKeyCode, UInt32 aModifiers, aKbType, kUCKeyTranslateNoDeadKeysMask, &deadKeyState, 5, &len, chars); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::TranslateToString, err=0x%X, len=%llu", this, err, len)); @@ -397,7 +397,7 @@ TISInputSourceWrapper::TranslateToString(UInt32 aKeyCode, UInt32 aModifiers, "size of char16_t and size of UniChar are different"); memcpy(aStr.BeginWriting(), chars, len * sizeof(char16_t)); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::TranslateToString, aStr=\"%s\"", this, NS_ConvertUTF16toUTF8(aStr).get())); @@ -759,7 +759,7 @@ TISInputSourceWrapper::InitKeyEvent(NSEvent *aNativeKeyEvent, { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::InitKeyEvent, aNativeKeyEvent=%p, " "aKeyEvent.message=%s, aInsertString=%p, IsOpenedIMEMode()=%s", this, aNativeKeyEvent, GetGeckoKeyEventType(aKeyEvent), aInsertString, @@ -942,7 +942,7 @@ TISInputSourceWrapper::InitKeyEvent(NSEvent *aNativeKeyEvent, aKeyEvent.mIsRepeat = ([aNativeKeyEvent type] == NSKeyDown) ? [aNativeKeyEvent isARepeat] : false; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::InitKeyEvent, " "shift=%s, ctrl=%s, alt=%s, meta=%s", this, OnOrOff(aKeyEvent.IsShift()), OnOrOff(aKeyEvent.IsControl()), @@ -959,7 +959,7 @@ TISInputSourceWrapper::InitKeyEvent(NSEvent *aNativeKeyEvent, aKeyEvent.charCode = 0; aKeyEvent.isChar = false; // XXX not used in XP level - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::InitKeyEvent, keyCode=0x%X charCode=0x0", this, aKeyEvent.keyCode)); } @@ -1041,13 +1041,13 @@ TISInputSourceWrapper::InitKeyPressEvent(NSEvent *aNativeKeyEvent, NS_ASSERTION(aKeyEvent.message == NS_KEY_PRESS, "aKeyEvent must be NS_KEY_PRESS event"); - if (PR_LOG_TEST(gLog, PR_LOG_ALWAYS)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Info)) { nsAutoString chars; nsCocoaUtils::GetStringForNSString([aNativeKeyEvent characters], chars); NS_ConvertUTF16toUTF8 utf8Chars(chars); char16_t expectedChar = static_cast(aInsertChar); NS_ConvertUTF16toUTF8 utf8ExpectedChar(&expectedChar, 1); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::InitKeyPressEvent, aNativeKeyEvent=%p, " "[aNativeKeyEvent characters]=\"%s\", aInsertChar=0x%X(%s), " "aKeyEvent.message=%s, aKbType=0x%X, IsOpenedIMEMode()=%s", @@ -1062,7 +1062,7 @@ TISInputSourceWrapper::InitKeyPressEvent(NSEvent *aNativeKeyEvent, aKeyEvent.keyCode = 0; } - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::InitKeyPressEvent, " "aKeyEvent.keyCode=0x%X, aKeyEvent.charCode=0x%X", this, aKeyEvent.keyCode, aKeyEvent.charCode)); @@ -1085,7 +1085,7 @@ TISInputSourceWrapper::InitKeyPressEvent(NSEvent *aNativeKeyEvent, lockState |= kEventKeyModifierNumLockMask; } - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::InitKeyPressEvent, " "isRomanKeyboardLayout=%s, key=0x%X", this, TrueOrFalse(isRomanKeyboardLayout), aKbType, key)); @@ -1127,7 +1127,7 @@ TISInputSourceWrapper::InitKeyPressEvent(NSEvent *aNativeKeyEvent, AlternativeCharCode altCharCodes(unshiftedChar, shiftedChar); aKeyEvent.alternativeCharCodes.AppendElement(altCharCodes); } - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::InitKeyPressEvent, " "aKeyEvent.isMeta=%s, isDvorakQWERTY=%s, " "unshiftedChar=U+%X, shiftedChar=U+%X", @@ -1189,7 +1189,7 @@ TISInputSourceWrapper::InitKeyPressEvent(NSEvent *aNativeKeyEvent, AlternativeCharCode altCharCodes(cmdedChar, cmdedShiftChar); aKeyEvent.alternativeCharCodes.AppendElement(altCharCodes); } - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::InitKeyPressEvent, " "hasCmdShiftOnlyChar=%s, isCmdSwitchLayout=%s, isDvorakQWERTY=%s, " "cmdedChar=U+%X, cmdedShiftChar=U+%X", @@ -1201,7 +1201,7 @@ TISInputSourceWrapper::InitKeyPressEvent(NSEvent *aNativeKeyEvent, AlternativeCharCode altCharCodes(0, originalCmdedShiftChar); aKeyEvent.alternativeCharCodes.AppendElement(altCharCodes); } - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::InitKeyPressEvent, " "hasCmdShiftOnlyChar=%s, originalCmdedShiftChar=U+%X", this, TrueOrFalse(hasCmdShiftOnlyChar), originalCmdedShiftChar)); @@ -1214,7 +1214,7 @@ TISInputSourceWrapper::ComputeGeckoKeyCode(UInt32 aNativeKeyCode, UInt32 aKbType, bool aCmdIsPressed) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TISInputSourceWrapper::ComputeGeckoKeyCode, aNativeKeyCode=0x%X, " "aKbType=0x%X, aCmdIsPressed=%s, IsOpenedIMEMode()=%s, " "IsASCIICapable()=%s", @@ -1443,9 +1443,9 @@ TextInputHandler::CreateAllKeyboardLayoutList() void TextInputHandler::DebugPrintAllKeyboardLayouts() { - if (PR_LOG_TEST(gLog, PR_LOG_ALWAYS)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Info)) { CFArrayRef list = CreateAllKeyboardLayoutList(); - PR_LOG(gLog, PR_LOG_ALWAYS, ("Keyboard layout configuration:")); + MOZ_LOG(gLog, LogLevel::Info, ("Keyboard layout configuration:")); CFIndex idx = ::CFArrayGetCount(list); TISInputSourceWrapper tis; for (CFIndex i = 0; i < idx; ++i) { @@ -1455,7 +1455,7 @@ TextInputHandler::DebugPrintAllKeyboardLayouts() nsAutoString name, isid; tis.GetLocalizedName(name); tis.GetInputSourceID(isid); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, (" %s\t<%s>%s%s\n", NS_ConvertUTF16toUTF8(name).get(), NS_ConvertUTF16toUTF8(isid).get(), @@ -1496,13 +1496,13 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent) NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; if (Destroyed()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, " "widget has been already destroyed", this)); return false; } - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, aNativeEvent=%p, " "type=%s, keyCode=%lld (0x%X), modifierFlags=0x%X, characters=\"%s\", " "charactersIgnoringModifiers=\"%s\"", @@ -1537,7 +1537,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent) currentKeyEvent->mKeyDownHandled = DispatchEvent(keydownEvent); if (Destroyed()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, " "widget was destroyed by keydown event", this)); return currentKeyEvent->IsDefaultPrevented(); @@ -1547,14 +1547,14 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent) // case we should not fire the key press. // XXX This is a special code only on Cocoa widget, why is this needed? if (firstResponder != [[mView window] firstResponder]) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, " "view lost focus by keydown event", this)); return currentKeyEvent->IsDefaultPrevented(); } if (currentKeyEvent->IsDefaultPrevented()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, " "keydown event's default is prevented", this)); return true; @@ -1573,24 +1573,24 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent) bool wasComposing = IsIMEComposing(); bool interpretKeyEventsCalled = false; if (IsIMEEnabled() || IsASCIICapableOnly()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, calling interpretKeyEvents", this)); [mView interpretKeyEvents:[NSArray arrayWithObject:aNativeEvent]]; interpretKeyEventsCalled = true; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, called interpretKeyEvents", this)); } if (Destroyed()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, widget was destroyed", this)); return currentKeyEvent->IsDefaultPrevented(); } - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, wasComposing=%s, " "IsIMEComposing()=%s", this, TrueOrFalse(wasComposing), TrueOrFalse(IsIMEComposing()))); @@ -1615,7 +1615,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent) IsNormalCharInputtingEvent(keypressEvent))) { currentKeyEvent->mKeyPressHandled = DispatchEvent(keypressEvent); currentKeyEvent->mKeyPressDispatched = true; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, keypress event dispatched", this)); } @@ -1623,7 +1623,7 @@ TextInputHandler::HandleKeyDownEvent(NSEvent* aNativeEvent) // Note: mWidget might have become null here. Don't count on it from here on. - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyDownEvent, " "keydown handled=%s, keypress handled=%s, causedOtherKeyEvents=%s", this, TrueOrFalse(currentKeyEvent->mKeyDownHandled), @@ -1639,7 +1639,7 @@ TextInputHandler::HandleKeyUpEvent(NSEvent* aNativeEvent) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyUpEvent, aNativeEvent=%p, " "type=%s, keyCode=%lld (0x%X), modifierFlags=0x%X, characters=\"%s\", " "charactersIgnoringModifiers=\"%s\", " @@ -1651,7 +1651,7 @@ TextInputHandler::HandleKeyUpEvent(NSEvent* aNativeEvent) TrueOrFalse(IsIMEComposing()))); if (Destroyed()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleKeyUpEvent, " "widget has been already destroyed", this)); return; @@ -1676,7 +1676,7 @@ TextInputHandler::HandleFlagsChanged(NSEvent* aNativeEvent) NS_OBJC_BEGIN_TRY_ABORT_BLOCK; if (Destroyed()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleFlagsChanged, " "widget has been already destroyed", this)); return; @@ -1684,7 +1684,7 @@ TextInputHandler::HandleFlagsChanged(NSEvent* aNativeEvent) nsRefPtr kungFuDeathGrip(mWidget); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::HandleFlagsChanged, aNativeEvent=%p, " "type=%s, keyCode=%s (0x%X), modifierFlags=0x%08X, " "sLastModifierState=0x%08X, IsIMEComposing()=%s", @@ -1995,7 +1995,7 @@ TextInputHandler::DispatchKeyEventForFlagsChanged(NSEvent* aNativeEvent, return; } - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::DispatchKeyEventForFlagsChanged, aNativeEvent=%p, " "type=%s, keyCode=%s (0x%X), aDispatchKeyDown=%s, IsIMEComposing()=%s", this, aNativeEvent, GetNativeKeyEventType(aNativeEvent), @@ -2039,7 +2039,7 @@ TextInputHandler::InsertText(NSAttributedString* aAttrString, KeyEventState* currentKeyEvent = GetCurrentKeyEvent(); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::InsertText, aAttrString=\"%s\", " "aReplacementRange=%p { location=%llu, length=%llu }, " "IsIMEComposing()=%s, IgnoreIMEComposition()=%s, " @@ -2180,7 +2180,7 @@ TextInputHandler::DoCommandBySelector(const char* aSelector) KeyEventState* currentKeyEvent = GetCurrentKeyEvent(); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::DoCommandBySelector, aSelector=\"%s\", " "Destroyed()=%s, keydownHandled=%s, keypressHandled=%s, " "causedOtherKeyEvents=%s", @@ -2197,7 +2197,7 @@ TextInputHandler::DoCommandBySelector(const char* aSelector) InitKeyEvent(currentKeyEvent->mKeyEvent, keypressEvent); currentKeyEvent->mKeyPressHandled = DispatchEvent(keypressEvent); currentKeyEvent->mKeyPressDispatched = true; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandler::DoCommandBySelector, keypress event " "dispatched, Destroyed()=%s, keypressHandled=%s", this, TrueOrFalse(Destroyed()), @@ -2260,7 +2260,7 @@ IMEInputHandler::OnCurrentTextInputSourceChange(CFNotificationCenterRef aCenter, tis.GetInputSourceID(sLatestIMEOpenedModeInputSourceID); } - if (PR_LOG_TEST(gLog, PR_LOG_ALWAYS)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Info)) { static CFStringRef sLastTIS = nullptr; CFStringRef newTIS; tis.GetInputSourceID(newTIS); @@ -2285,7 +2285,7 @@ IMEInputHandler::OnCurrentTextInputSourceChange(CFNotificationCenterRef aCenter, tis.GetPrimaryLanguage(lang0); tis.GetBundleID(bundleID0); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("IMEInputHandler::OnCurrentTextInputSourceChange,\n" " Current Input Source is changed to:\n" " currentInputContext=%p\n" @@ -2348,9 +2348,9 @@ IMEInputHandler::CreateAllIMEModeList() void IMEInputHandler::DebugPrintAllIMEModes() { - if (PR_LOG_TEST(gLog, PR_LOG_ALWAYS)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Info)) { CFArrayRef list = CreateAllIMEModeList(); - PR_LOG(gLog, PR_LOG_ALWAYS, ("IME mode configuration:")); + MOZ_LOG(gLog, LogLevel::Info, ("IME mode configuration:")); CFIndex idx = ::CFArrayGetCount(list); TISInputSourceWrapper tis; for (CFIndex i = 0; i < idx; ++i) { @@ -2360,7 +2360,7 @@ IMEInputHandler::DebugPrintAllIMEModes() nsAutoString name, isid; tis.GetLocalizedName(name); tis.GetInputSourceID(isid); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, (" %s\t<%s>%s%s\n", NS_ConvertUTF16toUTF8(name).get(), NS_ConvertUTF16toUTF8(isid).get(), @@ -2404,7 +2404,7 @@ IMEInputHandler::NotifyIMEOfFocusChangeInGecko() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::NotifyIMEOfFocusChangeInGecko, " "Destroyed()=%s, IsFocused()=%s, inputContext=%p", this, TrueOrFalse(Destroyed()), TrueOrFalse(IsFocused()), @@ -2443,7 +2443,7 @@ IMEInputHandler::DiscardIMEComposition() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::DiscardIMEComposition, " "Destroyed()=%s, IsFocused()=%s, mView=%p, inputContext=%p", this, TrueOrFalse(Destroyed()), TrueOrFalse(IsFocused()), @@ -2474,7 +2474,7 @@ IMEInputHandler::SyncASCIICapableOnly() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::SyncASCIICapableOnly, " "Destroyed()=%s, IsFocused()=%s, mIsASCIICapableOnly=%s, " "GetCurrentTSMDocumentID()=%p", @@ -2577,7 +2577,7 @@ uint32_t IMEInputHandler::ConvertToTextRangeType(uint32_t aUnderlineStyle, NSRange& aSelectedRange) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::ConvertToTextRangeType, " "aUnderlineStyle=%llu, aSelectedRange.length=%llu,", this, aUnderlineStyle, aSelectedRange.length)); @@ -2630,7 +2630,7 @@ IMEInputHandler::GetRangeCount(NSAttributedString *aAttrString) count++; } - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::GetRangeCount, aAttrString=\"%s\", count=%llu", this, GetCharacters([aAttrString string]), count)); @@ -2667,7 +2667,7 @@ IMEInputHandler::CreateTextRangeArray(NSAttributedString *aAttrString, ConvertToTextRangeType([attributeValue intValue], aSelectedRange); textRangeArray->AppendElement(range); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::CreateTextRangeArray, " "range={ mStartOffset=%llu, mEndOffset=%llu, mRangeType=%s }", this, range.mStartOffset, range.mEndOffset, @@ -2685,7 +2685,7 @@ IMEInputHandler::CreateTextRangeArray(NSAttributedString *aAttrString, range.mRangeType = NS_TEXTRANGE_CARETPOSITION; textRangeArray->AppendElement(range); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::CreateTextRangeArray, " "range={ mStartOffset=%llu, mEndOffset=%llu, mRangeType=%s }", this, range.mStartOffset, range.mEndOffset, @@ -2701,7 +2701,7 @@ IMEInputHandler::DispatchCompositionChangeEvent(const nsString& aText, NSAttributedString* aAttrString, NSRange& aSelectedRange) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::DispatchCompositionChangeEvent, " "aText=\"%s\", aAttrString=\"%s\", " "aSelectedRange={ location=%llu, length=%llu }, " @@ -2727,7 +2727,7 @@ IMEInputHandler::DispatchCompositionChangeEvent(const nsString& aText, bool IMEInputHandler::DispatchCompositionCommitEvent(const nsAString* aCommitString) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::DispatchCompositionCommitEvent, " "aCommitString=0x%p (\"%s\"), Destroyed()=%s", this, aCommitString, @@ -2763,7 +2763,7 @@ IMEInputHandler::InsertTextAsCommittingComposition( { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::InsertTextAsCommittingComposition, " "aAttrString=\"%s\", aReplacementRange=%p { location=%llu, length=%llu }, " "Destroyed()=%s, IsIMEComposing()=%s, " @@ -2790,7 +2790,7 @@ IMEInputHandler::InsertTextAsCommittingComposition( !NSEqualRanges(MarkedRange(), *aReplacementRange)) { DispatchCompositionCommitEvent(); if (Destroyed()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::InsertTextAsCommittingComposition, " "destroyed by commiting composition for setting replacement range", this)); @@ -2819,7 +2819,7 @@ IMEInputHandler::InsertTextAsCommittingComposition( DispatchEvent(compStart); if (Destroyed()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::InsertTextAsCommittingComposition, " "destroyed by compositionstart event", this)); return; @@ -2830,7 +2830,7 @@ IMEInputHandler::InsertTextAsCommittingComposition( DispatchCompositionCommitEvent(&str); if (Destroyed()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::InsertTextAsCommittingComposition, " "destroyed by compositioncommit event", this)); return; @@ -2850,7 +2850,7 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::SetMarkedText, " "aAttrString=\"%s\", aSelectedRange={ location=%llu, length=%llu }, " "aReplacementRange=%p { location=%llu, length=%llu }, " @@ -2880,7 +2880,7 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, DispatchCompositionCommitEvent(); mIgnoreIMECommit = ignoreIMECommit; if (Destroyed()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::SetMarkedText, " "destroyed by commiting composition for setting replacement range", this)); @@ -2909,7 +2909,7 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, DispatchEvent(compStart); if (Destroyed()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::SetMarkedText, " "destroyed by compositionstart event", this)); return; @@ -2927,7 +2927,7 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, DispatchCompositionChangeEvent(str, aAttrString, aSelectedRange); if (Destroyed()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::SetMarkedText, " "destroyed by compositionchange event", this)); } @@ -2938,7 +2938,7 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, // current composition. DispatchCompositionCommitEvent(&EmptyString()); if (Destroyed()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::SetMarkedText, " "destroyed by compositioncommit event", this)); return; @@ -2951,7 +2951,7 @@ IMEInputHandler::SetMarkedText(NSAttributedString* aAttrString, NSInteger IMEInputHandler::ConversationIdentifier() { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::ConversationIdentifier, Destroyed()=%s", this, TrueOrFalse(Destroyed()))); @@ -2966,7 +2966,7 @@ IMEInputHandler::ConversationIdentifier() textContent.InitForQueryTextContent(0, 0); DispatchEvent(textContent); if (!textContent.mSucceeded) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::ConversationIdentifier, Failed", this)); return reinterpret_cast(mView); } @@ -2981,7 +2981,7 @@ IMEInputHandler::GetAttributedSubstringFromRange(NSRange& aRange, { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::GetAttributedSubstringFromRange, " "aRange={ location=%llu, length=%llu }, aActualRange=%p, Destroyed()=%s", this, aRange.location, aRange.length, aActualRange, @@ -3003,7 +3003,7 @@ IMEInputHandler::GetAttributedSubstringFromRange(NSRange& aRange, textContent.RequestFontRanges(); DispatchEvent(textContent); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::GetAttributedSubstringFromRange, " "textContent={ mSucceeded=%s, mReply={ mString=\"%s\", mOffset=%llu } }", this, TrueOrFalse(textContent.mSucceeded), @@ -3047,7 +3047,7 @@ IMEInputHandler::GetAttributedSubstringFromRange(NSRange& aRange, bool IMEInputHandler::HasMarkedText() { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::HasMarkedText, " "mMarkedRange={ location=%llu, length=%llu }", this, mMarkedRange.location, mMarkedRange.length)); @@ -3058,7 +3058,7 @@ IMEInputHandler::HasMarkedText() NSRange IMEInputHandler::MarkedRange() { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::MarkedRange, " "mMarkedRange={ location=%llu, length=%llu }", this, mMarkedRange.location, mMarkedRange.length)); @@ -3074,7 +3074,7 @@ IMEInputHandler::SelectedRange() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::SelectedRange, Destroyed()=%s, mSelectedRange={ " "location=%llu, length=%llu }", this, TrueOrFalse(Destroyed()), mSelectedRange.location, @@ -3094,7 +3094,7 @@ IMEInputHandler::SelectedRange() WidgetQueryContentEvent selection(true, NS_QUERY_SELECTED_TEXT, mWidget); DispatchEvent(selection); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::SelectedRange, selection={ mSucceeded=%s, " "mReply={ mOffset=%llu, mString.Length()=%llu } }", this, TrueOrFalse(selection.mSucceeded), selection.mReply.mOffset, @@ -3156,7 +3156,7 @@ IMEInputHandler::FirstRectForCharacterRange(NSRange& aRange, { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::FirstRectForCharacterRange, Destroyed()=%s, " "aRange={ location=%llu, length=%llu }, aActualRange=%p }", this, TrueOrFalse(Destroyed()), aRange.location, aRange.length, @@ -3224,7 +3224,7 @@ IMEInputHandler::FirstRectForCharacterRange(NSRange& aRange, *aActualRange = actualRange; } - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::FirstRectForCharacterRange, " "useCaretRect=%s rect={ x=%f, y=%f, width=%f, height=%f }, " "actualRange={ location=%llu, length=%llu }", @@ -3242,7 +3242,7 @@ IMEInputHandler::CharacterIndexForPoint(NSPoint& aPoint) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::CharacterIndexForPoint, aPoint={ x=%f, y=%f }", this, aPoint.x, aPoint.y)); @@ -3275,7 +3275,7 @@ IMEInputHandler::GetValidAttributesForMarkedText() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::GetValidAttributesForMarkedText", this)); //nsRefPtr kungFuDeathGrip(this); @@ -3330,7 +3330,7 @@ IMEInputHandler::~IMEInputHandler() void IMEInputHandler::OnFocusChangeInGecko(bool aFocus) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::OnFocusChangeInGecko, aFocus=%s, Destroyed()=%s, " "sFocusedIMEHandler=%p", this, TrueOrFalse(aFocus), TrueOrFalse(Destroyed()), sFocusedIMEHandler)); @@ -3358,7 +3358,7 @@ IMEInputHandler::OnFocusChangeInGecko(bool aFocus) bool IMEInputHandler::OnDestroyWidget(nsChildView* aDestroyingWidget) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::OnDestroyWidget, aDestroyingWidget=%p, " "sFocusedIMEHandler=%p, IsIMEComposing()=%s", this, aDestroyingWidget, sFocusedIMEHandler, @@ -3391,7 +3391,7 @@ IMEInputHandler::OnStartIMEComposition() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::OnStartIMEComposition, mView=%p, mWidget=%p" "inputContext=%p, mIsIMEComposing=%s", this, mView, mWidget, mView ? [mView inputContext] : nullptr, @@ -3408,7 +3408,7 @@ IMEInputHandler::OnUpdateIMEComposition(NSString* aIMECompositionString) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::OnUpdateIMEComposition, mView=%p, mWidget=%p, " "inputContext=%p, mIsIMEComposing=%s, aIMECompositionString=\"%s\"", this, mView, mWidget, mView ? [mView inputContext] : nullptr, @@ -3428,7 +3428,7 @@ IMEInputHandler::OnEndIMEComposition() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::OnEndIMEComposition, mView=%p, mWidget=%p, " "inputContext=%p, mIsIMEComposing=%s", this, mView, mWidget, mView ? [mView inputContext] : nullptr, @@ -3451,7 +3451,7 @@ IMEInputHandler::SendCommittedText(NSString *aString) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::SendCommittedText, mView=%p, mWidget=%p, " "inputContext=%p, mIsIMEComposing=%s", this, mView, mWidget, mView ? [mView inputContext] : nullptr, @@ -3476,7 +3476,7 @@ IMEInputHandler::KillIMEComposition() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::KillIMEComposition, mView=%p, mWidget=%p, " "inputContext=%p, mIsIMEComposing=%s, " "Destroyed()=%s, IsFocused()=%s", @@ -3496,7 +3496,7 @@ IMEInputHandler::KillIMEComposition() return; } - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::KillIMEComposition, Pending...", this)); // Commit the composition internally. @@ -3516,7 +3516,7 @@ IMEInputHandler::CommitIMEComposition() if (!IsIMEComposing()) return; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::CommitIMEComposition, mIMECompositionString=%s", this, GetCharacters(mIMECompositionString))); @@ -3540,7 +3540,7 @@ IMEInputHandler::CancelIMEComposition() if (!IsIMEComposing()) return; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::CancelIMEComposition, mIMECompositionString=%s", this, GetCharacters(mIMECompositionString))); @@ -3654,12 +3654,12 @@ IMEInputHandler::SetIMEOpenState(bool aOpenIME) void IMEInputHandler::OpenSystemPreferredLanguageIME() { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::OpenSystemPreferredLanguageIME", this)); CFArrayRef langList = ::CFLocaleCopyPreferredLanguages(); if (!langList) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::OpenSystemPreferredLanguageIME, langList is NULL", this)); return; @@ -3681,10 +3681,10 @@ IMEInputHandler::OpenSystemPreferredLanguageIME() TISInputSourceWrapper tis; tis.InitByLanguage(lang); if (tis.IsOpenedIMEMode()) { - if (PR_LOG_TEST(gLog, PR_LOG_ALWAYS)) { + if (MOZ_LOG_TEST(gLog, LogLevel::Info)) { CFStringRef foundTIS; tis.GetInputSourceID(foundTIS); - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p IMEInputHandler::OpenSystemPreferredLanguageIME, " "foundTIS=%s, lang=%s", this, GetCharacters(foundTIS), GetCharacters(lang))); @@ -3732,7 +3732,7 @@ TextInputHandlerBase::~TextInputHandlerBase() bool TextInputHandlerBase::OnDestroyWidget(nsChildView* aDestroyingWidget) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandlerBase::OnDestroyWidget, " "aDestroyingWidget=%p, mWidget=%p", this, aDestroyingWidget, mWidget)); @@ -3751,7 +3751,7 @@ TextInputHandlerBase::DispatchEvent(WidgetGUIEvent& aEvent) if (aEvent.message == NS_KEY_PRESS) { WidgetInputEvent& inputEvent = *aEvent.AsInputEvent(); if (!inputEvent.IsMeta()) { - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandlerBase::DispatchEvent, hiding mouse cursor", this)); [NSCursor setHiddenUntilMouseMoves:YES]; } @@ -3849,7 +3849,7 @@ TextInputHandlerBase::GetWindowLevel() { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandlerBase::GetWindowLevel, Destryoed()=%s", this, TrueOrFalse(Destroyed()))); @@ -3864,7 +3864,7 @@ TextInputHandlerBase::GetWindowLevel() NS_ENSURE_TRUE(editorView, NSNormalWindowLevel); NSInteger windowLevel = [[editorView window] level]; - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandlerBase::GetWindowLevel, windowLevel=%s (%X)", this, GetWindowLevelName(windowLevel), windowLevel)); @@ -3884,7 +3884,7 @@ TextInputHandlerBase::AttachNativeKeyEvent(WidgetKeyboardEvent& aKeyEvent) return NS_OK; } - PR_LOG(gLog, PR_LOG_ALWAYS, + MOZ_LOG(gLog, LogLevel::Info, ("%p TextInputHandlerBase::AttachNativeKeyEvent, key=0x%X, char=0x%X, " "mod=0x%X", this, aKeyEvent.keyCode, aKeyEvent.charCode, aKeyEvent.modifiers)); diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 12846d264b..194bd108fc 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -5628,7 +5628,7 @@ static int32_t RoundUp(double aDouble) if (!mGeckoChild) return NSDragOperationNone; - PR_LOG(sCocoaLog, PR_LOG_ALWAYS, ("ChildView doDragAction: entered\n")); + MOZ_LOG(sCocoaLog, LogLevel::Info, ("ChildView doDragAction: entered\n")); if (!mDragService) { CallGetService(kDragServiceContractID, &mDragService); @@ -5722,7 +5722,7 @@ static int32_t RoundUp(double aDouble) { NS_OBJC_BEGIN_TRY_ABORT_BLOCK_RETURN; - PR_LOG(sCocoaLog, PR_LOG_ALWAYS, ("ChildView draggingEntered: entered\n")); + MOZ_LOG(sCocoaLog, LogLevel::Info, ("ChildView draggingEntered: entered\n")); // there should never be a globalDragPboard when "draggingEntered:" is // called, but just in case we'll take care of it here. @@ -5740,14 +5740,14 @@ static int32_t RoundUp(double aDouble) - (NSDragOperation)draggingUpdated:(id )sender { - PR_LOG(sCocoaLog, PR_LOG_ALWAYS, ("ChildView draggingUpdated: entered\n")); + MOZ_LOG(sCocoaLog, LogLevel::Info, ("ChildView draggingUpdated: entered\n")); return [self doDragAction:NS_DRAGDROP_OVER sender:sender]; } - (void)draggingExited:(id )sender { - PR_LOG(sCocoaLog, PR_LOG_ALWAYS, ("ChildView draggingExited: entered\n")); + MOZ_LOG(sCocoaLog, LogLevel::Info, ("ChildView draggingExited: entered\n")); nsAutoRetainCocoaObject kungFuDeathGrip(self); [self doDragAction:NS_DRAGDROP_EXIT sender:sender]; @@ -5846,7 +5846,7 @@ static int32_t RoundUp(double aDouble) nsresult rv; - PR_LOG(sCocoaLog, PR_LOG_ALWAYS, ("ChildView namesOfPromisedFilesDroppedAtDestination: entering callback for promised files\n")); + MOZ_LOG(sCocoaLog, LogLevel::Info, ("ChildView namesOfPromisedFilesDroppedAtDestination: entering callback for promised files\n")); nsCOMPtr targFile; NS_NewLocalFile(EmptyString(), true, getter_AddRefs(targFile)); diff --git a/widget/cocoa/nsClipboard.mm b/widget/cocoa/nsClipboard.mm index 9f4cb5cd1b..14cb39ae53 100644 --- a/widget/cocoa/nsClipboard.mm +++ b/widget/cocoa/nsClipboard.mm @@ -24,6 +24,7 @@ using mozilla::gfx::DataSourceSurface; using mozilla::gfx::SourceSurface; +using mozilla::LogLevel; using mozilla::RefPtr; // Screenshots use the (undocumented) png pasteboard type. @@ -415,7 +416,7 @@ nsClipboard::PasteboardDictFromTransferable(nsITransferable* aTransferable) nsXPIDLCString flavorStr; currentFlavor->ToString(getter_Copies(flavorStr)); - PR_LOG(sCocoaLog, PR_LOG_ALWAYS, ("writing out clipboard data of type %s (%d)\n", flavorStr.get(), i)); + MOZ_LOG(sCocoaLog, LogLevel::Info, ("writing out clipboard data of type %s (%d)\n", flavorStr.get(), i)); NSString *pboardType = nil; diff --git a/widget/cocoa/nsDragService.mm b/widget/cocoa/nsDragService.mm index 2df28a7621..e87f9825b4 100644 --- a/widget/cocoa/nsDragService.mm +++ b/widget/cocoa/nsDragService.mm @@ -366,7 +366,7 @@ nsDragService::GetData(nsITransferable* aTransferable, uint32_t aItemIndex) nsXPIDLCString flavorStr; currentFlavor->ToString(getter_Copies(flavorStr)); - PR_LOG(sCocoaLog, PR_LOG_ALWAYS, ("nsDragService::GetData: looking for clipboard data of type %s\n", flavorStr.get())); + MOZ_LOG(sCocoaLog, LogLevel::Info, ("nsDragService::GetData: looking for clipboard data of type %s\n", flavorStr.get())); if (flavorStr.EqualsLiteral(kFileMime)) { NSArray* pFiles = [globalDragPboard propertyListForType:NSFilenamesPboardType]; diff --git a/widget/gtk/nsDeviceContextSpecG.cpp b/widget/gtk/nsDeviceContextSpecG.cpp index 986d473e5b..6e9596f487 100644 --- a/widget/gtk/nsDeviceContextSpecG.cpp +++ b/widget/gtk/nsDeviceContextSpecG.cpp @@ -42,7 +42,7 @@ GetDeviceContextSpecGTKLog() return sLog; } /* Macro to make lines shorter */ -#define DO_PR_DEBUG_LOG(x) PR_LOG(GetDeviceContextSpecGTKLog(), PR_LOG_DEBUG, x) +#define DO_PR_DEBUG_LOG(x) MOZ_LOG(GetDeviceContextSpecGTKLog(), mozilla::LogLevel::Debug, x) //---------------------------------------------------------------------------------- // The printer data is shared between the PrinterEnumerator and the nsDeviceContextSpecGTK diff --git a/widget/gtk/nsDragService.cpp b/widget/gtk/nsDragService.cpp index ce2af51162..4934b537f7 100644 --- a/widget/gtk/nsDragService.cpp +++ b/widget/gtk/nsDragService.cpp @@ -127,7 +127,7 @@ nsDragService::nsDragService() // set up our logging module if (!sDragLm) sDragLm = PR_NewLogModule("nsDragService"); - PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::nsDragService")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::nsDragService")); mCanDrop = false; mTargetDragDataReceived = false; mTargetDragData = 0; @@ -136,7 +136,7 @@ nsDragService::nsDragService() nsDragService::~nsDragService() { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::~nsDragService")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::~nsDragService")); if (mTaskSource) g_source_remove(mTaskSource); @@ -160,7 +160,7 @@ nsDragService::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData) { if (!nsCRT::strcmp(aTopic, "quit-application")) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::Observe(\"quit-application\")")); if (mHiddenWidget) { gtk_widget_destroy(mHiddenWidget); @@ -296,7 +296,7 @@ nsDragService::InvokeDragSession(nsIDOMNode *aDOMNode, nsIScriptableRegion * aRegion, uint32_t aActionType) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::InvokeDragSession")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::InvokeDragSession")); // If the previous source drag has not yet completed, signal handlers need // to be removed from sGrabWidget and dragend needs to be dispatched to @@ -457,14 +457,14 @@ nsDragService::SetAlphaPixmap(SourceSurface *aSurface, NS_IMETHODIMP nsDragService::StartDragSession() { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::StartDragSession")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::StartDragSession")); return nsBaseDragService::StartDragSession(); } NS_IMETHODIMP nsDragService::EndDragSession(bool aDoneDrag) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::EndDragSession %d", + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::EndDragSession %d", aDoneDrag)); if (sGrabWidget) { @@ -496,7 +496,7 @@ nsDragService::EndDragSession(bool aDoneDrag) NS_IMETHODIMP nsDragService::SetCanDrop(bool aCanDrop) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::SetCanDrop %d", + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::SetCanDrop %d", aCanDrop)); mCanDrop = aCanDrop; return NS_OK; @@ -505,7 +505,7 @@ nsDragService::SetCanDrop(bool aCanDrop) NS_IMETHODIMP nsDragService::GetCanDrop(bool *aCanDrop) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::GetCanDrop")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::GetCanDrop")); *aCanDrop = mCanDrop; return NS_OK; } @@ -580,10 +580,10 @@ GetTextUriListItem(const char *data, NS_IMETHODIMP nsDragService::GetNumDropItems(uint32_t * aNumItems) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::GetNumDropItems")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::GetNumDropItems")); if (!mTargetWidget) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("*** warning: GetNumDropItems \ called without a valid target widget!\n")); *aNumItems = 0; @@ -602,7 +602,7 @@ nsDragService::GetNumDropItems(uint32_t * aNumItems) } else *aNumItems = 1; } - PR_LOG(sDragLm, PR_LOG_DEBUG, ("%d items", *aNumItems)); + MOZ_LOG(sDragLm, LogLevel::Debug, ("%d items", *aNumItems)); return NS_OK; } @@ -611,14 +611,14 @@ NS_IMETHODIMP nsDragService::GetData(nsITransferable * aTransferable, uint32_t aItemIndex) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::GetData %d", aItemIndex)); + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::GetData %d", aItemIndex)); // make sure that we have a transferable if (!aTransferable) return NS_ERROR_INVALID_ARG; if (!mTargetWidget) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("*** warning: GetData \ called without a valid target widget!\n")); return NS_ERROR_FAILURE; @@ -642,7 +642,7 @@ nsDragService::GetData(nsITransferable * aTransferable, bool isList = IsTargetContextList(); if (isList) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("it's a list...")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("it's a list...")); // find a matching flavor for (i = 0; i < cnt; ++i) { nsCOMPtr genericWrapper; @@ -654,8 +654,8 @@ nsDragService::GetData(nsITransferable * aTransferable, nsXPIDLCString flavorStr; currentFlavor->ToString(getter_Copies(flavorStr)); - PR_LOG(sDragLm, - PR_LOG_DEBUG, + MOZ_LOG(sDragLm, + LogLevel::Debug, ("flavor is %s\n", (const char *)flavorStr)); // get the item with the right index nsCOMPtr genericItem; @@ -667,21 +667,21 @@ nsDragService::GetData(nsITransferable * aTransferable, nsCOMPtr data; uint32_t tmpDataLen = 0; - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("trying to get transfer data for %s\n", (const char *)flavorStr)); rv = item->GetTransferData(flavorStr, getter_AddRefs(data), &tmpDataLen); if (NS_FAILED(rv)) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("failed.\n")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("failed.\n")); continue; } - PR_LOG(sDragLm, PR_LOG_DEBUG, ("succeeded.\n")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("succeeded.\n")); rv = aTransferable->SetTransferData(flavorStr,data,tmpDataLen); if (NS_FAILED(rv)) { - PR_LOG(sDragLm, - PR_LOG_DEBUG, + MOZ_LOG(sDragLm, + LogLevel::Debug, ("fail to set transfer data into transferable!\n")); continue; } @@ -705,7 +705,7 @@ nsDragService::GetData(nsITransferable * aTransferable, nsXPIDLCString flavorStr; currentFlavor->ToString(getter_Copies(flavorStr)); GdkAtom gdkFlavor = gdk_atom_intern(flavorStr, FALSE); - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("looking for data in type %s, gdk flavor %ld\n", static_cast(flavorStr), gdkFlavor)); bool dataFound = false; @@ -713,11 +713,11 @@ nsDragService::GetData(nsITransferable * aTransferable, GetTargetDragData(gdkFlavor); } if (mTargetDragData) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = true\n")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("dataFound = true\n")); dataFound = true; } else { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = false\n")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("dataFound = false\n")); // Dragging and dropping from the file manager would cause us // to parse the source text as a nsIFile URL. @@ -769,13 +769,13 @@ nsDragService::GetData(nsITransferable * aTransferable, // on the clipboard first, try again with text/plain. If that // is present, convert it to unicode. if ( strcmp(flavorStr, kUnicodeMime) == 0 ) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("we were looking for text/unicode... \ trying with text/plain;charset=utf-8\n")); gdkFlavor = gdk_atom_intern(gTextPlainUTF8Type, FALSE); GetTargetDragData(gdkFlavor); if (mTargetDragData) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("Got textplain data\n")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("Got textplain data\n")); const char* castedText = reinterpret_cast(mTargetDragData); char16_t* convertedText = nullptr; @@ -783,7 +783,7 @@ nsDragService::GetData(nsITransferable * aTransferable, mTargetDragDataLen); convertedText = ToNewUnicode(ucs2string); if ( convertedText ) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("successfully converted plain text \ to unicode.\n")); // out with the old, in with the new @@ -793,13 +793,13 @@ nsDragService::GetData(nsITransferable * aTransferable, dataFound = true; } // if plain text data on clipboard } else { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("we were looking for text/unicode... \ trying again with text/plain\n")); gdkFlavor = gdk_atom_intern(kTextMime, FALSE); GetTargetDragData(gdkFlavor); if (mTargetDragData) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("Got textplain data\n")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("Got textplain data\n")); const char* castedText = reinterpret_cast(mTargetDragData); char16_t* convertedText = nullptr; @@ -808,7 +808,7 @@ nsDragService::GetData(nsITransferable * aTransferable, castedText, mTargetDragDataLen, &convertedText, &convertedTextLen); if ( convertedText ) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("successfully converted plain text \ to unicode.\n")); // out with the old, in with the new @@ -825,13 +825,13 @@ nsDragService::GetData(nsITransferable * aTransferable, // it on the clipboard, try again with text/uri-list, and then // _NETSCAPE_URL if (strcmp(flavorStr, kURLMime) == 0) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("we were looking for text/x-moz-url...\ trying again with text/uri-list\n")); gdkFlavor = gdk_atom_intern(gTextUriListType, FALSE); GetTargetDragData(gdkFlavor); if (mTargetDragData) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("Got text/uri-list data\n")); const char *data = reinterpret_cast(mTargetDragData); @@ -842,7 +842,7 @@ nsDragService::GetData(nsITransferable * aTransferable, &convertedText, &convertedTextLen); if ( convertedText ) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("successfully converted \ _NETSCAPE_URL to unicode.\n")); // out with the old, in with the new @@ -853,17 +853,17 @@ nsDragService::GetData(nsITransferable * aTransferable, } } else { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("failed to get text/uri-list data\n")); } if (!dataFound) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("we were looking for text/x-moz-url...\ trying again with _NETSCAP_URL\n")); gdkFlavor = gdk_atom_intern(gMozUrlType, FALSE); GetTargetDragData(gdkFlavor); if (mTargetDragData) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("Got _NETSCAPE_URL data\n")); const char* castedText = reinterpret_cast(mTargetDragData); @@ -871,8 +871,8 @@ nsDragService::GetData(nsITransferable * aTransferable, int32_t convertedTextLen = 0; nsPrimitiveHelpers::ConvertPlatformPlainTextToUnicode(castedText, mTargetDragDataLen, &convertedText, &convertedTextLen); if ( convertedText ) { - PR_LOG(sDragLm, - PR_LOG_DEBUG, + MOZ_LOG(sDragLm, + LogLevel::Debug, ("successfully converted _NETSCAPE_URL \ to unicode.\n")); // out with the old, in with the new @@ -883,7 +883,7 @@ nsDragService::GetData(nsITransferable * aTransferable, } } else { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("failed to get _NETSCAPE_URL data\n")); } } @@ -908,7 +908,7 @@ nsDragService::GetData(nsITransferable * aTransferable, genericDataWrapper, mTargetDragDataLen); // we found one, get out of this loop! - PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound and converted!\n")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("dataFound and converted!\n")); break; } } // if (currentFlavor) @@ -922,7 +922,7 @@ NS_IMETHODIMP nsDragService::IsDataFlavorSupported(const char *aDataFlavor, bool *_retval) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::IsDataFlavorSupported %s", + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::IsDataFlavorSupported %s", aDataFlavor)); if (!_retval) return NS_ERROR_INVALID_ARG; @@ -932,7 +932,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor, // check to make sure that we have a drag object set, here if (!mTargetWidget) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("*** warning: IsDataFlavorSupported \ called without a valid target widget!\n")); return NS_OK; @@ -943,7 +943,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor, // if it is, just look in the internal data since we are the source // for it. if (isList) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("It's a list..")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("It's a list..")); uint32_t numDragItems = 0; // if we don't have mDataItems we didn't start this drag so it's // an external client trying to fool us. @@ -973,11 +973,11 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor, if (currentFlavor) { nsXPIDLCString flavorStr; currentFlavor->ToString(getter_Copies(flavorStr)); - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("checking %s against %s\n", (const char *)flavorStr, aDataFlavor)); if (strcmp(flavorStr, aDataFlavor) == 0) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("boioioioiooioioioing!\n")); *_retval = true; } @@ -997,10 +997,10 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor, GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data); gchar *name = nullptr; name = gdk_atom_name(atom); - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("checking %s against %s\n", name, aDataFlavor)); if (name && (strcmp(name, aDataFlavor) == 0)) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("good!\n")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("good!\n")); *_retval = true; } // check for automatic text/uri-list -> text/x-moz-url mapping @@ -1009,7 +1009,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor, (strcmp(name, gTextUriListType) == 0) && (strcmp(aDataFlavor, kURLMime) == 0 || strcmp(aDataFlavor, kFileMime) == 0)) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("good! ( it's text/uri-list and \ we're checking against text/x-moz-url )\n")); *_retval = true; @@ -1019,7 +1019,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor, name && (strcmp(name, gMozUrlType) == 0) && (strcmp(aDataFlavor, kURLMime) == 0)) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("good! ( it's _NETSCAPE_URL and \ we're checking against text/x-moz-url )\n")); *_retval = true; @@ -1030,7 +1030,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor, (strcmp(name, kTextMime) == 0) && ((strcmp(aDataFlavor, kUnicodeMime) == 0) || (strcmp(aDataFlavor, kFileMime) == 0))) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("good! ( it's text plain and we're checking \ against text/unicode or application/x-moz-file)\n")); *_retval = true; @@ -1043,7 +1043,7 @@ nsDragService::IsDataFlavorSupported(const char *aDataFlavor, void nsDragService::ReplyToDragMotion(GdkDragContext* aDragContext) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::ReplyToDragMotion %d", mCanDrop)); GdkDragAction action = (GdkDragAction)0; @@ -1077,7 +1077,7 @@ nsDragService::TargetDataReceived(GtkWidget *aWidget, guint aInfo, guint32 aTime) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::TargetDataReceived")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::TargetDataReceived")); TargetResetData(); mTargetDragDataReceived = true; gint len = gtk_selection_data_get_length(aSelectionData); @@ -1088,7 +1088,7 @@ nsDragService::TargetDataReceived(GtkWidget *aWidget, memcpy(mTargetDragData, data, mTargetDragDataLen); } else { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("Failed to get data. selection data len was %d\n", mTargetDragDataLen)); } @@ -1131,24 +1131,24 @@ nsDragService::IsTargetContextList(void) void nsDragService::GetTargetDragData(GdkAtom aFlavor) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("getting data flavor %d\n", aFlavor)); - PR_LOG(sDragLm, PR_LOG_DEBUG, ("mLastWidget is %p and mLastContext is %p\n", + MOZ_LOG(sDragLm, LogLevel::Debug, ("getting data flavor %d\n", aFlavor)); + MOZ_LOG(sDragLm, LogLevel::Debug, ("mLastWidget is %p and mLastContext is %p\n", mTargetWidget.get(), mTargetDragContext.get())); // reset our target data areas TargetResetData(); gtk_drag_get_data(mTargetWidget, mTargetDragContext, aFlavor, mTargetTime); - PR_LOG(sDragLm, PR_LOG_DEBUG, ("about to start inner iteration.")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("about to start inner iteration.")); PRTime entryTime = PR_Now(); while (!mTargetDragDataReceived && mDoingDrag) { // check the number of iterations - PR_LOG(sDragLm, PR_LOG_DEBUG, ("doing iteration...\n")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("doing iteration...\n")); PR_Sleep(20*PR_TicksPerSecond()/1000); /* sleep for 20 ms/iteration */ if (PR_Now()-entryTime > NS_DND_TIMEOUT) break; gtk_main_iteration(); } - PR_LOG(sDragLm, PR_LOG_DEBUG, ("finished inner iteration\n")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("finished inner iteration\n")); } void @@ -1186,7 +1186,7 @@ nsDragService::GetSourceList(void) (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry)); listTarget->target = g_strdup(gMimeListType); listTarget->flags = 0; - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("automatically adding target %s\n", listTarget->target)); targetArray.AppendElement(listTarget); @@ -1222,7 +1222,7 @@ nsDragService::GetSourceList(void) (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry)); listTarget->target = g_strdup(gTextUriListType); listTarget->flags = 0; - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("automatically adding target %s\n", listTarget->target)); targetArray.AppendElement(listTarget); @@ -1256,7 +1256,7 @@ nsDragService::GetSourceList(void) (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry)); target->target = g_strdup(flavorStr); target->flags = 0; - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("adding target %s\n", target->target)); targetArray.AppendElement(target); // Check to see if this is text/unicode. @@ -1268,7 +1268,7 @@ nsDragService::GetSourceList(void) (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry)); plainUTF8Target->target = g_strdup(gTextPlainUTF8Type); plainUTF8Target->flags = 0; - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("automatically adding target %s\n", plainUTF8Target->target)); targetArray.AppendElement(plainUTF8Target); @@ -1277,7 +1277,7 @@ nsDragService::GetSourceList(void) (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry)); plainTarget->target = g_strdup(kTextMime); plainTarget->flags = 0; - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("automatically adding target %s\n", plainTarget->target)); targetArray.AppendElement(plainTarget); @@ -1290,7 +1290,7 @@ nsDragService::GetSourceList(void) (GtkTargetEntry *)g_malloc(sizeof(GtkTargetEntry)); urlTarget->target = g_strdup(gMozUrlType); urlTarget->flags = 0; - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("automatically adding target %s\n", urlTarget->target)); targetArray.AppendElement(urlTarget); @@ -1467,23 +1467,23 @@ nsDragService::SourceDataGet(GtkWidget *aWidget, GtkSelectionData *aSelectionData, guint32 aTime) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::SourceDataGet")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService::SourceDataGet")); GdkAtom target = gtk_selection_data_get_target(aSelectionData); nsXPIDLCString mimeFlavor; gchar *typeName = 0; typeName = gdk_atom_name(target); if (!typeName) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("failed to get atom name.\n")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("failed to get atom name.\n")); return; } - PR_LOG(sDragLm, PR_LOG_DEBUG, ("Type is %s\n", typeName)); + MOZ_LOG(sDragLm, LogLevel::Debug, ("Type is %s\n", typeName)); // make a copy since |nsXPIDLCString| won't use |g_free|... mimeFlavor.Adopt(strdup(typeName)); g_free(typeName); // check to make sure that we have data items to return. if (!mSourceDataItems) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("Failed to get our data items\n")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("Failed to get our data items\n")); return; } @@ -1628,7 +1628,7 @@ invisibleSourceDragBegin(GtkWidget *aWidget, GdkDragContext *aContext, gpointer aData) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("invisibleSourceDragBegin")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("invisibleSourceDragBegin")); nsDragService *dragService = (nsDragService *)aData; dragService->SetDragIcon(aContext); @@ -1642,7 +1642,7 @@ invisibleSourceDragDataGet(GtkWidget *aWidget, guint32 aTime, gpointer aData) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("invisibleSourceDragDataGet")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("invisibleSourceDragDataGet")); nsDragService *dragService = (nsDragService *)aData; dragService->SourceDataGet(aWidget, aContext, aSelectionData, aTime); @@ -1654,7 +1654,7 @@ invisibleSourceDragFailed(GtkWidget *aWidget, gint aResult, gpointer aData) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("invisibleSourceDragFailed %i", aResult)); + MOZ_LOG(sDragLm, LogLevel::Debug, ("invisibleSourceDragFailed %i", aResult)); nsDragService *dragService = (nsDragService *)aData; // End the drag session now (rather than waiting for the drag-end signal) // so that operations performed on dropEffect == none can start immediately @@ -1672,7 +1672,7 @@ invisibleSourceDragEnd(GtkWidget *aWidget, GdkDragContext *aContext, gpointer aData) { - PR_LOG(sDragLm, PR_LOG_DEBUG, ("invisibleSourceDragEnd")); + MOZ_LOG(sDragLm, LogLevel::Debug, ("invisibleSourceDragEnd")); nsDragService *dragService = (nsDragService *)aData; // The drag has ended. Release the hostages! @@ -1816,7 +1816,7 @@ gboolean nsDragService::RunScheduledTask() { if (mTargetWindow && mTargetWindow != mPendingWindow) { - PR_LOG(sDragLm, PR_LOG_DEBUG, + MOZ_LOG(sDragLm, LogLevel::Debug, ("nsDragService: dispatch drag leave (%p)\n", mTargetWindow.get())); mTargetWindow-> diff --git a/widget/gtk/nsGtkIMModule.cpp b/widget/gtk/nsGtkIMModule.cpp index f21660c2b8..b1228abb94 100644 --- a/widget/gtk/nsGtkIMModule.cpp +++ b/widget/gtk/nsGtkIMModule.cpp @@ -134,7 +134,7 @@ nsGtkIMModule::nsGtkIMModule(nsWindow* aOwnerWindow) void nsGtkIMModule::Init() { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): Init, mOwnerWindow=%p", this, mOwnerWindow)); @@ -201,14 +201,14 @@ nsGtkIMModule::~nsGtkIMModule() if (this == sLastFocusedModule) { sLastFocusedModule = nullptr; } - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p) was gone", this)); } void nsGtkIMModule::OnDestroyWindow(nsWindow* aWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnDestroyWindow, aWindow=%p, mLastFocusedWindow=%p, mOwnerWindow=%p, mLastFocusedModule=%p", this, aWindow, mLastFocusedWindow, mOwnerWindow, sLastFocusedModule)); @@ -268,7 +268,7 @@ nsGtkIMModule::OnDestroyWindow(nsWindow* aWindow) mLastFocusedWindow = nullptr; mInputContext.mIMEState.mEnabled = IMEState::DISABLED; - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" SUCCEEDED, Completely destroyed")); } @@ -321,7 +321,7 @@ nsGtkIMModule::OnFocusWindow(nsWindow* aWindow) return; } - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnFocusWindow, aWindow=%p, mLastFocusedWindow=%p", this, aWindow, mLastFocusedWindow)); mLastFocusedWindow = aWindow; @@ -335,7 +335,7 @@ nsGtkIMModule::OnBlurWindow(nsWindow* aWindow) return; } - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnBlurWindow, aWindow=%p, mLastFocusedWindow=%p, " "mIsIMFocused=%s", this, aWindow, mLastFocusedWindow, GetBoolName(mIsIMFocused))); @@ -358,7 +358,7 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent, return false; } - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnKeyEvent, aCaller=%p, aKeyDownEventWasSent=%s, " "mCompositionState=%s, current context=%p, active context=%p, " "aEvent(%p): { type=%s, keyval=%s, unicode=0x%X }", @@ -368,7 +368,7 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent, gdk_keyval_to_unicode(aEvent->keyval))); if (aCaller != mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, the caller isn't focused window, mLastFocusedWindow=%p", mLastFocusedWindow)); return false; @@ -378,7 +378,7 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent, // current context since the user expects so. GtkIMContext* currentContext = GetCurrentContext(); if (MOZ_UNLIKELY(!currentContext)) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there are no context")); return false; } @@ -421,7 +421,7 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent, } } - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" filterThisEvent=%s (isFiltered=%s, mFilterKeyEvent=%s), " "mCompositionState=%s", GetBoolName(filterThisEvent), GetBoolName(isFiltered), @@ -433,7 +433,7 @@ nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent, void nsGtkIMModule::OnFocusChangeInGecko(bool aFocus) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnFocusChangeInGecko, aFocus=%s, " "mCompositionState=%s, mIsIMFocused=%s", this, GetBoolName(aFocus), GetCompositionStateName(), @@ -447,13 +447,13 @@ nsGtkIMModule::OnFocusChangeInGecko(bool aFocus) void nsGtkIMModule::ResetIME() { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): ResetIME, mCompositionState=%s, mIsIMFocused=%s", this, GetCompositionStateName(), GetBoolName(mIsIMFocused))); GtkIMContext* activeContext = GetActiveContext(); if (MOZ_UNLIKELY(!activeContext)) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there are no context")); return; } @@ -474,7 +474,7 @@ nsGtkIMModule::ResetIME() nsAutoString compositionString; GetCompositionString(activeContext, compositionString); - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): ResetIME() called gtk_im_context_reset(), " "activeContext=%p, mCompositionState=%s, compositionString=%s, " "mIsIMFocused=%s", @@ -500,13 +500,13 @@ nsGtkIMModule::EndIMEComposition(nsWindow* aCaller) return NS_OK; } - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): EndIMEComposition, aCaller=%p, " "mCompositionState=%s", this, aCaller, GetCompositionStateName())); if (aCaller != mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" WARNING: the caller isn't focused window, mLastFocusedWindow=%p", mLastFocusedWindow)); return NS_OK; @@ -563,20 +563,20 @@ nsGtkIMModule::SetInputContext(nsWindow* aCaller, return; } - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): SetInputContext, aCaller=%p, aState=%s mHTMLInputType=%s", this, aCaller, GetEnabledStateName(aContext->mIMEState.mEnabled), NS_ConvertUTF16toUTF8(aContext->mHTMLInputType).get())); if (aCaller != mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, the caller isn't focused window, mLastFocusedWindow=%p", mLastFocusedWindow)); return; } if (!mContext) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there are no context")); return; } @@ -584,7 +584,7 @@ nsGtkIMModule::SetInputContext(nsWindow* aCaller, if (sLastFocusedModule != this) { mInputContext = *aContext; - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" SUCCEEDED, but we're not active")); return; } @@ -697,7 +697,7 @@ nsGtkIMModule::IsEnabled() const void nsGtkIMModule::Focus() { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): Focus, sLastFocusedModule=%p", this, sLastFocusedModule)); @@ -709,7 +709,7 @@ nsGtkIMModule::Focus() GtkIMContext* currentContext = GetCurrentContext(); if (!currentContext) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there are no context")); return; } @@ -733,7 +733,7 @@ nsGtkIMModule::Focus() void nsGtkIMModule::Blur() { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): Blur, mIsIMFocused=%s", this, GetBoolName(mIsIMFocused))); @@ -743,7 +743,7 @@ nsGtkIMModule::Blur() GtkIMContext* currentContext = GetCurrentContext(); if (!currentContext) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there are no context")); return; } @@ -762,14 +762,14 @@ nsGtkIMModule::OnSelectionChange(nsWindow* aCaller, return; } - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnSelectionChange(aCaller=0x%p), " "mCompositionState=%s, mIsDeletingSurrounding=%s", this, aCaller, GetCompositionStateName(), mIsDeletingSurrounding ? "true" : "false")); if (aCaller != mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" WARNING: the caller isn't focused window, " "mLastFocusedWindow=%p", mLastFocusedWindow)); @@ -782,13 +782,13 @@ nsGtkIMModule::OnSelectionChange(nsWindow* aCaller, // we should ignore selection change notification. if (mCompositionState == eCompositionState_CompositionStartDispatched) { if (NS_WARN_IF(!mSelection.IsValid())) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" ERROR: new offset is too large, cannot keep composing")); } else { // Modify the selection start offset with new offset. mCompositionStart = mSelection.mOffset; // XXX We should modify mSelectedString? But how? - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" NOTE: mCompositionStart is updated to %u, " "the selection change doesn't cause resetting IM context", mCompositionStart)); @@ -818,14 +818,14 @@ nsGtkIMModule::OnStartCompositionCallback(GtkIMContext *aContext, void nsGtkIMModule::OnStartCompositionNative(GtkIMContext *aContext) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnStartCompositionNative, aContext=%p, " "current context=%p", this, aContext, GetCurrentContext())); // See bug 472635, we should do nothing if IM context doesn't match. if (GetCurrentContext() != aContext) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, given context doesn't match")); return; } @@ -849,7 +849,7 @@ nsGtkIMModule::OnEndCompositionCallback(GtkIMContext *aContext, void nsGtkIMModule::OnEndCompositionNative(GtkIMContext *aContext) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnEndCompositionNative, aContext=%p", this, aContext)); @@ -857,7 +857,7 @@ nsGtkIMModule::OnEndCompositionNative(GtkIMContext *aContext) // Note that if this is called after focus move, the context may different // from any our owning context. if (!IsValidContext(aContext)) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, given context doesn't match with any context")); return; } @@ -885,7 +885,7 @@ nsGtkIMModule::OnChangeCompositionCallback(GtkIMContext *aContext, void nsGtkIMModule::OnChangeCompositionNative(GtkIMContext *aContext) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnChangeCompositionNative, aContext=%p", this, aContext)); @@ -893,7 +893,7 @@ nsGtkIMModule::OnChangeCompositionNative(GtkIMContext *aContext) // Note that if this is called after focus move, the context may different // from any our owning context. if (!IsValidContext(aContext)) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, given context doesn't match with any context")); return; } @@ -920,14 +920,14 @@ nsGtkIMModule::OnRetrieveSurroundingCallback(GtkIMContext *aContext, gboolean nsGtkIMModule::OnRetrieveSurroundingNative(GtkIMContext *aContext) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnRetrieveSurroundingNative, aContext=%p, " "current context=%p", this, aContext, GetCurrentContext())); // See bug 472635, we should do nothing if IM context doesn't match. if (GetCurrentContext() != aContext) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, given context doesn't match")); return FALSE; } @@ -961,14 +961,14 @@ nsGtkIMModule::OnDeleteSurroundingNative(GtkIMContext *aContext, gint aOffset, gint aNChars) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnDeleteSurroundingNative, aContext=%p, " "current context=%p", this, aContext, GetCurrentContext())); // See bug 472635, we should do nothing if IM context doesn't match. if (GetCurrentContext() != aContext) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, given context doesn't match")); return FALSE; } @@ -980,7 +980,7 @@ nsGtkIMModule::OnDeleteSurroundingNative(GtkIMContext *aContext, } // failed - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, cannot delete text")); return FALSE; } @@ -1001,7 +1001,7 @@ nsGtkIMModule::OnCommitCompositionNative(GtkIMContext *aContext, const gchar emptyStr = 0; const gchar *commitString = aUTF8Char ? aUTF8Char : &emptyStr; - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnCommitCompositionNative, aContext=%p, " "current context=%p, active context=%p, commitString=\"%s\", " "mProcessingKeyEvent=%p, IsComposingOn(aContext)=%s", @@ -1010,7 +1010,7 @@ nsGtkIMModule::OnCommitCompositionNative(GtkIMContext *aContext, // See bug 472635, we should do nothing if IM context doesn't match. if (!IsValidContext(aContext)) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, given context doesn't match")); return; } @@ -1040,7 +1040,7 @@ nsGtkIMModule::OnCommitCompositionNative(GtkIMContext *aContext, keyval_utf8[keyval_utf8_len] = '\0'; if (!strcmp(commitString, keyval_utf8)) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): OnCommitCompositionNative, we'll send normal key event", this)); mFilterKeyEvent = false; @@ -1068,7 +1068,7 @@ nsGtkIMModule::GetCompositionString(GtkIMContext* aContext, aCompositionString.Truncate(); } - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): GetCompositionString, result=\"%s\"", this, preedit_string)); @@ -1079,24 +1079,24 @@ nsGtkIMModule::GetCompositionString(GtkIMContext* aContext, bool nsGtkIMModule::DispatchCompositionStart(GtkIMContext* aContext) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): DispatchCompositionStart, aContext=%p", this, aContext)); if (IsComposing()) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" WARNING, we're already in composition")); return true; } if (!mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there are no focused window in this module")); return false; } if (NS_WARN_IF(!EnsureToCacheSelection())) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, cannot query the selection offset")); return false; } @@ -1116,17 +1116,17 @@ nsGtkIMModule::DispatchCompositionStart(GtkIMContext* aContext) bool isCancelled; mLastFocusedWindow->DispatchKeyDownEvent(mProcessingKeyEvent, &isCancelled); - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" keydown event is dispatched")); if (static_cast(kungFuDeathGrip.get())->IsDestroyed() || kungFuDeathGrip != mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" NOTE, the focused widget was destroyed/changed by keydown event")); return false; } } - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" mCompositionStart=%u", mCompositionStart)); mCompositionState = eCompositionState_CompositionStartDispatched; WidgetCompositionEvent compEvent(true, NS_COMPOSITION_START, @@ -1137,7 +1137,7 @@ nsGtkIMModule::DispatchCompositionStart(GtkIMContext* aContext) mLastFocusedWindow->DispatchEvent(&compEvent, status); if (static_cast(kungFuDeathGrip.get())->IsDestroyed() || kungFuDeathGrip != mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" NOTE, the focused widget was destroyed/changed by compositionstart event")); return false; } @@ -1150,18 +1150,18 @@ nsGtkIMModule::DispatchCompositionChangeEvent( GtkIMContext* aContext, const nsAString& aCompositionString) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): DispatchCompositionChangeEvent, aContext=%p", this, aContext)); if (!mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there are no focused window in this module")); return false; } if (!IsComposing()) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" The composition wasn't started, force starting...")); nsCOMPtr kungFuDeathGrip = mLastFocusedWindow; if (!DispatchCompositionStart(aContext)) { @@ -1210,7 +1210,7 @@ nsGtkIMModule::DispatchCompositionChangeEvent( mLastFocusedWindow->DispatchEvent(&compositionChangeEvent, status); if (lastFocusedWindow->IsDestroyed() || lastFocusedWindow != mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" NOTE, the focused widget was destroyed/changed by " "compositionchange event")); return false; @@ -1223,26 +1223,26 @@ nsGtkIMModule::DispatchCompositionCommitEvent( GtkIMContext* aContext, const nsAString* aCommitString) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): DispatchCompositionCommitEvent, aContext=%p, " "aCommitString=%p, (\"%s\")", this, aContext, aCommitString, aCommitString ? NS_ConvertUTF16toUTF8(*aCommitString).get() : "")); if (!mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there are no focused window in this module")); return false; } if (!IsComposing()) { if (!aCommitString || aCommitString->IsEmpty()) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there is no composition and empty commit " "string")); return true; } - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" The composition wasn't started, force starting...")); nsCOMPtr kungFuDeathGrip(mLastFocusedWindow); if (!DispatchCompositionStart(aContext)) { @@ -1271,7 +1271,7 @@ nsGtkIMModule::DispatchCompositionCommitEvent( if (lastFocusedWindow->IsDestroyed() || lastFocusedWindow != mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" NOTE, the focused widget was destroyed/changed by " "compositioncommit event")); return false; @@ -1284,7 +1284,7 @@ already_AddRefed nsGtkIMModule::CreateTextRangeArray(GtkIMContext* aContext, const nsAString& aLastDispatchedData) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): CreateTextRangeArray, aContext=%p, " "aLastDispatchedData=\"%s\" (length=%u)", this, aContext, NS_ConvertUTF16toUTF8(aLastDispatchedData).get(), @@ -1298,7 +1298,7 @@ nsGtkIMModule::CreateTextRangeArray(GtkIMContext* aContext, gtk_im_context_get_preedit_string(aContext, &preedit_string, &feedback_list, &cursor_pos); if (!preedit_string || !*preedit_string) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" preedit_string is null")); pango_attr_list_unref(feedback_list); g_free(preedit_string); @@ -1308,7 +1308,7 @@ nsGtkIMModule::CreateTextRangeArray(GtkIMContext* aContext, PangoAttrIterator* iter; iter = pango_attr_list_get_iterator(feedback_list); if (!iter) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, iterator couldn't be allocated")); pango_attr_list_unref(feedback_list); g_free(preedit_string); @@ -1380,7 +1380,7 @@ nsGtkIMModule::CreateTextRangeArray(GtkIMContext* aContext, textRangeArray->AppendElement(range); - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" mStartOffset=%u, mEndOffset=%u, mRangeType=%s", range.mStartOffset, range.mEndOffset, GetRangeTypeName(range.mRangeType))); @@ -1398,7 +1398,7 @@ nsGtkIMModule::CreateTextRangeArray(GtkIMContext* aContext, range.mRangeType = NS_TEXTRANGE_CARETPOSITION; textRangeArray->AppendElement(range); - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" mStartOffset=%u, mEndOffset=%u, mRangeType=%s", range.mStartOffset, range.mEndOffset, GetRangeTypeName(range.mRangeType))); @@ -1414,24 +1414,24 @@ void nsGtkIMModule::SetCursorPosition(GtkIMContext* aContext, uint32_t aTargetOffset) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): SetCursorPosition, aContext=%p, aTargetOffset=%u", this, aContext, aTargetOffset)); if (aTargetOffset == UINT32_MAX) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, aTargetOffset is wrong offset")); return; } if (!mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there are no focused window")); return; } if (MOZ_UNLIKELY(!aContext)) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there are no context")); return; } @@ -1443,7 +1443,7 @@ nsGtkIMModule::SetCursorPosition(GtkIMContext* aContext, nsEventStatus status; mLastFocusedWindow->DispatchEvent(&charRect, status); if (!charRect.mSucceeded) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, NS_QUERY_TEXT_RECT was failed")); return; } @@ -1471,12 +1471,12 @@ nsGtkIMModule::SetCursorPosition(GtkIMContext* aContext, nsresult nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): GetCurrentParagraph, mCompositionState=%s", this, GetCompositionStateName())); if (!mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there are no focused window in this module")); return NS_ERROR_NULL_POINTER; } @@ -1491,7 +1491,7 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) if (!EditorHasCompositionString()) { // Query cursor position & selection if (NS_WARN_IF(!EnsureToCacheSelection())) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, due to no valid selection information")); return NS_ERROR_FAILURE; } @@ -1500,7 +1500,7 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) selLength = mSelection.mLength; } - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" selOffset=%u, selLength=%u", selOffset, selLength)); @@ -1509,7 +1509,7 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) // than INT32_MAX. if (selOffset > INT32_MAX || selLength > INT32_MAX || selOffset + selLength > INT32_MAX) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, The selection is out of range")); return NS_ERROR_FAILURE; } @@ -1524,7 +1524,7 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) nsAutoString textContent(queryTextContentEvent.mReply.mString); if (selOffset + selLength > textContent.Length()) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, The selection is invalid, textContent.Length()=%u", textContent.Length())); return NS_ERROR_FAILURE; @@ -1549,7 +1549,7 @@ nsGtkIMModule::GetCurrentParagraph(nsAString& aText, uint32_t& aCursorPos) aText = nsDependentSubstring(textContent, parStart, parEnd - parStart); aCursorPos = selOffset - uint32_t(parStart); - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" aText=%s, aText.Length()=%u, aCursorPos=%u", NS_ConvertUTF16toUTF8(aText).get(), aText.Length(), aCursorPos)); @@ -1562,19 +1562,19 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, int32_t aOffset, uint32_t aNChars) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, ("GtkIMModule(%p): DeleteText, aContext=%p, aOffset=%d, aNChars=%d, " "mCompositionState=%s", this, aContext, aOffset, aNChars, GetCompositionStateName())); if (!mLastFocusedWindow) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there are no focused window in this module")); return NS_ERROR_NULL_POINTER; } if (!aNChars) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, aNChars must not be zero")); return NS_ERROR_INVALID_ARG; } @@ -1590,13 +1590,13 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, if (wasComposing) { selOffset = mCompositionStart; if (!DispatchCompositionCommitEvent(aContext, &mSelectedString)) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, quitting from DeletText")); return NS_ERROR_FAILURE; } } else { if (NS_WARN_IF(!EnsureToCacheSelection())) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, due to no valid selection information")); return NS_ERROR_FAILURE; } @@ -1611,7 +1611,7 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, mLastFocusedWindow->DispatchEvent(&queryTextContentEvent, status); NS_ENSURE_TRUE(queryTextContentEvent.mSucceeded, NS_ERROR_FAILURE); if (queryTextContentEvent.mReply.mString.IsEmpty()) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, there is no contents")); return NS_ERROR_FAILURE; } @@ -1622,7 +1622,7 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, glong offsetInUTF8Characters = g_utf8_strlen(utf8Str.get(), utf8Str.Length()) + aOffset; if (offsetInUTF8Characters < 0) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, aOffset is too small for current cursor pos " "(computed offset: %d)", offsetInUTF8Characters)); @@ -1637,7 +1637,7 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, glong endInUTF8Characters = offsetInUTF8Characters + aNChars; if (countOfCharactersInUTF8 < endInUTF8Characters) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, aNChars is too large for current contents " "(content length: %d, computed end offset: %d)", countOfCharactersInUTF8, endInUTF8Characters)); @@ -1671,7 +1671,7 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, if (!selectionEvent.mSucceeded || lastFocusedWindow != mLastFocusedWindow || lastFocusedWindow->Destroyed()) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, setting selection caused focus change " "or window destroyed")); return NS_ERROR_FAILURE; @@ -1686,7 +1686,7 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, if (!contentCommandEvent.mSucceeded || lastFocusedWindow != mLastFocusedWindow || lastFocusedWindow->Destroyed()) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, deleting the selection caused focus change " "or window destroyed")); return NS_ERROR_FAILURE; @@ -1698,7 +1698,7 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, // Restore the composition at new caret position. if (!DispatchCompositionStart(aContext)) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, resterting composition start")); return NS_ERROR_FAILURE; } @@ -1710,7 +1710,7 @@ nsGtkIMModule::DeleteText(GtkIMContext* aContext, nsAutoString compositionString; GetCompositionString(aContext, compositionString); if (!DispatchCompositionChangeEvent(aContext, compositionString)) { - PR_LOG(gGtkIMLog, PR_LOG_ALWAYS, + MOZ_LOG(gGtkIMLog, LogLevel::Info, (" FAILED, restoring composition string")); return NS_ERROR_FAILURE; } @@ -1737,7 +1737,7 @@ nsGtkIMModule::EnsureToCacheSelection(nsAString* aSelectedString) } if (NS_WARN_IF(!mLastFocusedWindow)) { - PR_LOG(gGtkIMLog, PR_LOG_ERROR, + MOZ_LOG(gGtkIMLog, LogLevel::Error, ("GtkIMModule(%p): EnsureToCacheSelection(), FAILED, due to " "no focused window", this)); return false; @@ -1749,7 +1749,7 @@ nsGtkIMModule::EnsureToCacheSelection(nsAString* aSelectedString) InitEvent(selection); mLastFocusedWindow->DispatchEvent(&selection, status); if (NS_WARN_IF(!selection.mSucceeded)) { - PR_LOG(gGtkIMLog, PR_LOG_ERROR, + MOZ_LOG(gGtkIMLog, LogLevel::Error, ("GtkIMModule(%p): EnsureToCacheSelection(), FAILED, due to " "failure of query selection event", this)); return false; @@ -1757,7 +1757,7 @@ nsGtkIMModule::EnsureToCacheSelection(nsAString* aSelectedString) mSelection.Assign(selection); if (!mSelection.IsValid()) { - PR_LOG(gGtkIMLog, PR_LOG_ERROR, + MOZ_LOG(gGtkIMLog, LogLevel::Error, ("GtkIMModule(%p): EnsureToCacheSelection(), FAILED, due to " "failure of query selection event (invalid result)", this)); return false; @@ -1767,7 +1767,7 @@ nsGtkIMModule::EnsureToCacheSelection(nsAString* aSelectedString) aSelectedString->Assign(selection.mReply.mString); } - PR_LOG(gGtkIMLog, PR_LOG_DEBUG, + MOZ_LOG(gGtkIMLog, LogLevel::Debug, ("GtkIMModule(%p): EnsureToCacheSelection(), Succeeded, mSelection=" "{ mOffset=%u, mLength=%u, mWritingMode=%s }", this, mSelection.mOffset, mSelection.mLength, diff --git a/widget/gtk/nsGtkKeyUtils.cpp b/widget/gtk/nsGtkKeyUtils.cpp index 9fbca06378..62de89f198 100644 --- a/widget/gtk/nsGtkKeyUtils.cpp +++ b/widget/gtk/nsGtkKeyUtils.cpp @@ -156,7 +156,7 @@ KeymapWrapper::KeymapWrapper() : if (!gKeymapWrapperLog) { gKeymapWrapperLog = PR_NewLogModule("KeymapWrapperWidgets"); } - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): Constructor, mGdkKeymap=%p", this, mGdkKeymap)); @@ -181,7 +181,7 @@ KeymapWrapper::Init() } mInitialized = true; - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): Init, mGdkKeymap=%p", this, mGdkKeymap)); @@ -193,7 +193,7 @@ KeymapWrapper::Init() gdk_window_add_filter(nullptr, FilterEvents, this); - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): Init, CapsLock=0x%X, NumLock=0x%X, " "ScrollLock=0x%X, Level3=0x%X, Level5=0x%X, " "Shift=0x%X, Ctrl=0x%X, Alt=0x%X, Meta=0x%X, Super=0x%X, Hyper=0x%X", @@ -214,7 +214,7 @@ KeymapWrapper::InitXKBExtension() int xkbMajorVer = XkbMajorVersion; int xkbMinorVer = XkbMinorVersion; if (!XkbLibraryVersion(&xkbMajorVer, &xkbMinorVer)) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitXKBExtension failed due to failure of " "XkbLibraryVersion()", this)); return; @@ -232,7 +232,7 @@ KeymapWrapper::InitXKBExtension() int opcode, baseErrorCode; if (!XkbQueryExtension(display, &opcode, &mXKBBaseEventCode, &baseErrorCode, &xkbMajorVer, &xkbMinorVer)) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitXKBExtension failed due to failure of " "XkbQueryExtension(), display=0x%p", this, display)); return; @@ -240,7 +240,7 @@ KeymapWrapper::InitXKBExtension() if (!XkbSelectEventDetails(display, XkbUseCoreKbd, XkbStateNotify, XkbModifierStateMask, XkbModifierStateMask)) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitXKBExtension failed due to failure of " "XkbSelectEventDetails() for XModifierStateMask, display=0x%p", this, display)); @@ -249,7 +249,7 @@ KeymapWrapper::InitXKBExtension() if (!XkbSelectEventDetails(display, XkbUseCoreKbd, XkbControlsNotify, XkbPerKeyRepeatMask, XkbPerKeyRepeatMask)) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitXKBExtension failed due to failure of " "XkbSelectEventDetails() for XkbControlsNotify, display=0x%p", this, display)); @@ -257,21 +257,21 @@ KeymapWrapper::InitXKBExtension() } if (!XGetKeyboardControl(display, &mKeyboardState)) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitXKBExtension failed due to failure of " "XGetKeyboardControl(), display=0x%p", this, display)); return; } - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitXKBExtension, Succeeded", this)); } void KeymapWrapper::InitBySystemSettings() { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitBySystemSettings, mGdkKeymap=%p", this, mGdkKeymap)); @@ -287,7 +287,7 @@ KeymapWrapper::InitBySystemSettings() max_keycode - min_keycode + 1, &keysyms_per_keycode); if (!xkeymap) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitBySystemSettings, " "Failed due to null xkeymap", this)); return; @@ -295,13 +295,13 @@ KeymapWrapper::InitBySystemSettings() XModifierKeymap* xmodmap = XGetModifierMapping(display); if (!xmodmap) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitBySystemSettings, " "Failed due to null xmodmap", this)); XFree(xkeymap); return; } - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitBySystemSettings, min_keycode=%d, " "max_keycode=%d, keysyms_per_keycode=%d, max_keypermod=%d", this, min_keycode, max_keycode, keysyms_per_keycode, @@ -328,7 +328,7 @@ KeymapWrapper::InitBySystemSettings() const uint32_t map_size = 8 * xmodmap->max_keypermod; for (uint32_t i = 0; i < map_size; i++) { KeyCode keycode = xmodmap->modifiermap[i]; - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitBySystemSettings, " " i=%d, keycode=0x%08X", this, i, keycode)); @@ -355,7 +355,7 @@ KeymapWrapper::InitBySystemSettings() const int32_t modIndex = bit - 3; for (int32_t j = 0; j < keysyms_per_keycode; j++) { Modifier modifier = GetModifierForGDKKeyval(syms[j]); - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitBySystemSettings, " " Mod%d, j=%d, syms[j]=%s(0x%X), modifier=%s", this, modIndex + 1, j, gdk_keyval_name(syms[j]), syms[j], @@ -437,7 +437,7 @@ KeymapWrapper::~KeymapWrapper() { gdk_window_remove_filter(nullptr, FilterEvents, this); NS_IF_RELEASE(sBidiKeyboard); - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): Destructor", this)); } @@ -500,7 +500,7 @@ KeymapWrapper::FilterEvents(GdkXEvent* aXEvent, } if (!XGetKeyboardControl(xkbEvent->any.display, &self->mKeyboardState)) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): FilterEvents failed due to failure " "of XGetKeyboardControl(), display=0x%p", self, xkbEvent->any.display)); @@ -516,7 +516,7 @@ KeymapWrapper::FilterEvents(GdkXEvent* aXEvent, KeymapWrapper::OnDestroyKeymap(KeymapWrapper* aKeymapWrapper, GdkKeymap *aGdkKeymap) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper: OnDestroyKeymap, aGdkKeymap=%p, aKeymapWrapper=%p", aGdkKeymap, aKeymapWrapper)); MOZ_ASSERT(aKeymapWrapper == sInstance, @@ -529,7 +529,7 @@ KeymapWrapper::OnDestroyKeymap(KeymapWrapper* aKeymapWrapper, KeymapWrapper::OnKeysChanged(GdkKeymap *aGdkKeymap, KeymapWrapper* aKeymapWrapper) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper: OnKeysChanged, aGdkKeymap=%p, aKeymapWrapper=%p", aGdkKeymap, aKeymapWrapper)); @@ -624,7 +624,7 @@ KeymapWrapper::InitInputEvent(WidgetInputEvent& aInputEvent, aInputEvent.modifiers |= MODIFIER_SCROLLLOCK; } - PR_LOG(gKeymapWrapperLog, PR_LOG_DEBUG, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Debug, ("KeymapWrapper(%p): InitInputEvent, aModifierState=0x%08X, " "aInputEvent.modifiers=0x%04X (Shift: %s, Control: %s, Alt: %s, " "Meta: %s, OS: %s, AltGr: %s, " @@ -663,7 +663,7 @@ KeymapWrapper::InitInputEvent(WidgetInputEvent& aInputEvent, mouseEvent.buttons |= WidgetMouseEvent::eMiddleButtonFlag; } - PR_LOG(gKeymapWrapperLog, PR_LOG_DEBUG, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Debug, ("KeymapWrapper(%p): InitInputEvent, aInputEvent has buttons, " "aInputEvent.buttons=0x%04X (Left: %s, Right: %s, Middle: %s, " "4th (BACK): %s, 5th (FORWARD): %s)", @@ -973,7 +973,7 @@ KeymapWrapper::InitKeyEvent(WidgetKeyboardEvent& aKeyEvent, break; } - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitKeyEvent, modifierState=0x%08X " "aGdkKeyEvent={ type=%s, keyval=%s(0x%X), state=0x%08X, " "hardware_keycode=0x%08X, is_modifier=%s } " @@ -1330,7 +1330,7 @@ KeymapWrapper::InitKeypressEvent(WidgetKeyboardEvent& aKeyEvent, aKeyEvent.charCode = GetCharCodeFor(aGdkKeyEvent); if (!aKeyEvent.charCode) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitKeypressEvent, " "keyCode=0x%02X, charCode=0x%08X", this, aKeyEvent.keyCode, aKeyEvent.charCode)); @@ -1345,7 +1345,7 @@ KeymapWrapper::InitKeypressEvent(WidgetKeyboardEvent& aKeyEvent, // work. if (!aKeyEvent.IsControl() && !aKeyEvent.IsAlt() && !aKeyEvent.IsMeta() && !aKeyEvent.IsOS()) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitKeypressEvent, " "keyCode=0x%02X, charCode=0x%08X", this, aKeyEvent.keyCode, aKeyEvent.charCode)); @@ -1354,7 +1354,7 @@ KeymapWrapper::InitKeypressEvent(WidgetKeyboardEvent& aKeyEvent, gint level = GetKeyLevel(aGdkKeyEvent); if (level != 0 && level != 1) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitKeypressEvent, " "keyCode=0x%02X, charCode=0x%08X, level=%d", this, aKeyEvent.keyCode, aKeyEvent.charCode, level)); @@ -1394,7 +1394,7 @@ KeymapWrapper::InitKeypressEvent(WidgetKeyboardEvent& aKeyEvent, // If current keyboard layout can input Latin characters, we don't need // more information. if (!needLatinKeyCodes) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitKeypressEvent, keyCode=0x%02X, " "charCode=0x%08X, level=%d, altCharCodes={ " "mUnshiftedCharCode=0x%08X, mShiftedCharCode=0x%08X }", @@ -1406,7 +1406,7 @@ KeymapWrapper::InitKeypressEvent(WidgetKeyboardEvent& aKeyEvent, // Next, find Latin inputtable keyboard layout. gint minGroup = GetFirstLatinGroup(); if (minGroup < 0) { - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitKeypressEvent, " "Latin keyboard layout isn't found: " "keyCode=0x%02X, charCode=0x%08X, level=%d, " @@ -1447,7 +1447,7 @@ KeymapWrapper::InitKeypressEvent(WidgetKeyboardEvent& aKeyEvent, aKeyEvent.charCode = ch; } - PR_LOG(gKeymapWrapperLog, PR_LOG_ALWAYS, + MOZ_LOG(gKeymapWrapperLog, LogLevel::Info, ("KeymapWrapper(%p): InitKeypressEvent, " "keyCode=0x%02X, charCode=0x%08X, level=%d, minGroup=%d, " "altCharCodes={ mUnshiftedCharCode=0x%08X, " diff --git a/widget/gtk/nsIdleServiceGTK.cpp b/widget/gtk/nsIdleServiceGTK.cpp index d608f32021..1c42a2f6ed 100644 --- a/widget/gtk/nsIdleServiceGTK.cpp +++ b/widget/gtk/nsIdleServiceGTK.cpp @@ -39,7 +39,7 @@ static void Initialize() PRLibrary* xsslib = PR_LoadLibrary("libXss.so.1"); if (!xsslib) // ouch. { - PR_LOG(sIdleLog, PR_LOG_WARNING, ("Failed to find libXss.so!\n")); + MOZ_LOG(sIdleLog, LogLevel::Warning, ("Failed to find libXss.so!\n")); return; } @@ -51,11 +51,11 @@ static void Initialize() PR_FindFunctionSymbol(xsslib, "XScreenSaverQueryInfo"); if (!_XSSQueryExtension) - PR_LOG(sIdleLog, PR_LOG_WARNING, ("Failed to get XSSQueryExtension!\n")); + MOZ_LOG(sIdleLog, LogLevel::Warning, ("Failed to get XSSQueryExtension!\n")); if (!_XSSAllocInfo) - PR_LOG(sIdleLog, PR_LOG_WARNING, ("Failed to get XSSAllocInfo!\n")); + MOZ_LOG(sIdleLog, LogLevel::Warning, ("Failed to get XSSAllocInfo!\n")); if (!_XSSQueryInfo) - PR_LOG(sIdleLog, PR_LOG_WARNING, ("Failed to get XSSQueryInfo!\n")); + MOZ_LOG(sIdleLog, LogLevel::Warning, ("Failed to get XSSQueryInfo!\n")); sInitialized = true; } @@ -99,7 +99,7 @@ nsIdleServiceGTK::PollIdleTime(uint32_t *aIdleTime) // We might not have a display (cf. in xpcshell) Display *dplay = GDK_DISPLAY_XDISPLAY(gdk_display_get_default()); if (!dplay) { - PR_LOG(sIdleLog, PR_LOG_WARNING, ("No display found!\n")); + MOZ_LOG(sIdleLog, LogLevel::Warning, ("No display found!\n")); return false; } @@ -119,7 +119,7 @@ nsIdleServiceGTK::PollIdleTime(uint32_t *aIdleTime) return true; } // If we get here, we couldn't get to XScreenSaver: - PR_LOG(sIdleLog, PR_LOG_WARNING, ("XSSQueryExtension returned false!\n")); + MOZ_LOG(sIdleLog, LogLevel::Warning, ("XSSQueryExtension returned false!\n")); return false; } diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h index 84e8e1e05c..ad7cf01b4d 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -45,10 +45,10 @@ extern PRLogModuleInfo *gWidgetFocusLog; extern PRLogModuleInfo *gWidgetDragLog; extern PRLogModuleInfo *gWidgetDrawLog; -#define LOG(args) PR_LOG(gWidgetLog, 4, args) -#define LOGFOCUS(args) PR_LOG(gWidgetFocusLog, 4, args) -#define LOGDRAG(args) PR_LOG(gWidgetDragLog, 4, args) -#define LOGDRAW(args) PR_LOG(gWidgetDrawLog, 4, args) +#define LOG(args) MOZ_LOG(gWidgetLog, mozilla::LogLevel::Debug, args) +#define LOGFOCUS(args) MOZ_LOG(gWidgetFocusLog, mozilla::LogLevel::Debug, args) +#define LOGDRAG(args) MOZ_LOG(gWidgetDragLog, mozilla::LogLevel::Debug, args) +#define LOGDRAW(args) MOZ_LOG(gWidgetDrawLog, mozilla::LogLevel::Debug, args) #else diff --git a/widget/nsIdleService.cpp b/widget/nsIdleService.cpp index 7fbc9dde8b..66053f960a 100644 --- a/widget/nsIdleService.cpp +++ b/widget/nsIdleService.cpp @@ -72,7 +72,7 @@ nsIdleServiceDaily::Observe(nsISupports *, const char *aTopic, const char16_t *) { - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: Observe '%s' (%d)", aTopic, mShutdownInProgress)); @@ -92,7 +92,7 @@ nsIdleServiceDaily::Observe(nsISupports *, } MOZ_ASSERT(strcmp(aTopic, OBSERVER_TOPIC_IDLE) == 0); - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: Notifying idle-daily observers")); #ifdef MOZ_WIDGET_ANDROID __android_log_print(LOG_LEVEL, LOG_TAG, @@ -128,7 +128,7 @@ nsIdleServiceDaily::Observe(nsISupports *, prefs->SavePrefFile(nullptr); } - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: Storing last idle time as %d sec.", nowSec)); #ifdef MOZ_WIDGET_ANDROID __android_log_print(LOG_LEVEL, LOG_TAG, @@ -139,7 +139,7 @@ nsIdleServiceDaily::Observe(nsISupports *, mExpectedTriggerTime = PR_Now() + ((PRTime)SECONDS_PER_DAY * (PRTime)PR_USEC_PER_SEC); - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: Restarting daily timer")); // Start timer for the next check in one day. @@ -177,7 +177,7 @@ nsIdleServiceDaily::Init() } int32_t secondsSinceLastDaily = nowSec - lastDaily; - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: Init: seconds since last daily: %d", secondsSinceLastDaily)); @@ -188,7 +188,7 @@ nsIdleServiceDaily::Init() bool hasBeenLongWait = (lastDaily && (secondsSinceLastDaily > (SECONDS_PER_DAY * 2))); - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: has been long wait? %d", hasBeenLongWait)); @@ -196,7 +196,7 @@ nsIdleServiceDaily::Init() // sends the idle-daily event. StageIdleDaily(hasBeenLongWait); } else { - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: Setting timer a day from now")); #ifdef MOZ_WIDGET_ANDROID __android_log_print(LOG_LEVEL, LOG_TAG, @@ -208,7 +208,7 @@ nsIdleServiceDaily::Init() int32_t milliSecLeftUntilDaily = (SECONDS_PER_DAY - secondsSinceLastDaily) * PR_MSEC_PER_SEC; - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: Seconds till next timeout: %d", (SECONDS_PER_DAY - secondsSinceLastDaily))); @@ -227,7 +227,7 @@ nsIdleServiceDaily::Init() // Register for when we should terminate/pause nsCOMPtr obs = mozilla::services::GetObserverService(); if (obs) { - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: Registering for system event observers.")); obs->AddObserver(this, "xpcom-will-shutdown", true); obs->AddObserver(this, "profile-change-teardown", true); @@ -248,7 +248,7 @@ void nsIdleServiceDaily::StageIdleDaily(bool aHasBeenLongWait) { NS_ASSERTION(mIdleService, "No idle service available?"); - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: Registering Idle observer callback " "(short wait requested? %d)", aHasBeenLongWait)); #ifdef MOZ_WIDGET_ANDROID @@ -265,7 +265,7 @@ nsIdleServiceDaily::StageIdleDaily(bool aHasBeenLongWait) void nsIdleServiceDaily::DailyCallback(nsITimer* aTimer, void* aClosure) { - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: DailyCallback running")); #ifdef MOZ_WIDGET_ANDROID __android_log_print(LOG_LEVEL, LOG_TAG, @@ -284,7 +284,7 @@ nsIdleServiceDaily::DailyCallback(nsITimer* aTimer, void* aClosure) // Add 10 ms to ensure we don't undershoot, and never get a "0" timer. delayTime += 10 * PR_USEC_PER_MSEC; - PR_LOG(sLog, PR_LOG_DEBUG, ("nsIdleServiceDaily: DailyCallback resetting timer to %lld msec", + MOZ_LOG(sLog, LogLevel::Debug, ("nsIdleServiceDaily: DailyCallback resetting timer to %lld msec", delayTime / PR_USEC_PER_MSEC)); #ifdef MOZ_WIDGET_ANDROID __android_log_print(LOG_LEVEL, LOG_TAG, @@ -431,7 +431,7 @@ nsIdleService::AddIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS) return NS_OK; } - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: Register idle observer %p for %d seconds", aObserver, aIdleTimeInS)); #ifdef MOZ_WIDGET_ANDROID @@ -459,7 +459,7 @@ nsIdleService::AddIdleObserver(nsIObserver* aObserver, uint32_t aIdleTimeInS) if (mDeltaToNextIdleSwitchInS > aIdleTimeInS) { // If it is, then this is the next to move to idle (at this point we // don't care if it should have switched already). - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: Register: adjusting next switch from %d to %d seconds", mDeltaToNextIdleSwitchInS, aIdleTimeInS)); #ifdef MOZ_WIDGET_ANDROID @@ -501,7 +501,7 @@ nsIdleService::RemoveIdleObserver(nsIObserver* aObserver, uint32_t aTimeInS) if (mArrayListeners.ElementAt(listenerIndex).isIdle) mIdleObserverCount--; mArrayListeners.RemoveElementAt(listenerIndex); - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: Remove observer %p (%d seconds), %d remain idle", aObserver, aTimeInS, mIdleObserverCount)); #ifdef MOZ_WIDGET_ANDROID @@ -513,7 +513,7 @@ nsIdleService::RemoveIdleObserver(nsIObserver* aObserver, uint32_t aTimeInS) } // If we get here, we haven't removed anything: - PR_LOG(sLog, PR_LOG_WARNING, + MOZ_LOG(sLog, LogLevel::Warning, ("idleService: Failed to remove idle observer %p (%d seconds)", aObserver, aTimeInS)); #ifdef MOZ_WIDGET_ANDROID @@ -527,7 +527,7 @@ nsIdleService::RemoveIdleObserver(nsIObserver* aObserver, uint32_t aTimeInS) NS_IMETHODIMP nsIdleService::ResetIdleTimeOut(uint32_t idleDeltaInMS) { - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: Reset idle timeout (last interaction %u msec)", idleDeltaInMS)); @@ -537,7 +537,7 @@ nsIdleService::ResetIdleTimeOut(uint32_t idleDeltaInMS) // If no one is idle, then we are done, any existing timers can keep running. if (mIdleObserverCount == 0) { - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: Reset idle timeout: no idle observers")); return NS_OK; } @@ -587,7 +587,7 @@ nsIdleService::ResetIdleTimeOut(uint32_t idleDeltaInMS) // Send the "non-idle" events. while (numberOfPendingNotifications--) { - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: Reset idle timeout: tell observer %p user is back", notifyList[numberOfPendingNotifications])); #ifdef MOZ_WIDGET_ANDROID @@ -615,7 +615,7 @@ nsIdleService::GetIdleTime(uint32_t* idleTime) bool polledIdleTimeIsValid = PollIdleTime(&polledIdleTimeMS); - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: Get idle time: polled %u msec, valid = %d", polledIdleTimeMS, polledIdleTimeIsValid)); @@ -623,7 +623,7 @@ nsIdleService::GetIdleTime(uint32_t* idleTime) TimeDuration timeSinceReset = TimeStamp::Now() - mLastUserInteraction; uint32_t timeSinceResetInMS = timeSinceReset.ToMilliseconds(); - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: Get idle time: time since reset %u msec", timeSinceResetInMS)); #ifdef MOZ_WIDGET_ANDROID @@ -679,7 +679,7 @@ nsIdleService::IdleTimerCallback(void) uint32_t currentIdleTimeInMS; if (NS_FAILED(GetIdleTime(¤tIdleTimeInMS))) { - PR_LOG(sLog, PR_LOG_ALWAYS, + MOZ_LOG(sLog, LogLevel::Info, ("idleService: Idle timer callback: failed to get idle time")); #ifdef MOZ_WIDGET_ANDROID __android_log_print(LOG_LEVEL, LOG_TAG, @@ -688,7 +688,7 @@ nsIdleService::IdleTimerCallback(void) return; } - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: Idle timer callback: current idle time %u msec", currentIdleTimeInMS)); #ifdef MOZ_WIDGET_ANDROID @@ -760,7 +760,7 @@ nsIdleService::IdleTimerCallback(void) // Bail if nothing to do. if (!numberOfPendingNotifications) { - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: **** Idle timer callback: no observers to message.")); return; } @@ -771,7 +771,7 @@ nsIdleService::IdleTimerCallback(void) // Notify all listeners that just timed out. while (numberOfPendingNotifications--) { - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: **** Idle timer callback: tell observer %p user is idle", notifyList[numberOfPendingNotifications])); #ifdef MOZ_WIDGET_ANDROID @@ -790,7 +790,7 @@ nsIdleService::SetTimerExpiryIfBefore(TimeStamp aNextTimeout) { TimeDuration nextTimeoutDuration = aNextTimeout - TimeStamp::Now(); - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: SetTimerExpiryIfBefore: next timeout %0.f msec from now", nextTimeoutDuration.ToMilliseconds())); @@ -825,7 +825,7 @@ nsIdleService::SetTimerExpiryIfBefore(TimeStamp aNextTimeout) mCurrentlySetToTimeoutAt += TimeDuration::FromMilliseconds(10); TimeDuration deltaTime = mCurrentlySetToTimeoutAt - currentTime; - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: IdleService reset timer expiry to %0.f msec from now", deltaTime.ToMilliseconds())); #ifdef MOZ_WIDGET_ANDROID @@ -850,7 +850,7 @@ nsIdleService::ReconfigureTimer(void) if ((mIdleObserverCount == 0) && UINT32_MAX == mDeltaToNextIdleSwitchInS) { // If not, just let any existing timers run to completion // And bail out. - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: ReconfigureTimer: no idle or waiting observers")); #ifdef MOZ_WIDGET_ANDROID __android_log_print(LOG_LEVEL, LOG_TAG, @@ -870,7 +870,7 @@ nsIdleService::ReconfigureTimer(void) TimeDuration nextTimeoutDuration = nextTimeoutAt - curTime; - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: next timeout %0.f msec from now", nextTimeoutDuration.ToMilliseconds())); @@ -886,7 +886,7 @@ nsIdleService::ReconfigureTimer(void) curTime + TimeDuration::FromMilliseconds(MIN_IDLE_POLL_INTERVAL_MSEC); if (nextTimeoutAt > pollTimeout) { - PR_LOG(sLog, PR_LOG_DEBUG, + MOZ_LOG(sLog, LogLevel::Debug, ("idleService: idle observers, reducing timeout to %lu msec from now", MIN_IDLE_POLL_INTERVAL_MSEC)); #ifdef MOZ_WIDGET_ANDROID diff --git a/widget/qt/nsDeviceContextSpecQt.cpp b/widget/qt/nsDeviceContextSpecQt.cpp index 87d0b4e3e7..7d3f5bccaf 100644 --- a/widget/qt/nsDeviceContextSpecQt.cpp +++ b/widget/qt/nsDeviceContextSpecQt.cpp @@ -35,7 +35,7 @@ static PRLogModuleInfo* DeviceContextSpecQtLM = PR_NewLogModule("DeviceContextSpecQt"); /* Macro to make lines shorter */ -#define DO_PR_DEBUG_LOG(x) PR_LOG(DeviceContextSpecQtLM, PR_LOG_DEBUG, x) +#define DO_PR_DEBUG_LOG(x) MOZ_LOG(DeviceContextSpecQtLM, mozilla::LogLevel::Debug, x) nsDeviceContextSpecQt::nsDeviceContextSpecQt() { diff --git a/widget/qt/nsWindow.h b/widget/qt/nsWindow.h index de4efb176a..92320278bb 100644 --- a/widget/qt/nsWindow.h +++ b/widget/qt/nsWindow.h @@ -29,10 +29,10 @@ extern PRLogModuleInfo *gWidgetFocusLog; extern PRLogModuleInfo *gWidgetIMLog; extern PRLogModuleInfo *gWidgetDrawLog; -#define LOG(args) PR_LOG(gWidgetLog, 4, args) -#define LOGFOCUS(args) PR_LOG(gWidgetFocusLog, 4, args) -#define LOGIM(args) PR_LOG(gWidgetIMLog, 4, args) -#define LOGDRAW(args) PR_LOG(gWidgetDrawLog, 4, args) +#define LOG(args) MOZ_LOG(gWidgetLog, mozilla::LogLevel::Debug, args) +#define LOGFOCUS(args) MOZ_LOG(gWidgetFocusLog, mozilla::LogLevel::Debug, args) +#define LOGIM(args) MOZ_LOG(gWidgetIMLog, mozilla::LogLevel::Debug, args) +#define LOGDRAW(args) MOZ_LOG(gWidgetDrawLog, mozilla::LogLevel::Debug, args) #else diff --git a/widget/windows/KeyboardLayout.cpp b/widget/windows/KeyboardLayout.cpp index e97d5cdb2e..5680401d6d 100644 --- a/widget/windows/KeyboardLayout.cpp +++ b/widget/windows/KeyboardLayout.cpp @@ -2372,11 +2372,11 @@ KeyboardLayout::LoadLayout(HKL aLayout) ::SetKeyboardState(originalKbdState); - if (PR_LOG_TEST(sKeyboardLayoutLogger, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(sKeyboardLayoutLogger, LogLevel::Debug)) { static const UINT kExtendedScanCode[] = { 0x0000, 0xE000 }; static const UINT kMapType = IsVistaOrLater() ? MAPVK_VSC_TO_VK_EX : MAPVK_VSC_TO_VK; - PR_LOG(sKeyboardLayoutLogger, PR_LOG_DEBUG, + MOZ_LOG(sKeyboardLayoutLogger, LogLevel::Debug, ("Logging virtual keycode values for scancode (0x%p)...", mKeyboardLayout)); for (uint32_t i = 0; i < ArrayLength(kExtendedScanCode); i++) { @@ -2384,7 +2384,7 @@ KeyboardLayout::LoadLayout(HKL aLayout) UINT scanCode = kExtendedScanCode[i] + j; UINT virtualKeyCode = ::MapVirtualKeyEx(scanCode, kMapType, mKeyboardLayout); - PR_LOG(sKeyboardLayoutLogger, PR_LOG_DEBUG, + MOZ_LOG(sKeyboardLayoutLogger, LogLevel::Debug, ("0x%04X, %s", scanCode, kVirtualKeyName[virtualKeyCode])); } // XP and Server 2003 don't support 0xE0 prefix of the scancode. diff --git a/widget/windows/WinMouseScrollHandler.cpp b/widget/windows/WinMouseScrollHandler.cpp index 8a33abd9f0..d777313ed0 100644 --- a/widget/windows/WinMouseScrollHandler.cpp +++ b/widget/windows/WinMouseScrollHandler.cpp @@ -36,14 +36,14 @@ static const char* GetBoolName(bool aBool) static void LogKeyStateImpl() { - if (!PR_LOG_TEST(gMouseScrollLog, PR_LOG_DEBUG)) { + if (!MOZ_LOG_TEST(gMouseScrollLog, LogLevel::Debug)) { return; } BYTE keyboardState[256]; if (::GetKeyboardState(keyboardState)) { for (size_t i = 0; i < ArrayLength(keyboardState); i++) { if (keyboardState[i]) { - PR_LOG(gMouseScrollLog, PR_LOG_DEBUG, + MOZ_LOG(gMouseScrollLog, LogLevel::Debug, (" Current key state: keyboardState[0x%02X]=0x%02X (%s)", i, keyboardState[i], ((keyboardState[i] & 0x81) == 0x81) ? "Pressed and Toggled" : @@ -52,7 +52,7 @@ static void LogKeyStateImpl() } } } else { - PR_LOG(gMouseScrollLog, PR_LOG_DEBUG, + MOZ_LOG(gMouseScrollLog, LogLevel::Debug, ("MouseScroll::Device::Elantech::HandleKeyMessage(): Failed to print " "current keyboard state")); } @@ -127,14 +127,14 @@ MouseScrollHandler::MouseScrollHandler() : mIsWaitingInternalMessage(false), mSynthesizingEvent(nullptr) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll: Creating an instance, this=%p, sInstance=%p", this, sInstance)); } MouseScrollHandler::~MouseScrollHandler() { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll: Destroying an instance, this=%p, sInstance=%p", this, sInstance)); @@ -221,7 +221,7 @@ MouseScrollHandler::ProcessMessage(nsWindowBase* aWidget, UINT msg, case WM_KEYDOWN: case WM_KEYUP: - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessMessage(): aWidget=%p, " "msg=%s(0x%04X), wParam=0x%02X, ::GetMessageTime()=%d", aWidget, msg == WM_KEYDOWN ? "WM_KEYDOWN" : @@ -360,7 +360,7 @@ MouseScrollHandler::ComputeMessagePos(UINT aMessage, POINT point; if (Device::SetPoint::IsGetMessagePosResponseValid(aMessage, aWParam, aLParam)) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ComputeMessagePos: Using ::GetCursorPos()")); ::GetCursorPos(&point); } else { @@ -384,7 +384,7 @@ MouseScrollHandler::ProcessNativeMouseWheelMessage(nsWindowBase* aWidget, POINT point = ComputeMessagePos(aMessage, aWParam, aLParam); - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessNativeMouseWheelMessage: aWidget=%p, " "aMessage=%s, wParam=0x%08X, lParam=0x%08X, point: { x=%d, y=%d }", aWidget, aMessage == WM_MOUSEWHEEL ? "WM_MOUSEWHEEL" : @@ -395,7 +395,7 @@ MouseScrollHandler::ProcessNativeMouseWheelMessage(nsWindowBase* aWidget, HWND underCursorWnd = ::WindowFromPoint(point); if (!underCursorWnd) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessNativeMouseWheelMessage: " "No window is not found under the cursor")); return; @@ -409,7 +409,7 @@ MouseScrollHandler::ProcessNativeMouseWheelMessage(nsWindowBase* aWidget, // be beneath the cursor if that window wasn't there. underCursorWnd = WinUtils::FindOurWindowAtPoint(point); if (!underCursorWnd) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessNativeMouseWheelMessage: " "Our window is not found under the Elantech helper window")); return; @@ -422,7 +422,7 @@ MouseScrollHandler::ProcessNativeMouseWheelMessage(nsWindowBase* aWidget, if (WinUtils::IsOurProcessWindow(underCursorWnd)) { nsWindowBase* destWindow = WinUtils::GetNSWindowBasePtr(underCursorWnd); if (!destWindow) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessNativeMouseWheelMessage: " "Found window under the cursor isn't managed by nsWindow...")); HWND wnd = ::GetParent(underCursorWnd); @@ -433,7 +433,7 @@ MouseScrollHandler::ProcessNativeMouseWheelMessage(nsWindowBase* aWidget, } } if (!wnd) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessNativeMouseWheelMessage: Our window which is " "managed by nsWindow is not found under the cursor")); return; @@ -450,13 +450,13 @@ MouseScrollHandler::ProcessNativeMouseWheelMessage(nsWindowBase* aWidget, if (destWindow->IsPlugin()) { destWindow = destWindow->GetParentWindowBase(false); if (!destWindow) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessNativeMouseWheelMessage: " "Our window which is a parent of a plugin window is not found")); return; } } - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessNativeMouseWheelMessage: Succeeded, " "Posting internal message to an nsWindow (%p)...", destWindow)); @@ -475,7 +475,7 @@ MouseScrollHandler::ProcessNativeMouseWheelMessage(nsWindowBase* aWidget, // If there is no plugin window in ancestors of the window under cursor, // the window is for another applications (case 2). // We don't need to handle this message. - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessNativeMouseWheelMessage: " "Our window is not found under the cursor")); return; @@ -490,12 +490,12 @@ MouseScrollHandler::ProcessNativeMouseWheelMessage(nsWindowBase* aWidget, aWidget->GetWindowHandle() == pluginWnd) { nsWindowBase* destWindow = aWidget->GetParentWindowBase(false); if (!destWindow) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessNativeMouseWheelMessage: Our normal window which " "is a parent of this plugin window is not found")); return; } - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessNativeMouseWheelMessage: Succeeded, " "Posting internal message to an nsWindow (%p) which is parent of this " "plugin window...", @@ -508,7 +508,7 @@ MouseScrollHandler::ProcessNativeMouseWheelMessage(nsWindowBase* aWidget, } // If the window is a part of plugin, we should post the message to it. - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessNativeMouseWheelMessage: Succeeded, " "Redirecting the message to a window which is a plugin child window")); ::PostMessage(underCursorWnd, aMessage, aWParam, aLParam); @@ -534,7 +534,7 @@ MouseScrollHandler::ProcessNativeScrollMessage(nsWindowBase* aWidget, aWParam, aLParam); } - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::ProcessNativeScrollMessage: aWidget=%p, " "aMessage=%s, wParam=0x%08X, lParam=0x%08X", aWidget, aMessage == WM_VSCROLL ? "WM_VSCROLL" : "WM_HSCROLL", @@ -597,7 +597,7 @@ MouseScrollHandler::HandleMouseWheelMessage(nsWindowBase* aWidget, "HandleMouseWheelMessage must be called with " "MOZ_WM_MOUSEVWHEEL or MOZ_WM_MOUSEHWHEEL"); - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::HandleMouseWheelMessage: aWidget=%p, " "aMessage=MOZ_WM_MOUSE%sWHEEL, aWParam=0x%08X, aLParam=0x%08X", aWidget, aMessage == MOZ_WM_MOUSEVWHEEL ? "V" : "H", @@ -608,7 +608,7 @@ MouseScrollHandler::HandleMouseWheelMessage(nsWindowBase* aWidget, EventInfo eventInfo(aWidget, WinUtils::GetNativeMessage(aMessage), aWParam, aLParam); if (!eventInfo.CanDispatchWheelEvent()) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::HandleMouseWheelMessage: Cannot dispatch the events")); mLastEventInfo.ResetTransaction(); return; @@ -630,12 +630,12 @@ MouseScrollHandler::HandleMouseWheelMessage(nsWindowBase* aWidget, WidgetWheelEvent wheelEvent(true, NS_WHEEL_WHEEL, aWidget); if (mLastEventInfo.InitWheelEvent(aWidget, wheelEvent, modKeyState)) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::HandleMouseWheelMessage: dispatching " "NS_WHEEL_WHEEL event")); aWidget->DispatchWheelEvent(&wheelEvent); if (aWidget->Destroyed()) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::HandleMouseWheelMessage: The window was destroyed " "by NS_WHEEL_WHEEL event")); mLastEventInfo.ResetTransaction(); @@ -643,7 +643,7 @@ MouseScrollHandler::HandleMouseWheelMessage(nsWindowBase* aWidget, } } else { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::HandleMouseWheelMessage: NS_WHEEL_WHEEL event is not " "dispatched")); } @@ -698,7 +698,7 @@ MouseScrollHandler::HandleScrollMessageAsMouseWheelMessage(nsWindowBase* aWidget // the original message was received. InitEvent(aWidget, wheelEvent); - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::HandleScrollMessageAsMouseWheelMessage: aWidget=%p, " "aMessage=MOZ_WM_%sSCROLL, aWParam=0x%08X, aLParam=0x%08X, " "wheelEvent { refPoint: { x: %d, y: %d }, deltaX: %f, deltaY: %f, " @@ -791,7 +791,7 @@ MouseScrollHandler::LastEventInfo::ResetTransaction() return; } - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::LastEventInfo::ResetTransaction()")); mWnd = nullptr; @@ -853,7 +853,7 @@ MouseScrollHandler::LastEventInfo::InitWheelEvent( mAccumulatedDelta -= lineOrPageDelta * orienter * RoundDelta(nativeDeltaPerUnit); - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::LastEventInfo::InitWheelEvent: aWidget=%p, " "aWheelEvent { refPoint: { x: %d, y: %d }, deltaX: %f, deltaY: %f, " "lineOrPageDeltaX: %d, lineOrPageDeltaY: %d, " @@ -891,20 +891,20 @@ MouseScrollHandler::SystemSettings::Init() mScrollLines = userPrefs.GetOverriddenVerticalScrollAmout(); if (mScrollLines >= 0) { // overridden by the pref. - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::SystemSettings::Init(): mScrollLines is overridden by " "the pref: %d", mScrollLines)); } else if (!::SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, &mScrollLines, 0)) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::SystemSettings::Init(): ::SystemParametersInfo(" "SPI_GETWHEELSCROLLLINES) failed")); mScrollLines = 3; } if (mScrollLines > WHEEL_DELTA) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::SystemSettings::Init(): the result of " "::SystemParametersInfo(SPI_GETWHEELSCROLLLINES) is too large: %d", mScrollLines)); @@ -920,13 +920,13 @@ MouseScrollHandler::SystemSettings::Init() mScrollChars = userPrefs.GetOverriddenHorizontalScrollAmout(); if (mScrollChars >= 0) { // overridden by the pref. - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::SystemSettings::Init(): mScrollChars is overridden by " "the pref: %d", mScrollChars)); } else if (!::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, &mScrollChars, 0)) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::SystemSettings::Init(): ::SystemParametersInfo(" "SPI_GETWHEELSCROLLCHARS) failed, %s", IsVistaOrLater() ? @@ -936,7 +936,7 @@ MouseScrollHandler::SystemSettings::Init() } if (mScrollChars > WHEEL_DELTA) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::SystemSettings::Init(): the result of " "::SystemParametersInfo(SPI_GETWHEELSCROLLCHARS) is too large: %d", mScrollChars)); @@ -944,7 +944,7 @@ MouseScrollHandler::SystemSettings::Init() mScrollChars = WHEEL_PAGESCROLL; } - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::SystemSettings::Init(): initialized, " "mScrollLines=%d, mScrollChars=%d", mScrollLines, mScrollChars)); @@ -953,7 +953,7 @@ MouseScrollHandler::SystemSettings::Init() void MouseScrollHandler::SystemSettings::MarkDirty() { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScrollHandler::SystemSettings::MarkDirty(): " "Marking SystemSettings dirty")); mInitialized = false; @@ -1007,7 +1007,7 @@ MouseScrollHandler::UserPrefs::Init() Preferences::GetInt("mousewheel.windows.transaction.timeout", DEFAULT_TIMEOUT_DURATION); - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::UserPrefs::Init(): initialized, " "mScrollMessageHandledAsWheelMessage=%s, " "mOverriddenVerticalScrollAmount=%d, " @@ -1021,7 +1021,7 @@ MouseScrollHandler::UserPrefs::Init() void MouseScrollHandler::UserPrefs::MarkDirty() { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScrollHandler::UserPrefs::MarkDirty(): Marking UserPrefs dirty")); mInitialized = false; // Some prefs might override system settings, so, we should mark them dirty. @@ -1045,21 +1045,21 @@ MouseScrollHandler::Device::GetWorkaroundPref(const char* aPrefName, bool aValueIfAutomatic) { if (!aPrefName) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::GetWorkaroundPref(): Failed, aPrefName is NULL")); return aValueIfAutomatic; } int32_t lHackValue = 0; if (NS_FAILED(Preferences::GetInt(aPrefName, &lHackValue))) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::GetWorkaroundPref(): Preferences::GetInt() failed," " aPrefName=\"%s\", aValueIfAutomatic=%s", aPrefName, GetBoolName(aValueIfAutomatic))); return aValueIfAutomatic; } - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::GetWorkaroundPref(): Succeeded, " "aPrefName=\"%s\", aValueIfAutomatic=%s, lHackValue=%d", aPrefName, GetBoolName(aValueIfAutomatic), lHackValue)); @@ -1083,7 +1083,7 @@ MouseScrollHandler::Device::Init() (TrackPoint::IsDriverInstalled() || UltraNav::IsObsoleteDriverInstalled())); - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::Init(): sFakeScrollableWindowNeeded=%s", GetBoolName(sFakeScrollableWindowNeeded))); @@ -1107,7 +1107,7 @@ MouseScrollHandler::Device::Elantech::Init() sUseSwipeHack = needsHack && version <= 7; sUsePinchHack = needsHack && version <= 8; - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::Elantech::Init(): version=%d, sUseSwipeHack=%s, " "sUsePinchHack=%s", version, GetBoolName(sUseSwipeHack), GetBoolName(sUsePinchHack))); @@ -1211,7 +1211,7 @@ MouseScrollHandler::Device::Elantech::HandleKeyMessage(nsWindowBase* aWidget, (aWParam == VK_NEXT || aWParam == VK_PRIOR) && (IS_VK_DOWN(0xFF) || IS_VK_DOWN(0xCC))) { if (aMsg == WM_KEYDOWN) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::Elantech::HandleKeyMessage(): Dispatching " "%s command event", aWParam == VK_NEXT ? "Forward" : "Back")); @@ -1222,7 +1222,7 @@ MouseScrollHandler::Device::Elantech::HandleKeyMessage(nsWindowBase* aWidget, aWidget->DispatchWindowEvent(&commandEvent); } else { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::Elantech::HandleKeyMessage(): Consumed")); } return true; // consume the message (doesn't need to dispatch key events) @@ -1250,7 +1250,7 @@ MouseScrollHandler::Device::Elantech::HandleKeyMessage(nsWindowBase* aWidget, // that are more easily comparable. sZoomUntil = ::GetTickCount() & 0x7FFFFFFF; - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::Elantech::HandleKeyMessage(): sZoomUntil=%d", sZoomUntil)); } @@ -1281,7 +1281,7 @@ MouseScrollHandler::Device::Elantech::UpdateZoomUntil() (sZoomUntil < DWORD(msgTime))) { sZoomUntil = 0; - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::Elantech::UpdateZoomUntil(): " "sZoomUntil was reset")); } @@ -1309,7 +1309,7 @@ MouseScrollHandler::Device::TrackPoint::IsDriverInstalled() { if (WinUtils::HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Lenovo\\TrackPoint")) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::TrackPoint::IsDriverInstalled(): " "Lenovo's TrackPoint driver is found")); return true; @@ -1317,7 +1317,7 @@ MouseScrollHandler::Device::TrackPoint::IsDriverInstalled() if (WinUtils::HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Alps\\Apoint\\TrackPoint")) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::TrackPoint::IsDriverInstalled(): " "Alps's TrackPoint driver is found")); } @@ -1337,7 +1337,7 @@ MouseScrollHandler::Device::UltraNav::IsObsoleteDriverInstalled() { if (WinUtils::HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Lenovo\\UltraNav")) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::UltraNav::IsObsoleteDriverInstalled(): " "Lenovo's UltraNav driver is found")); return true; @@ -1346,13 +1346,13 @@ MouseScrollHandler::Device::UltraNav::IsObsoleteDriverInstalled() bool installed = false; if (WinUtils::HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Synaptics\\SynTPEnh\\UltraNavUSB")) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::UltraNav::IsObsoleteDriverInstalled(): " "Synaptics's UltraNav (USB) driver is found")); installed = true; } else if (WinUtils::HasRegistryKey(HKEY_CURRENT_USER, L"Software\\Synaptics\\SynTPEnh\\UltraNavPS2")) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::UltraNav::IsObsoleteDriverInstalled(): " "Synaptics's UltraNav (PS/2) driver is found")); installed = true; @@ -1369,7 +1369,7 @@ MouseScrollHandler::Device::UltraNav::IsObsoleteDriverInstalled() L"DriverVersion", buf, sizeof buf); if (!foundKey) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::UltraNav::IsObsoleteDriverInstalled(): " "Failed to get UltraNav driver version")); return false; @@ -1381,7 +1381,7 @@ MouseScrollHandler::Device::UltraNav::IsObsoleteDriverInstalled() if (p) { minorVersion = wcstol(p + 1, nullptr, 10); } - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::UltraNav::IsObsoleteDriverInstalled(): " "found driver version = %d.%d", majorVersion, minorVersion)); @@ -1421,14 +1421,14 @@ MouseScrollHandler::Device::SetPoint::IsGetMessagePosResponseValid( if (!sMightBeUsing && !aLParam && aLParam != messagePos && ::InSendMessage()) { sMightBeUsing = true; - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::SetPoint::IsGetMessagePosResponseValid(): " "Might using SetPoint")); } else if (sMightBeUsing && aLParam != 0 && ::InSendMessage()) { // The user has changed the mouse from Logitech's to another one (e.g., // the user has changed to the touchpad of the notebook. sMightBeUsing = false; - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScroll::Device::SetPoint::IsGetMessagePosResponseValid(): " "Might stop using SetPoint")); } @@ -1459,7 +1459,7 @@ MouseScrollHandler::SynthesizingEvent::Synthesize(const POINTS& aCursorPoint, LPARAM aLParam, const BYTE (&aKeyStates)[256]) { - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScrollHandler::SynthesizingEvent::Synthesize(): aCursorPoint: { " "x: %d, y: %d }, aWnd=0x%X, aMessage=0x%04X, aWParam=0x%08X, " "aLParam=0x%08X, IsSynthesized()=%s, mStatus=%s", @@ -1515,7 +1515,7 @@ MouseScrollHandler::SynthesizingEvent::NativeMessageReceived(nsWindowBase* aWidg // Otherwise, the message may not be sent by us. } - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScrollHandler::SynthesizingEvent::NativeMessageReceived(): " "aWidget=%p, aWidget->GetWindowHandle()=0x%X, mWnd=0x%X, " "aMessage=0x%04X, aWParam=0x%08X, aLParam=0x%08X, mStatus=%s", @@ -1535,7 +1535,7 @@ MouseScrollHandler::SynthesizingEvent::NotifyNativeMessageHandlingFinished() return; } - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScrollHandler::SynthesizingEvent::" "NotifyNativeMessageHandlingFinished(): IsWaitingInternalMessage=%s", GetBoolName(MouseScrollHandler::IsWaitingInternalMessage()))); @@ -1558,7 +1558,7 @@ MouseScrollHandler::SynthesizingEvent::NotifyInternalMessageHandlingFinished() return; } - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScrollHandler::SynthesizingEvent::" "NotifyInternalMessageHandlingFinished()")); @@ -1572,7 +1572,7 @@ MouseScrollHandler::SynthesizingEvent::Finish() return; } - PR_LOG(gMouseScrollLog, PR_LOG_ALWAYS, + MOZ_LOG(gMouseScrollLog, LogLevel::Info, ("MouseScrollHandler::SynthesizingEvent::Finish()")); // Restore the original key state. diff --git a/widget/windows/WinUtils.cpp b/widget/windows/WinUtils.cpp index 33647cfd58..02cbdad5bf 100644 --- a/widget/windows/WinUtils.cpp +++ b/widget/windows/WinUtils.cpp @@ -484,7 +484,7 @@ WinUtils::LogW(const wchar_t *fmt, ...) printf("%s\n", utf8); NS_ASSERTION(gWindowsLog, "Called WinUtils Log() but Widget " "log module doesn't exist!"); - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, (utf8)); + MOZ_LOG(gWindowsLog, LogLevel::Error, (utf8)); } delete[] utf8; } @@ -518,7 +518,7 @@ WinUtils::Log(const char *fmt, ...) NS_ASSERTION(gWindowsLog, "Called WinUtils Log() but Widget " "log module doesn't exist!"); - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, (buffer)); + MOZ_LOG(gWindowsLog, LogLevel::Error, (buffer)); delete[] buffer; } diff --git a/widget/windows/nsClipboard.cpp b/widget/windows/nsClipboard.cpp index a2c7111fbc..2561bf1348 100644 --- a/widget/windows/nsClipboard.cpp +++ b/widget/windows/nsClipboard.cpp @@ -34,6 +34,8 @@ #include "nsEscape.h" #include "nsIObserverService.h" +using mozilla::LogLevel; + PRLogModuleInfo* gWin32ClipboardLog = nullptr; // oddly, this isn't in the MSVC headers anywhere. @@ -336,39 +338,39 @@ static void DisplayErrCode(HRESULT hres) { #if defined(DEBUG_rods) || defined(DEBUG_pinkerton) if (hres == E_INVALIDARG) { - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, ("E_INVALIDARG\n")); + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("E_INVALIDARG\n")); } else if (hres == E_UNEXPECTED) { - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, ("E_UNEXPECTED\n")); + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("E_UNEXPECTED\n")); } else if (hres == E_OUTOFMEMORY) { - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, ("E_OUTOFMEMORY\n")); + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("E_OUTOFMEMORY\n")); } else if (hres == DV_E_LINDEX ) { - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, ("DV_E_LINDEX\n")); + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("DV_E_LINDEX\n")); } else if (hres == DV_E_FORMATETC) { - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, ("DV_E_FORMATETC\n")); + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("DV_E_FORMATETC\n")); } else if (hres == DV_E_TYMED) { - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, ("DV_E_TYMED\n")); + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("DV_E_TYMED\n")); } else if (hres == DV_E_DVASPECT) { - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, ("DV_E_DVASPECT\n")); + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("DV_E_DVASPECT\n")); } else if (hres == OLE_E_NOTRUNNING) { - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, ("OLE_E_NOTRUNNING\n")); + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("OLE_E_NOTRUNNING\n")); } else if (hres == STG_E_MEDIUMFULL) { - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, ("STG_E_MEDIUMFULL\n")); + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("STG_E_MEDIUMFULL\n")); } else if (hres == DV_E_CLIPFORMAT) { - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, ("DV_E_CLIPFORMAT\n")); + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("DV_E_CLIPFORMAT\n")); } else if (hres == S_OK) { - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, ("S_OK\n")); + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("S_OK\n")); } else { - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("****** DisplayErrCode 0x%X\n", hres)); } #endif @@ -546,7 +548,7 @@ nsresult nsClipboard::GetNativeDataOffClipboard(IDataObject * aDataObject, UINT case TYMED_GDI: { #ifdef DEBUG - PR_LOG(gWin32ClipboardLog, PR_LOG_ALWAYS, + MOZ_LOG(gWin32ClipboardLog, LogLevel::Info, ("*********************** TYMED_GDI\n")); #endif } break; diff --git a/widget/windows/nsDataObj.cpp b/widget/windows/nsDataObj.cpp index fd3441032a..0dedaac159 100644 --- a/widget/windows/nsDataObj.cpp +++ b/widget/windows/nsDataObj.cpp @@ -546,7 +546,7 @@ STDMETHODIMP nsDataObj::GetData(LPFORMATETC aFormat, LPSTGMEDIUM pSTM) return GetFileContents ( *aFormat, *pSTM ); if ( format == PreferredDropEffect ) return GetPreferredDropEffect( *aFormat, *pSTM ); - //PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + //MOZ_LOG(gWindowsLog, LogLevel::Info, // ("***** nsDataObj::GetData - Unknown format %u\n", format)); return GetText(df, *aFormat, *pSTM); } //switch diff --git a/widget/windows/nsDeviceContextSpecWin.cpp b/widget/windows/nsDeviceContextSpecWin.cpp index 6538d7e459..2489efba3e 100644 --- a/widget/windows/nsDeviceContextSpecWin.cpp +++ b/widget/windows/nsDeviceContextSpecWin.cpp @@ -43,7 +43,7 @@ #include "mozilla/Logging.h" PRLogModuleInfo * kWidgetPrintingLogMod = PR_NewLogModule("printing-widget"); -#define PR_PL(_p1) PR_LOG(kWidgetPrintingLogMod, PR_LOG_DEBUG, _p1) +#define PR_PL(_p1) MOZ_LOG(kWidgetPrintingLogMod, mozilla::LogLevel::Debug, _p1) using namespace mozilla; diff --git a/widget/windows/nsIMM32Handler.cpp b/widget/windows/nsIMM32Handler.cpp index 23e0b5e941..f214e72b15 100644 --- a/widget/windows/nsIMM32Handler.cpp +++ b/widget/windows/nsIMM32Handler.cpp @@ -279,7 +279,7 @@ nsIMM32Handler::InitKeyboardLayout(nsWindow* aWindow, MaybeAdjustCompositionFont(aWindow, sWritingModeOfCompositionFont, true); } - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: InitKeyboardLayout, aKeyboardLayout=%08x (\"%s\"), sCodePage=%lu, " "sIMEProperty=%s, sIMEUIProperty=%s", aKeyboardLayout, NS_ConvertUTF16toUTF8(sIMEName).get(), @@ -316,16 +316,16 @@ nsIMM32Handler::nsIMM32Handler() : mIsComposing(false), mIsComposingOnPlugin(false), mNativeCaretIsCreated(false) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, ("IMM32: nsIMM32Handler is created\n")); + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: nsIMM32Handler is created\n")); } nsIMM32Handler::~nsIMM32Handler() { if (mIsComposing) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: ~nsIMM32Handler, ERROR, the instance is still composing\n")); } - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, ("IMM32: nsIMM32Handler is destroyed\n")); + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: nsIMM32Handler is destroyed\n")); } nsresult @@ -347,7 +347,7 @@ nsIMM32Handler::EnsureAttributeArray(int32_t aCount) /* static */ void nsIMM32Handler::CommitComposition(nsWindow* aWindow, bool aForce) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: CommitComposition, aForce=%s, aWindow=%p, hWnd=%08x, mComposingWindow=%p%s\n", aForce ? "TRUE" : "FALSE", aWindow, aWindow->GetWindowHandle(), @@ -361,7 +361,7 @@ nsIMM32Handler::CommitComposition(nsWindow* aWindow, bool aForce) nsIMEContext IMEContext(aWindow->GetWindowHandle()); bool associated = IMEContext.AssociateDefaultContext(); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: CommitComposition, associated=%s\n", associated ? "YES" : "NO")); @@ -378,7 +378,7 @@ nsIMM32Handler::CommitComposition(nsWindow* aWindow, bool aForce) /* static */ void nsIMM32Handler::CancelComposition(nsWindow* aWindow, bool aForce) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: CancelComposition, aForce=%s, aWindow=%p, hWnd=%08x, mComposingWindow=%p%s\n", aForce ? "TRUE" : "FALSE", aWindow, aWindow->GetWindowHandle(), @@ -392,7 +392,7 @@ nsIMM32Handler::CancelComposition(nsWindow* aWindow, bool aForce) nsIMEContext IMEContext(aWindow->GetWindowHandle()); bool associated = IMEContext.AssociateDefaultContext(); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: CancelComposition, associated=%s\n", associated ? "YES" : "NO")); @@ -589,7 +589,7 @@ nsIMM32Handler::OnInputLangChange(nsWindow* aWindow, LPARAM lParam, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnInputLangChange, hWnd=%08x, wParam=%08x, lParam=%08x\n", aWindow->GetWindowHandle(), wParam, lParam)); @@ -607,7 +607,7 @@ bool nsIMM32Handler::OnIMEStartComposition(nsWindow* aWindow, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMEStartComposition, hWnd=%08x, mIsComposing=%s\n", aWindow->GetWindowHandle(), mIsComposing ? "TRUE" : "FALSE")); aResult.mConsumed = ShouldDrawCompositionStringOurselves(); @@ -627,10 +627,10 @@ nsIMM32Handler::OnIMEComposition(nsWindow* aWindow, LPARAM lParam, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMEComposition, hWnd=%08x, lParam=%08x, mIsComposing=%s\n", aWindow->GetWindowHandle(), lParam, mIsComposing ? "TRUE" : "FALSE")); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMEComposition, GCS_RESULTSTR=%s, GCS_COMPSTR=%s, GCS_COMPATTR=%s, GCS_COMPCLAUSE=%s, GCS_CURSORPOS=%s\n", lParam & GCS_RESULTSTR ? "YES" : "no", lParam & GCS_COMPSTR ? "YES" : "no", @@ -650,7 +650,7 @@ bool nsIMM32Handler::OnIMEEndComposition(nsWindow* aWindow, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMEEndComposition, hWnd=%08x, mIsComposing=%s\n", aWindow->GetWindowHandle(), mIsComposing ? "TRUE" : "FALSE")); @@ -668,7 +668,7 @@ nsIMM32Handler::OnIMEEndComposition(nsWindow* aWindow, PM_NOREMOVE) && compositionMsg.message == WM_IME_COMPOSITION && IS_COMMITTING_LPARAM(compositionMsg.lParam)) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMEEndComposition, WM_IME_ENDCOMPOSITION is followed by " "WM_IME_COMPOSITION, ignoring the message...")); return true; @@ -680,7 +680,7 @@ nsIMM32Handler::OnIMEEndComposition(nsWindow* aWindow, // event and a compositionend event. // XXX Shouldn't we dispatch the compositionchange event with actual or // latest composition string? - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMEEndComposition, mCompositionString=\"%s\"%s", NS_ConvertUTF16toUTF8(mCompositionString).get(), mCompositionString.IsEmpty() ? "" : ", but canceling it...")); @@ -696,7 +696,7 @@ nsIMM32Handler::OnIMEChar(nsWindow* aWindow, LPARAM lParam, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMEChar, hWnd=%08x, char=%08x\n", aWindow->GetWindowHandle(), wParam)); @@ -714,7 +714,7 @@ nsIMM32Handler::OnIMEChar(nsWindow* aWindow, nsIMM32Handler::OnIMECompositionFull(nsWindow* aWindow, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMECompositionFull, hWnd=%08x\n", aWindow->GetWindowHandle())); @@ -731,72 +731,72 @@ nsIMM32Handler::OnIMENotify(nsWindow* aWindow, { switch (wParam) { case IMN_CHANGECANDIDATE: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_CHANGECANDIDATE, lParam=%08x\n", aWindow->GetWindowHandle(), lParam)); break; case IMN_CLOSECANDIDATE: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_CLOSECANDIDATE, lParam=%08x\n", aWindow->GetWindowHandle(), lParam)); break; case IMN_CLOSESTATUSWINDOW: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_CLOSESTATUSWINDOW\n", aWindow->GetWindowHandle())); break; case IMN_GUIDELINE: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_GUIDELINE\n", aWindow->GetWindowHandle())); break; case IMN_OPENCANDIDATE: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_OPENCANDIDATE, lParam=%08x\n", aWindow->GetWindowHandle(), lParam)); break; case IMN_OPENSTATUSWINDOW: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_OPENSTATUSWINDOW\n", aWindow->GetWindowHandle())); break; case IMN_SETCANDIDATEPOS: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_SETCANDIDATEPOS, lParam=%08x\n", aWindow->GetWindowHandle(), lParam)); break; case IMN_SETCOMPOSITIONFONT: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_SETCOMPOSITIONFONT\n", aWindow->GetWindowHandle())); break; case IMN_SETCOMPOSITIONWINDOW: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_SETCOMPOSITIONWINDOW\n", aWindow->GetWindowHandle())); break; case IMN_SETCONVERSIONMODE: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_SETCONVERSIONMODE\n", aWindow->GetWindowHandle())); break; case IMN_SETOPENSTATUS: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_SETOPENSTATUS\n", aWindow->GetWindowHandle())); break; case IMN_SETSENTENCEMODE: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_SETSENTENCEMODE\n", aWindow->GetWindowHandle())); break; case IMN_SETSTATUSWINDOWPOS: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_SETSTATUSWINDOWPOS\n", aWindow->GetWindowHandle())); break; case IMN_PRIVATE: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMENotify, hWnd=%08x, IMN_PRIVATE\n", aWindow->GetWindowHandle())); break; @@ -815,26 +815,26 @@ nsIMM32Handler::OnIMERequest(nsWindow* aWindow, { switch (wParam) { case IMR_RECONVERTSTRING: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMERequest, hWnd=%08x, IMR_RECONVERTSTRING\n", aWindow->GetWindowHandle())); aResult.mConsumed = HandleReconvert(aWindow, lParam, &aResult.mResult); return true; case IMR_QUERYCHARPOSITION: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMERequest, hWnd=%08x, IMR_QUERYCHARPOSITION\n", aWindow->GetWindowHandle())); aResult.mConsumed = HandleQueryCharPosition(aWindow, lParam, &aResult.mResult); return true; case IMR_DOCUMENTFEED: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMERequest, hWnd=%08x, IMR_DOCUMENTFEED\n", aWindow->GetWindowHandle())); aResult.mConsumed = HandleDocumentFeed(aWindow, lParam, &aResult.mResult); return true; default: - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMERequest, hWnd=%08x, wParam=%08x\n", aWindow->GetWindowHandle(), wParam)); aResult.mConsumed = false; @@ -848,7 +848,7 @@ nsIMM32Handler::OnIMESelect(nsWindow* aWindow, LPARAM lParam, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMESelect, hWnd=%08x, wParam=%08x, lParam=%08x\n", aWindow->GetWindowHandle(), wParam, lParam)); @@ -863,7 +863,7 @@ nsIMM32Handler::OnIMESetContext(nsWindow* aWindow, LPARAM lParam, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMESetContext, hWnd=%08x, %s, lParam=%08x\n", aWindow->GetWindowHandle(), wParam ? "Active" : "Deactive", lParam)); @@ -877,7 +877,7 @@ nsIMM32Handler::OnIMESetContext(nsWindow* aWindow, // The top level window never becomes composing window, so, we can ignore // the WM_IME_SETCONTEXT on the top level window. if (IsTopLevelWindowOfComposition(aWindow)) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMESetContext, hWnd=%08x is top level window\n")); return true; } @@ -892,7 +892,7 @@ nsIMM32Handler::OnIMESetContext(nsWindow* aWindow, if (wParam && (lParam & ISC_SHOWUICOMPOSITIONWINDOW) && ShouldDrawCompositionStringOurselves()) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMESetContext, ISC_SHOWUICOMPOSITIONWINDOW is removed\n")); lParam &= ~ISC_SHOWUICOMPOSITIONWINDOW; } @@ -929,10 +929,10 @@ nsIMM32Handler::OnChar(nsWindow* aWindow, WPARAM recWParam; LPARAM recLParam; DequeueIMECharRecords(recWParam, recLParam); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnChar, aWindow=%p, wParam=%08x, lParam=%08x,\n", aWindow->GetWindowHandle(), wParam, lParam)); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, (" recorded: wParam=%08x, lParam=%08x\n", recWParam, recLParam)); // If an unexpected char message comes, we should reset the records, @@ -958,7 +958,7 @@ nsIMM32Handler::OnIMEStartCompositionOnPlugin(nsWindow* aWindow, LPARAM lParam, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMEStartCompositionOnPlugin, hWnd=%08x, mIsComposingOnPlugin=%s\n", aWindow->GetWindowHandle(), mIsComposingOnPlugin ? "TRUE" : "FALSE")); mIsComposingOnPlugin = true; @@ -980,11 +980,11 @@ nsIMM32Handler::OnIMECompositionOnPlugin(nsWindow* aWindow, LPARAM lParam, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMECompositionOnPlugin, hWnd=%08x, lParam=%08x, mIsComposingOnPlugin=%s\n", aWindow->GetWindowHandle(), lParam, mIsComposingOnPlugin ? "TRUE" : "FALSE")); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMECompositionOnPlugin, GCS_RESULTSTR=%s, GCS_COMPSTR=%s, GCS_COMPATTR=%s, GCS_COMPCLAUSE=%s, GCS_CURSORPOS=%s\n", lParam & GCS_RESULTSTR ? "YES" : "no", lParam & GCS_COMPSTR ? "YES" : "no", @@ -1014,7 +1014,7 @@ nsIMM32Handler::OnIMEEndCompositionOnPlugin(nsWindow* aWindow, LPARAM lParam, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMEEndCompositionOnPlugin, hWnd=%08x, mIsComposingOnPlugin=%s\n", aWindow->GetWindowHandle(), mIsComposingOnPlugin ? "TRUE" : "FALSE")); @@ -1038,7 +1038,7 @@ nsIMM32Handler::OnIMECharOnPlugin(nsWindow* aWindow, LPARAM lParam, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMECharOnPlugin, hWnd=%08x, char=%08x, scancode=%08x\n", aWindow->GetWindowHandle(), wParam, lParam)); @@ -1059,7 +1059,7 @@ nsIMM32Handler::OnIMESetContextOnPlugin(nsWindow* aWindow, LPARAM lParam, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnIMESetContextOnPlugin, hWnd=%08x, %s, lParam=%08x\n", aWindow->GetWindowHandle(), wParam ? "Active" : "Deactive", lParam)); @@ -1106,10 +1106,10 @@ nsIMM32Handler::OnCharOnPlugin(nsWindow* aWindow, WPARAM recWParam; LPARAM recLParam; DequeueIMECharRecords(recWParam, recLParam); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnCharOnPlugin, aWindow=%p, wParam=%08x, lParam=%08x,\n", aWindow->GetWindowHandle(), wParam, lParam)); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, (" recorded: wParam=%08x, lParam=%08x\n", recWParam, recLParam)); // If an unexpected char message comes, we should reset the records, @@ -1139,7 +1139,7 @@ nsIMM32Handler::HandleStartComposition(nsWindow* aWindow, aWindow->InitEvent(selection, &point); aWindow->DispatchWindowEvent(&selection); if (!selection.mSucceeded) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleStartComposition, FAILED (NS_QUERY_SELECTED_TEXT)\n")); return; } @@ -1155,7 +1155,7 @@ nsIMM32Handler::HandleStartComposition(nsWindow* aWindow, mIsComposing = true; mComposingWindow = aWindow; - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleStartComposition, START composition, mCompositionStart=%ld\n", mCompositionStart)); } @@ -1189,7 +1189,7 @@ nsIMM32Handler::HandleComposition(nsWindow* aWindow, WinUtils::PeekMessage(&msg2, wnd, WM_IME_ENDCOMPOSITION, WM_IME_COMPOSITION, PM_NOREMOVE) && msg2.message == WM_IME_COMPOSITION) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleComposition, Ignores due to find a WM_IME_STARTCOMPOSITION\n")); return ShouldDrawCompositionStringOurselves(); } @@ -1207,7 +1207,7 @@ nsIMM32Handler::HandleComposition(nsWindow* aWindow, GetCompositionString(aIMEContext, GCS_RESULTSTR, mCompositionString); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleComposition, GCS_RESULTSTR\n")); HandleEndComposition(aWindow, &mCompositionString); @@ -1228,14 +1228,14 @@ nsIMM32Handler::HandleComposition(nsWindow* aWindow, //-------------------------------------------------------- // 1. Get GCS_COMPSTR //-------------------------------------------------------- - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleComposition, GCS_COMPSTR\n")); nsAutoString previousCompositionString(mCompositionString); GetCompositionString(aIMEContext, GCS_COMPSTR, mCompositionString); if (!IS_COMPOSING_LPARAM(lParam)) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleComposition, lParam doesn't indicate composing, " "mCompositionString=\"%s\", previousCompositionString=\"%s\"", NS_ConvertUTF16toUTF8(mCompositionString).get(), @@ -1274,7 +1274,7 @@ nsIMM32Handler::HandleComposition(nsWindow* aWindow, // string is null (it indicates the composition transaction ended), // WM_IME_ENDCOMPOSITION may not be sent. If so, we cannot run // HandleEndComposition() in other place. - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleComposition, Aborting GCS_COMPSTR\n")); HandleEndComposition(aWindow); return IS_COMMITTING_LPARAM(lParam); @@ -1297,7 +1297,7 @@ nsIMM32Handler::HandleComposition(nsWindow* aWindow, // API for it, however, we should not kill Unicode support on all IMEs. bool useA_API = !(sIMEProperty & IME_PROP_UNICODE); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleComposition, GCS_COMPCLAUSE, useA_API=%s\n", useA_API ? "TRUE" : "FALSE")); @@ -1312,7 +1312,7 @@ nsIMM32Handler::HandleComposition(nsWindow* aWindow, clauseArrayLength2 /= sizeof(uint32_t); if (clauseArrayLength != clauseArrayLength2) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleComposition, GCS_COMPCLAUSE, clauseArrayLength=%ld but clauseArrayLength2=%ld\n", clauseArrayLength, clauseArrayLength2)); if (clauseArrayLength > clauseArrayLength2) @@ -1341,7 +1341,7 @@ nsIMM32Handler::HandleComposition(nsWindow* aWindow, // may return an error code. mClauseArray.SetLength(std::max(0, clauseArrayLength)); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleComposition, GCS_COMPCLAUSE, mClauseLength=%ld\n", mClauseArray.Length())); @@ -1367,7 +1367,7 @@ nsIMM32Handler::HandleComposition(nsWindow* aWindow, // error code. mAttributeArray.SetLength(std::max(0, attrArrayLength)); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleComposition, GCS_COMPATTR, mAttributeLength=%ld\n", mAttributeArray.Length())); @@ -1388,7 +1388,7 @@ nsIMM32Handler::HandleComposition(nsWindow* aWindow, NS_ASSERTION(mCursorPosition <= (long)mCompositionString.Length(), "illegal pos"); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleComposition, GCS_CURSORPOS, mCursorPosition=%d\n", mCursorPosition)); @@ -1409,7 +1409,7 @@ nsIMM32Handler::HandleEndComposition(nsWindow* aWindow, NS_PRECONDITION(!aWindow->PluginHasFocus(), "HandleComposition should not be called when a plug-in has focus"); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleEndComposition(aWindow=0x%p, aCommitString=0x%p (\"%s\"))", aWindow, aCommitString, aCommitString ? NS_ConvertUTF16toUTF8(*aCommitString).get() : "")); @@ -1435,15 +1435,15 @@ nsIMM32Handler::HandleEndComposition(nsWindow* aWindow, static void DumpReconvertString(RECONVERTSTRING* aReconv) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, (" dwSize=%ld, dwVersion=%ld, dwStrLen=%ld, dwStrOffset=%ld\n", aReconv->dwSize, aReconv->dwVersion, aReconv->dwStrLen, aReconv->dwStrOffset)); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, (" dwCompStrLen=%ld, dwCompStrOffset=%ld, dwTargetStrLen=%ld, dwTargetStrOffset=%ld\n", aReconv->dwCompStrLen, aReconv->dwCompStrOffset, aReconv->dwTargetStrLen, aReconv->dwTargetStrOffset)); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, (" result str=\"%s\"\n", NS_ConvertUTF16toUTF8( nsAutoString((char16_t*)((char*)(aReconv) + aReconv->dwStrOffset), @@ -1463,7 +1463,7 @@ nsIMM32Handler::HandleReconvert(nsWindow* aWindow, aWindow->InitEvent(selection, &point); aWindow->DispatchWindowEvent(&selection); if (!selection.mSucceeded) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleReconvert, FAILED (NS_QUERY_SELECTED_TEXT)\n")); return false; } @@ -1474,19 +1474,19 @@ nsIMM32Handler::HandleReconvert(nsWindow* aWindow, if (!pReconv) { // Return need size to reconvert. if (len == 0) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleReconvert, There are not selected text\n")); return false; } *oResult = needSize; - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleReconvert, SUCCEEDED result=%ld\n", *oResult)); return true; } if (pReconv->dwSize < needSize) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleReconvert, FAILED pReconv->dwSize=%ld, needSize=%ld\n", pReconv->dwSize, needSize)); return false; @@ -1506,7 +1506,7 @@ nsIMM32Handler::HandleReconvert(nsWindow* aWindow, ::CopyMemory(reinterpret_cast(lParam + sizeof(RECONVERTSTRING)), selection.mReply.mString.get(), len * sizeof(WCHAR)); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleReconvert, SUCCEEDED result=%ld\n", *oResult)); DumpReconvertString(pReconv); @@ -1523,24 +1523,24 @@ nsIMM32Handler::HandleQueryCharPosition(nsWindow* aWindow, *oResult = false; IMECHARPOSITION* pCharPosition = reinterpret_cast(lParam); if (!pCharPosition) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleQueryCharPosition, FAILED (pCharPosition is null)\n")); return false; } if (pCharPosition->dwSize < sizeof(IMECHARPOSITION)) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleReconvert, FAILED, pCharPosition->dwSize=%ld, sizeof(IMECHARPOSITION)=%ld\n", pCharPosition->dwSize, sizeof(IMECHARPOSITION))); return false; } if (::GetFocus() != aWindow->GetWindowHandle()) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleReconvert, FAILED, ::GetFocus()=%08x, OurWindowHandle=%08x\n", ::GetFocus(), aWindow->GetWindowHandle())); return false; } if (pCharPosition->dwCharPos > len) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleQueryCharPosition, FAILED, pCharPosition->dwCharPos=%ld, len=%ld\n", pCharPosition->dwCharPos, len)); return false; @@ -1572,7 +1572,7 @@ nsIMM32Handler::HandleQueryCharPosition(nsWindow* aWindow, aWindow->InitEvent(editorRect); aWindow->DispatchWindowEvent(&editorRect); if (NS_WARN_IF(!editorRect.mSucceeded)) { - PR_LOG(gIMM32Log, PR_LOG_ERROR, + MOZ_LOG(gIMM32Log, LogLevel::Error, ("IMM32: HandleQueryCharPosition, NS_QUERY_EDITOR_RECT failed")); ::GetWindowRect(aWindow->GetWindowHandle(), &pCharPosition->rcDocument); } else { @@ -1589,7 +1589,7 @@ nsIMM32Handler::HandleQueryCharPosition(nsWindow* aWindow, *oResult = TRUE; - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleQueryCharPosition, SUCCEEDED, pCharPosition={ pt={ x=%d, " "y=%d }, cLineHeight=%d, rcDocument={ left=%d, top=%d, right=%d, " "bottom=%d } }", @@ -1618,7 +1618,7 @@ nsIMM32Handler::HandleDocumentFeed(nsWindow* aWindow, aWindow->InitEvent(selection, &point); aWindow->DispatchWindowEvent(&selection); if (!selection.mSucceeded) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleDocumentFeed, FAILED (NS_QUERY_SELECTED_TEXT)\n")); return false; } @@ -1634,7 +1634,7 @@ nsIMM32Handler::HandleDocumentFeed(nsWindow* aWindow, // INT32_MAX. if (targetOffset < 0 || targetLength < 0 || targetOffset + targetLength < 0) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleDocumentFeed, FAILED (The selection is out of range)\n")); return false; } @@ -1645,14 +1645,14 @@ nsIMM32Handler::HandleDocumentFeed(nsWindow* aWindow, aWindow->InitEvent(textContent, &point); aWindow->DispatchWindowEvent(&textContent); if (!textContent.mSucceeded) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleDocumentFeed, FAILED (NS_QUERY_TEXT_CONTENT)\n")); return false; } nsAutoString str(textContent.mReply.mString); if (targetOffset > int32_t(str.Length())) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleDocumentFeed, FAILED (The caret offset is invalid)\n")); return false; } @@ -1673,14 +1673,14 @@ nsIMM32Handler::HandleDocumentFeed(nsWindow* aWindow, if (!pReconv) { *oResult = needSize; - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleDocumentFeed, SUCCEEDED result=%ld\n", *oResult)); return true; } if (pReconv->dwSize < needSize) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleDocumentFeed, FAILED pReconv->dwSize=%ld, needSize=%ld\n", pReconv->dwSize, needSize)); return false; @@ -1697,7 +1697,7 @@ nsIMM32Handler::HandleDocumentFeed(nsWindow* aWindow, // Set composition target clause information uint32_t offset, length; if (!GetTargetClauseRange(&offset, &length)) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleDocumentFeed, FAILED, by GetTargetClauseRange\n")); return false; } @@ -1717,7 +1717,7 @@ nsIMM32Handler::HandleDocumentFeed(nsWindow* aWindow, ::CopyMemory(reinterpret_cast(lParam + sizeof(RECONVERTSTRING)), paragraph.BeginReading(), len * sizeof(WCHAR)); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: HandleDocumentFeed, SUCCEEDED result=%ld\n", *oResult)); DumpReconvertString(pReconv); @@ -1732,7 +1732,7 @@ nsIMM32Handler::CommitCompositionOnPreviousWindow(nsWindow* aWindow) return false; } - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: CommitCompositionOnPreviousWindow, mIsComposing=%s, mIsComposingOnPlugin=%s\n", mIsComposing ? "TRUE" : "FALSE", mIsComposingOnPlugin ? "TRUE" : "FALSE")); @@ -1795,7 +1795,7 @@ nsIMM32Handler::DispatchCompositionChangeEvent(nsWindow* aWindow, const nsIMEContext& aIMEContext) { NS_ASSERTION(mIsComposing, "conflict state"); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: DispatchCompositionChangeEvent")); // If we don't need to draw composition string ourselves, we don't need to @@ -1848,7 +1848,7 @@ nsIMM32Handler::CreateTextRangeArray() range.mRangeType = NS_TEXTRANGE_RAWINPUT; textRangeArray->AppendElement(range); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: CreateTextRangeArray, mClauseLength=0\n")); } else { // iterate over the attributes @@ -1856,7 +1856,7 @@ nsIMM32Handler::CreateTextRangeArray() for (uint32_t i = 0; i < mClauseArray.Length() - 1; i++) { uint32_t current = mClauseArray[i + 1]; if (current > mCompositionString.Length()) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: CreateTextRangeArray, mClauseArray[%ld]=%lu. " "This is larger than mCompositionString.Length()=%lu\n", i + 1, current, mCompositionString.Length())); @@ -1870,7 +1870,7 @@ nsIMM32Handler::CreateTextRangeArray() lastOffset = current; - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: CreateTextRangeArray, index=%ld, rangeType=%s, range=[%lu-%lu]\n", i, GetRangeTypeName(range.mRangeType), range.mStartOffset, range.mEndOffset)); @@ -1878,14 +1878,14 @@ nsIMM32Handler::CreateTextRangeArray() } if (mCursorPosition == NO_IME_CARET) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: CreateTextRangeArray, no caret\n")); return textRangeArray.forget(); } int32_t cursor = mCursorPosition; if (uint32_t(cursor) > mCompositionString.Length()) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: CreateTextRangeArray, mCursorPosition=%ld. " "This is larger than mCompositionString.Length()=%lu\n", mCursorPosition, mCompositionString.Length())); @@ -1896,7 +1896,7 @@ nsIMM32Handler::CreateTextRangeArray() range.mRangeType = NS_TEXTRANGE_CARETPOSITION; textRangeArray->AppendElement(range); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: CreateTextRangeArray, caret position=%ld\n", range.mStartOffset)); @@ -1915,7 +1915,7 @@ nsIMM32Handler::GetCompositionString(const nsIMEContext &aIMEContext, if (lRtn < 0 || !aCompositionString.SetLength((lRtn / sizeof(WCHAR)) + 1, mozilla::fallible)) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: GetCompositionString, FAILED by OOM\n")); return; // Error or out of memory. } @@ -1926,7 +1926,7 @@ nsIMM32Handler::GetCompositionString(const nsIMEContext &aIMEContext, lRtn + sizeof(WCHAR)); aCompositionString.SetLength(lRtn / sizeof(WCHAR)); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: GetCompositionString, SUCCEEDED aCompositionString=\"%s\"\n", NS_ConvertUTF16toUTF8(aCompositionString).get())); } @@ -1982,7 +1982,7 @@ nsIMM32Handler::ConvertToANSIString(const nsAFlatString& aStr, UINT aCodePage, NS_ENSURE_TRUE(len >= 0, false); if (!aANSIStr.SetLength(len, mozilla::fallible)) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: ConvertToANSIString, FAILED by OOM\n")); return false; } @@ -2003,7 +2003,7 @@ nsIMM32Handler::GetCharacterRectOfSelectedTextAt(nsWindow* aWindow, aWindow->InitEvent(selection, &point); aWindow->DispatchWindowEvent(&selection); if (!selection.mSucceeded) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: GetCharacterRectOfSelectedTextAt, aOffset=%lu, FAILED (NS_QUERY_SELECTED_TEXT)\n", aOffset)); return false; @@ -2035,10 +2035,10 @@ nsIMM32Handler::GetCharacterRectOfSelectedTextAt(nsWindow* aWindow, if (aWritingMode) { *aWritingMode = charRect.GetWritingMode(); } - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: GetCharacterRectOfSelectedTextAt, aOffset=%lu, SUCCEEDED\n", aOffset)); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: GetCharacterRectOfSelectedTextAt, " "aCharRect={ x: %ld, y: %ld, width: %ld, height: %ld }, " "charRect.GetWritingMode()=%s", @@ -2062,7 +2062,7 @@ nsIMM32Handler::GetCaretRect(nsWindow* aWindow, aWindow->InitEvent(selection, &point); aWindow->DispatchWindowEvent(&selection); if (!selection.mSucceeded) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: GetCaretRect, FAILED (NS_QUERY_SELECTED_TEXT)\n")); return false; } @@ -2074,7 +2074,7 @@ nsIMM32Handler::GetCaretRect(nsWindow* aWindow, aWindow->InitEvent(caretRect, &point); aWindow->DispatchWindowEvent(&caretRect); if (!caretRect.mSucceeded) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: GetCaretRect, FAILED (NS_QUERY_CARET_RECT)\n")); return false; } @@ -2082,7 +2082,7 @@ nsIMM32Handler::GetCaretRect(nsWindow* aWindow, if (aWritingMode) { *aWritingMode = caretRect.GetWritingMode(); } - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: GetCaretRect, SUCCEEDED, " "aCaretRect={ x: %ld, y: %ld, width: %ld, height: %ld }, " "caretRect.GetWritingMode()=%s", @@ -2118,7 +2118,7 @@ nsIMM32Handler::SetIMERelatedWindowsPos(nsWindow* aWindow, if (!mNativeCaretIsCreated) { mNativeCaretIsCreated = ::CreateCaret(aWindow->GetWindowHandle(), nullptr, caretRect.width, caretRect.height); - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: SetIMERelatedWindowsPos, mNativeCaretIsCreated=%s, width=%ld height=%ld\n", mNativeCaretIsCreated ? "TRUE" : "FALSE", caretRect.width, caretRect.height)); @@ -2126,7 +2126,7 @@ nsIMM32Handler::SetIMERelatedWindowsPos(nsWindow* aWindow, ::SetCaretPos(caretRect.x, caretRect.y); if (ShouldDrawCompositionStringOurselves()) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: SetIMERelatedWindowsPos, Set candidate window\n")); // Get a rect of first character in current target in composition string. @@ -2136,7 +2136,7 @@ nsIMM32Handler::SetIMERelatedWindowsPos(nsWindow* aWindow, // rect instead. uint32_t offset, length; if (!GetTargetClauseRange(&offset, &length)) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: SetIMERelatedWindowsPos, FAILED, by GetTargetClauseRange\n")); return false; } @@ -2208,7 +2208,7 @@ nsIMM32Handler::SetIMERelatedWindowsPos(nsWindow* aWindow, candForm.ptCurrentPos.x = targetClauseRect.x; candForm.ptCurrentPos.y = targetClauseRect.YMost(); } - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: SetIMERelatedWindowsPos, Calling ImmSetCandidateWindow()... " "ptCurrentPos={ x=%d, y=%d }, " "rcArea={ left=%d, top=%d, right=%d, bottom=%d }, " @@ -2219,7 +2219,7 @@ nsIMM32Handler::SetIMERelatedWindowsPos(nsWindow* aWindow, GetWritingModeName(writingMode).get())); ::ImmSetCandidateWindow(aIMEContext.get(), &candForm); } else { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: SetIMERelatedWindowsPos, Set composition window\n")); // Move the composition window to caret position (if selected some @@ -2246,7 +2246,7 @@ nsIMM32Handler::SetIMERelatedWindowsPosOnPlugin(nsWindow* aWindow, aWindow->InitEvent(editorRectEvent); aWindow->DispatchWindowEvent(&editorRectEvent); if (!editorRectEvent.mSucceeded) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: SetIMERelatedWindowsPosOnPlugin, " "FAILED (NS_QUERY_EDITOR_RECT)")); return; @@ -2293,7 +2293,7 @@ nsIMM32Handler::SetIMERelatedWindowsPosOnPlugin(nsWindow* aWindow, compForm.ptCurrentPos.x = clippedPluginRect.BottomLeft().x; compForm.ptCurrentPos.y = clippedPluginRect.BottomLeft().y; if (!::ImmSetCompositionWindow(aIMEContext.get(), &compForm)) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: SetIMERelatedWindowsPosOnPlugin, " "FAILED to set composition window")); return; @@ -2388,7 +2388,7 @@ nsIMM32Handler::AdjustCompositionFont(const nsIMEContext& aIMEContext, LOGFONTW defaultLogFont; if (NS_WARN_IF(!::ImmGetCompositionFont(aIMEContext.get(), &defaultLogFont))) { - PR_LOG(gIMM32Log, PR_LOG_ERROR, + MOZ_LOG(gIMM32Log, LogLevel::Error, ("IMM32: AdjustCompositionFont, ::ImmGetCompositionFont() failed")); sCompositionFont.AssignLiteral("System"); } else { @@ -2397,7 +2397,7 @@ nsIMM32Handler::AdjustCompositionFont(const nsIMEContext& aIMEContext, } } - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: AdjustCompositionFont, sCompositionFont=\"%s\" is initialized", NS_ConvertUTF16toUTF8(sCompositionFont).get())); } @@ -2423,7 +2423,7 @@ nsIMM32Handler::AdjustCompositionFont(const nsIMEContext& aIMEContext, LOGFONTW logFont; memset(&logFont, 0, sizeof(logFont)); if (!::ImmGetCompositionFont(aIMEContext.get(), &logFont)) { - PR_LOG(gIMM32Log, PR_LOG_ERROR, + MOZ_LOG(gIMM32Log, LogLevel::Error, ("IMM32: AdjustCompositionFont, ::ImmGetCompositionFont() failed")); logFont.lfFaceName[0] = 0; } @@ -2444,7 +2444,7 @@ nsIMM32Handler::AdjustCompositionFont(const nsIMEContext& aIMEContext, IsJapanist2003Active() ? sCompositionFontForJapanist2003 : sCompositionFont, logFont); } - PR_LOG(gIMM32Log, PR_LOG_WARNING, + MOZ_LOG(gIMM32Log, LogLevel::Warning, ("IMM32: AdjustCompositionFont, calling ::ImmSetCompositionFont(\"%s\")", NS_ConvertUTF16toUTF8(nsDependentString(logFont.lfFaceName)).get())); ::ImmSetCompositionFontW(aIMEContext.get(), &logFont); @@ -2523,7 +2523,7 @@ nsIMM32Handler::OnMouseButtonEvent(nsWindow* aWindow, offset++; } - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnMouseButtonEvent, x,y=%ld,%ld, offset=%ld, positioning=%ld\n", cursorPos.x, cursorPos.y, offset, positioning)); @@ -2542,7 +2542,7 @@ nsIMM32Handler::OnMouseButtonEvent(nsWindow* aWindow, nsIMM32Handler::OnKeyDownEvent(nsWindow* aWindow, WPARAM wParam, LPARAM lParam, MSGResult& aResult) { - PR_LOG(gIMM32Log, PR_LOG_ALWAYS, + MOZ_LOG(gIMM32Log, LogLevel::Info, ("IMM32: OnKeyDownEvent, hWnd=%08x, wParam=%08x, lParam=%08x\n", aWindow->GetWindowHandle(), wParam, lParam)); aResult.mConsumed = false; diff --git a/widget/windows/nsNativeThemeWin.cpp b/widget/windows/nsNativeThemeWin.cpp index eb3e6ce947..4a4f4fac61 100644 --- a/widget/windows/nsNativeThemeWin.cpp +++ b/widget/windows/nsNativeThemeWin.cpp @@ -1626,10 +1626,10 @@ RENDER_AGAIN: #if 0 { - PR_LOG(gWindowsLog, PR_LOG_ERROR, + MOZ_LOG(gWindowsLog, LogLevel::Error, (stderr, "xform: %f %f %f %f [%f %f]\n", m._11, m._21, m._12, m._22, m._31, m._32)); - PR_LOG(gWindowsLog, PR_LOG_ERROR, + MOZ_LOG(gWindowsLog, LogLevel::Error, (stderr, "tr: [%d %d %d %d]\ndr: [%d %d %d %d]\noff: [%f %f]\n", tr.x, tr.y, tr.width, tr.height, dr.x, dr.y, dr.width, dr.height, offset.x, offset.y)); diff --git a/widget/windows/nsSound.cpp b/widget/windows/nsSound.cpp index dd3efb5a67..cce91d23a7 100644 --- a/widget/windows/nsSound.cpp +++ b/widget/windows/nsSound.cpp @@ -27,6 +27,8 @@ #include "nsNativeCharsetUtils.h" #include "nsThreadUtils.h" +using mozilla::LogLevel; + PRLogModuleInfo* gWin32SoundLog = nullptr; class nsSoundPlayer: public nsRunnable { @@ -167,7 +169,7 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader, if (uri) { nsAutoCString uriSpec; uri->GetSpec(uriSpec); - PR_LOG(gWin32SoundLog, PR_LOG_ALWAYS, + MOZ_LOG(gWin32SoundLog, LogLevel::Info, ("Failed to load %s\n", uriSpec.get())); } } @@ -201,7 +203,7 @@ NS_IMETHODIMP nsSound::Play(nsIURL *aURL) #ifdef DEBUG_SOUND char *url; aURL->GetSpec(&url); - PR_LOG(gWin32SoundLog, PR_LOG_ALWAYS, + MOZ_LOG(gWin32SoundLog, LogLevel::Info, ("%s\n", url)); #endif diff --git a/widget/windows/nsTextStore.cpp b/widget/windows/nsTextStore.cpp index 62924a51ce..c90557187c 100644 --- a/widget/windows/nsTextStore.cpp +++ b/widget/windows/nsTextStore.cpp @@ -31,9 +31,9 @@ static const char* kPrefNameForceEnableTSF = "intl.tsf.force_enable"; * TSF related code should log its behavior even on release build especially * in the interface methods. * - * In interface methods, use PR_LOG_ALWAYS. - * In internal methods, use PR_LOG_DEBUG for logging normal behavior. - * For logging error, use PR_LOG_ERROR. + * In interface methods, use LogLevel::Info. + * In internal methods, use LogLevel::Debug for logging normal behavior. + * For logging error, use LogLevel::Error. * * When an instance method is called, start with following text: * "TSF: 0x%p nsFoo::Bar(", the 0x%p should be the "this" of the nsFoo. @@ -641,7 +641,7 @@ public: InputScopeImpl(const nsTArray& aList) : mInputScopes(aList) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p InputScopeImpl()", this)); } @@ -821,7 +821,7 @@ TSFStaticSink::Init(ITfThreadMgr* aThreadMgr, HRESULT hr = mThreadMgr->QueryInterface(IID_ITfSource, getter_AddRefs(source)); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p TSFStaticSink::Init() FAILED to get ITfSource " "instance (0x%08X)", this, hr)); return false; @@ -836,7 +836,7 @@ TSFStaticSink::Init(ITfThreadMgr* aThreadMgr, static_cast(this), &mIPProfileCookie); if (FAILED(hr) || mIPProfileCookie == TF_INVALID_COOKIE) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p TSFStaticSink::Init() FAILED to install " "ITfInputProcessorProfileActivationSink (0x%08X)", this, hr)); return false; @@ -846,14 +846,14 @@ TSFStaticSink::Init(ITfThreadMgr* aThreadMgr, static_cast(this), &mLangProfileCookie); if (FAILED(hr) || mLangProfileCookie == TF_INVALID_COOKIE) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, PR_LOG_ERROR, ("TSF: 0x%p TSFStaticSink::Init() FAILED to install " "ITfActiveLanguageProfileNotifySink (0x%08X)", this, hr)); return false; } } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, PR_LOG_INFO, ("TSF: 0x%p TSFStaticSink::Init(), " "mIPProfileCookie=0x%08X, mLangProfileCookie=0x%08X", this, mIPProfileCookie, mLangProfileCookie)); @@ -863,7 +863,7 @@ TSFStaticSink::Init(ITfThreadMgr* aThreadMgr, void TSFStaticSink::Destroy() { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p TSFStaticSink::Shutdown() " "mIPProfileCookie=0x%08X, mLangProfileCookie=0x%08X", this, mIPProfileCookie, mLangProfileCookie)); @@ -873,13 +873,13 @@ TSFStaticSink::Destroy() HRESULT hr = mThreadMgr->QueryInterface(IID_ITfSource, getter_AddRefs(source)); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p TSFStaticSink::Shutdown() FAILED to get " "ITfSource instance (0x%08X)", this, hr)); } else { hr = source->UnadviseSink(mIPProfileCookie); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::Shutdown() FAILED to uninstall " "ITfInputProcessorProfileActivationSink (0x%08X)", this, hr)); @@ -892,13 +892,13 @@ TSFStaticSink::Destroy() HRESULT hr = mThreadMgr->QueryInterface(IID_ITfSource, getter_AddRefs(source)); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p TSFStaticSink::Shutdown() FAILED to get " "ITfSource instance (0x%08X)", this, hr)); } else { hr = source->UnadviseSink(mLangProfileCookie); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p TSFStaticSink::Shutdown() FAILED to uninstall " "ITfActiveLanguageProfileNotifySink (0x%08X)", this, hr)); @@ -923,7 +923,7 @@ TSFStaticSink::OnActivated(REFCLSID clsid, REFGUID guidProfile, LANGID langID; HRESULT hr = mInputProcessorProfiles->GetCurrentLanguage(&langID); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: TSFStaticSink::OnActivated() FAILED due to " "GetCurrentLanguage() failure, hr=0x%08X", hr)); } else if (IsTIPCategoryKeyboard(clsid, langID, guidProfile)) { @@ -935,7 +935,7 @@ TSFStaticSink::OnActivated(REFCLSID clsid, REFGUID guidProfile, } } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p TSFStaticSink::OnActivated(rclsid=%s, guidProfile=%s, " "fActivated=%s), mIsIMM_IME=%s, mActiveTIPDescription=\"%s\"", this, GetCLSIDNameStr(clsid).get(), @@ -965,7 +965,7 @@ TSFStaticSink::OnActivated(DWORD dwProfileType, GetTIPDescription(rclsid, langid, guidProfile, mActiveTIPKeyboardDescription); } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p TSFStaticSink::OnActivated(dwProfileType=%s (0x%08X), " "langid=0x%08X, rclsid=%s, catid=%s, guidProfile=%s, hkl=0x%08X, " "dwFlags=0x%08X (TF_IPSINK_FLAG_ACTIVE: %s)), mIsIMM_IME=%s, " @@ -995,7 +995,7 @@ TSFStaticSink::EnsureInitActiveTIPKeyboard() mInputProcessorProfiles->QueryInterface(IID_ITfInputProcessorProfileMgr, getter_AddRefs(profileMgr)); if (FAILED(hr) || !profileMgr) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), FAILED " "to get input processor profile manager, hr=0x%08X", this, hr)); return false; @@ -1004,7 +1004,7 @@ TSFStaticSink::EnsureInitActiveTIPKeyboard() TF_INPUTPROCESSORPROFILE profile; hr = profileMgr->GetActiveProfile(GUID_TFCAT_TIP_KEYBOARD, &profile); if (hr == S_FALSE) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), FAILED " "to get active keyboard layout profile due to no active profile, " "hr=0x%08X", this, hr)); @@ -1013,13 +1013,13 @@ TSFStaticSink::EnsureInitActiveTIPKeyboard() return false; } if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), FAILED " "to get active TIP keyboard, hr=0x%08X", this, hr)); return false; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), " "calling OnActivated() manually...", this)); OnActivated(profile.dwProfileType, profile.langid, profile.clsid, @@ -1031,7 +1031,7 @@ TSFStaticSink::EnsureInitActiveTIPKeyboard() LANGID langID; HRESULT hr = mInputProcessorProfiles->GetCurrentLanguage(&langID); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, PR_LOG_ERROR, ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), FAILED " "to get current language ID, hr=0x%08X", this, hr)); return false; @@ -1041,7 +1041,7 @@ TSFStaticSink::EnsureInitActiveTIPKeyboard() hr = mInputProcessorProfiles->EnumLanguageProfiles(langID, getter_AddRefs(enumLangProfiles)); if (FAILED(hr) || !enumLangProfiles) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, PR_LOG_ERROR, ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), FAILED " "to get language profiles enumerator, hr=0x%08X", this, hr)); return false; @@ -1053,7 +1053,7 @@ TSFStaticSink::EnsureInitActiveTIPKeyboard() if (!profile.fActive || profile.catid != GUID_TFCAT_TIP_KEYBOARD) { continue; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, PR_LOG_INFO, ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), " "calling OnActivated() manually...", this)); bool isTIP = profile.guidProfile != GUID_NULL; @@ -1065,7 +1065,7 @@ TSFStaticSink::EnsureInitActiveTIPKeyboard() return true; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, PR_LOG_INFO, ("TSF: 0x%p TSFStaticSink::EnsureInitActiveLanguageProfile(), " "calling OnActivated() without active TIP manually...", this)); OnActivated(TF_PROFILETYPE_KEYBOARDLAYOUT, @@ -1092,7 +1092,7 @@ TSFStaticSink::GetTIPDescription(REFCLSID aTextService, LANGID aLangID, aProfile, &description); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p TSFStaticSink::InitActiveTIPDescription() FAILED " "due to GetLanguageProfileDescription() failure, hr=0x%08X", this, hr)); @@ -1118,7 +1118,7 @@ TSFStaticSink::IsTIPCategoryKeyboard(REFCLSID aTextService, LANGID aLangID, mInputProcessorProfiles->EnumLanguageProfiles(aLangID, getter_AddRefs(enumLangProfiles)); if (FAILED(hr) || !enumLangProfiles) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p TSFStaticSink::IsTIPCategoryKeyboard(), FAILED " "to get language profiles enumerator, hr=0x%08X", this, hr)); return false; @@ -1200,27 +1200,27 @@ nsTextStore::nsTextStore() // We hope that 5 or more actions don't occur at once. mPendingActions.SetCapacity(5); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::nsTestStore() SUCCEEDED", this)); } nsTextStore::~nsTextStore() { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore instance is destroyed", this)); } bool nsTextStore::Init(nsWindowBase* aWidget) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::Init(aWidget=0x%p)", this, aWidget)); TSFStaticSink::GetInstance()->EnsureInitActiveTIPKeyboard(); if (mDocumentMgr) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::Init() FAILED due to already initialized", this)); return false; @@ -1229,7 +1229,7 @@ nsTextStore::Init(nsWindowBase* aWidget) // Create document manager HRESULT hr = sThreadMgr->CreateDocumentMgr(getter_AddRefs(mDocumentMgr)); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::Init() FAILED to create DocumentMgr " "(0x%08X)", this, hr)); return false; @@ -1241,7 +1241,7 @@ nsTextStore::Init(nsWindowBase* aWidget) static_cast(this), getter_AddRefs(mContext), &mEditCookie); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::Init() FAILED to create the context " "(0x%08X)", this, hr)); mDocumentMgr = nullptr; @@ -1250,7 +1250,7 @@ nsTextStore::Init(nsWindowBase* aWidget) hr = mDocumentMgr->Push(mContext); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::Init() FAILED to push the context (0x%08X)", this, hr)); // XXX Why don't we use NS_IF_RELEASE() here?? @@ -1259,7 +1259,7 @@ nsTextStore::Init(nsWindowBase* aWidget) return false; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::Init() succeeded: " "mDocumentMgr=0x%p, mContext=0x%p, mEditCookie=0x%08X", this, mDocumentMgr.get(), mContext.get(), mEditCookie)); @@ -1270,7 +1270,7 @@ nsTextStore::Init(nsWindowBase* aWidget) bool nsTextStore::Destroy() { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::Destroy(), mLock=%s, " "mComposition.IsComposing()=%s", this, GetLockFlagNameStr(mLock).get(), @@ -1300,13 +1300,13 @@ nsTextStore::Destroy() mWidget = nullptr; if (!mMouseTrackers.IsEmpty()) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::Destroy(), removing a mouse tracker...", this)); mMouseTrackers.Clear(); } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::Destroy() succeeded", this)); return true; } @@ -1328,7 +1328,7 @@ nsTextStore::QueryInterface(REFIID riid, return S_OK; } - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::QueryInterface() FAILED, riid=%s", this, GetRIIDNameStr(riid).get())); return E_NOINTERFACE; @@ -1339,21 +1339,21 @@ nsTextStore::AdviseSink(REFIID riid, IUnknown *punk, DWORD dwMask) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::AdviseSink(riid=%s, punk=0x%p, dwMask=%s), " "mSink=0x%p, mSinkMask=%s", this, GetRIIDNameStr(riid).get(), punk, GetSinkMaskNameStr(dwMask).get(), mSink.get(), GetSinkMaskNameStr(mSinkMask).get())); if (!punk) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::AdviseSink() FAILED due to the null punk", this)); return E_UNEXPECTED; } if (IID_ITextStoreACPSink != riid) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::AdviseSink() FAILED due to " "unsupported interface", this)); return E_INVALIDARG; // means unsupported interface. @@ -1363,7 +1363,7 @@ nsTextStore::AdviseSink(REFIID riid, // Install sink punk->QueryInterface(IID_ITextStoreACPSink, getter_AddRefs(mSink)); if (!mSink) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::AdviseSink() FAILED due to " "punk not having the interface", this)); return E_UNEXPECTED; @@ -1375,7 +1375,7 @@ nsTextStore::AdviseSink(REFIID riid, punk->QueryInterface(IID_IUnknown, getter_AddRefs(comparison1)); mSink->QueryInterface(IID_IUnknown, getter_AddRefs(comparison2)); if (comparison1 != comparison2) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::AdviseSink() FAILED due to " "the sink being different from the stored sink", this)); return CONNECT_E_ADVISELIMIT; @@ -1389,18 +1389,18 @@ nsTextStore::AdviseSink(REFIID riid, STDMETHODIMP nsTextStore::UnadviseSink(IUnknown *punk) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::UnadviseSink(punk=0x%p), mSink=0x%p", this, punk, mSink.get())); if (!punk) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::UnadviseSink() FAILED due to the null punk", this)); return E_INVALIDARG; } if (!mSink) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::UnadviseSink() FAILED due to " "any sink not stored", this)); return CONNECT_E_NOCONNECTION; @@ -1411,7 +1411,7 @@ nsTextStore::UnadviseSink(IUnknown *punk) mSink->QueryInterface(IID_IUnknown, getter_AddRefs(comparison2)); // Unadvise only if sinks are the same if (comparison1 != comparison2) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::UnadviseSink() FAILED due to " "the sink being different from the stored sink", this)); return CONNECT_E_NOCONNECTION; @@ -1425,19 +1425,19 @@ STDMETHODIMP nsTextStore::RequestLock(DWORD dwLockFlags, HRESULT *phrSession) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RequestLock(dwLockFlags=%s, phrSession=0x%p), " "mLock=%s", this, GetLockFlagNameStr(dwLockFlags).get(), phrSession, GetLockFlagNameStr(mLock).get())); if (!mSink) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RequestLock() FAILED due to " "any sink not stored", this)); return E_FAIL; } if (!phrSession) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RequestLock() FAILED due to " "null phrSession", this)); return E_INVALIDARG; @@ -1446,7 +1446,7 @@ nsTextStore::RequestLock(DWORD dwLockFlags, if (!mLock) { // put on lock mLock = dwLockFlags & (~TS_LF_SYNC); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p Locking (%s) >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", this, GetLockFlagNameStr(mLock).get())); @@ -1454,7 +1454,7 @@ nsTextStore::RequestLock(DWORD dwLockFlags, // TSF but they don't grab us during this call. nsRefPtr kungFuDeathGrip(this); *phrSession = mSink->OnLockGranted(mLock); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p Unlocked (%s) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", this, GetLockFlagNameStr(mLock).get())); @@ -1462,12 +1462,12 @@ nsTextStore::RequestLock(DWORD dwLockFlags, while (mLockQueued) { mLock = mLockQueued; mLockQueued = 0; - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p Locking for the request in the queue (%s) >>>>>>>>>>>>>>" ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", this, GetLockFlagNameStr(mLock).get())); mSink->OnLockGranted(mLock); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p Unlocked (%s) <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<", this, GetLockFlagNameStr(mLock).get())); @@ -1480,7 +1480,7 @@ nsTextStore::RequestLock(DWORD dwLockFlags, if (!mPendingDestroy && mPendingOnLayoutChange) { mPendingOnLayoutChange = false; if (mSink) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RequestLock(), " "calling ITextStoreACPSink::OnLayoutChange()...", this)); mSink->OnLayoutChange(TS_LC_CHANGE, TEXTSTORE_DEFAULT_VIEW); @@ -1492,7 +1492,7 @@ nsTextStore::RequestLock(DWORD dwLockFlags, mContext->QueryInterface(IID_ITfContextOwnerServices, getter_AddRefs(service)); if (service) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RequestLock(), " "calling ITfContextOwnerServices::OnLayoutChange()...", this)); @@ -1504,7 +1504,7 @@ nsTextStore::RequestLock(DWORD dwLockFlags, if (!mPendingDestroy && mPendingOnSelectionChange) { mPendingOnSelectionChange = false; if (mSink) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RequestLock(), " "calling ITextStoreACPSink::OnSelectionChange()...", this)); mSink->OnSelectionChange(); @@ -1515,7 +1515,7 @@ nsTextStore::RequestLock(DWORD dwLockFlags, Destroy(); } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RequestLock() succeeded: *phrSession=%s", this, GetTextStoreReturnValueName(*phrSession))); return S_OK; @@ -1528,14 +1528,14 @@ nsTextStore::RequestLock(DWORD dwLockFlags, *phrSession = TS_S_ASYNC; mLockQueued = dwLockFlags & (~TS_LF_SYNC); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RequestLock() stores the request in the " "queue, *phrSession=TS_S_ASYNC", this)); return S_OK; } // no more locks allowed - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RequestLock() didn't allow to lock, " "*phrSession=TS_E_SYNCHRONOUS", this)); *phrSession = TS_E_SYNCHRONOUS; @@ -1585,7 +1585,7 @@ nsTextStore::FlushPendingActions() PendingAction& action = mPendingActions[i]; switch (action.mType) { case PendingAction::COMPOSITION_START: { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::FlushPendingActions() " "flushing COMPOSITION_START={ mSelectionStart=%d, " "mSelectionLength=%d }", @@ -1600,13 +1600,13 @@ nsTextStore::FlushPendingActions() selectionSet.mReversed = false; mWidget->DispatchWindowEvent(&selectionSet); if (!selectionSet.mSucceeded) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::FlushPendingActions() " "FAILED due to NS_SELECTION_SET failure", this)); break; } } - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::FlushPendingActions() " "dispatching compositionstart event...", this)); WidgetCompositionEvent compositionStart(true, NS_COMPOSITION_START, @@ -1619,7 +1619,7 @@ nsTextStore::FlushPendingActions() break; } case PendingAction::COMPOSITION_UPDATE: { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::FlushPendingActions() " "flushing COMPOSITION_UPDATE={ mData=\"%s\", " "mRanges=0x%p, mRanges->Length()=%d }", @@ -1660,7 +1660,7 @@ nsTextStore::FlushPendingActions() action.mData.ReplaceSubstring(NS_LITERAL_STRING("\r\n"), NS_LITERAL_STRING("\n")); - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::FlushPendingActions(), " "dispatching compositionchange event...", this)); WidgetCompositionEvent compositionChange(true, NS_COMPOSITION_CHANGE, @@ -1680,7 +1680,7 @@ nsTextStore::FlushPendingActions() break; } case PendingAction::COMPOSITION_END: { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::FlushPendingActions() " "flushing COMPOSITION_END={ mData=\"%s\" }", this, NS_ConvertUTF16toUTF8(action.mData).get())); @@ -1688,7 +1688,7 @@ nsTextStore::FlushPendingActions() action.mData.ReplaceSubstring(NS_LITERAL_STRING("\r\n"), NS_LITERAL_STRING("\n")); - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::FlushPendingActions(), " "dispatching compositioncommit event...", this)); WidgetCompositionEvent compositionCommit(true, NS_COMPOSITION_COMMIT, @@ -1702,7 +1702,7 @@ nsTextStore::FlushPendingActions() break; } case PendingAction::SELECTION_SET: { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::FlushPendingActions() " "flushing SELECTION_SET={ mSelectionStart=%d, " "mSelectionLength=%d, mSelectionReversed=%s }", @@ -1725,7 +1725,7 @@ nsTextStore::FlushPendingActions() continue; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::FlushPendingActions(), " "qutting since the mWidget has gone", this)); break; @@ -1736,11 +1736,11 @@ nsTextStore::FlushPendingActions() STDMETHODIMP nsTextStore::GetStatus(TS_STATUS *pdcs) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetStatus(pdcs=0x%p)", this, pdcs)); if (!pdcs) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetStatus() FAILED due to null pdcs", this)); return E_INVALIDARG; } @@ -1757,20 +1757,20 @@ nsTextStore::QueryInsert(LONG acpTestStart, LONG *pacpResultStart, LONG *pacpResultEnd) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::QueryInsert(acpTestStart=%ld, " "acpTestEnd=%ld, cch=%lu, pacpResultStart=0x%p, pacpResultEnd=0x%p)", this, acpTestStart, acpTestEnd, cch, acpTestStart, acpTestEnd)); if (!pacpResultStart || !pacpResultEnd) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::QueryInsert() FAILED due to " "the null argument", this)); return E_INVALIDARG; } if (acpTestStart < 0 || acpTestStart > acpTestEnd) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::QueryInsert() FAILED due to " "wrong argument", this)); return E_INVALIDARG; @@ -1781,7 +1781,7 @@ nsTextStore::QueryInsert(LONG acpTestStart, *pacpResultStart = acpTestStart; *pacpResultEnd = acpTestStart + cch; - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::QueryInsert() succeeded: " "*pacpResultStart=%ld, *pacpResultEnd=%ld)", this, *pacpResultStart, *pacpResultEnd)); @@ -1794,19 +1794,19 @@ nsTextStore::GetSelection(ULONG ulIndex, TS_SELECTION_ACP *pSelection, ULONG *pcFetched) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetSelection(ulIndex=%lu, ulCount=%lu, " "pSelection=0x%p, pcFetched=0x%p)", this, ulIndex, ulCount, pSelection, pcFetched)); if (!IsReadLocked()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetSelection() FAILED due to not locked", this)); return TS_E_NOLOCK; } if (!ulCount || !pSelection || !pcFetched) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetSelection() FAILED due to " "null argument", this)); return E_INVALIDARG; @@ -1816,7 +1816,7 @@ nsTextStore::GetSelection(ULONG ulIndex, if (ulIndex != static_cast(TS_DEFAULT_SELECTION) && ulIndex != 0) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetSelection() FAILED due to " "unsupported selection", this)); return TS_E_NOSELECTION; @@ -1824,14 +1824,14 @@ nsTextStore::GetSelection(ULONG ulIndex, Selection& currentSel = CurrentSelection(); if (currentSel.IsDirty()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetSelection() FAILED due to " "CurrentSelection() failure", this)); return E_FAIL; } *pSelection = currentSel.ACP(); *pcFetched = 1; - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetSelection() succeeded", this)); return S_OK; } @@ -1862,7 +1862,7 @@ nsTextStore::LockedContent() mLockedContent.Init(text); } - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::LockedContent(): " "mLockedContent={ mText.Length()=%d }", this, mLockedContent.Text().Length())); @@ -1915,7 +1915,7 @@ nsTextStore::CurrentSelection() querySelection.GetWritingMode()); } - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::CurrentSelection(): " "acpStart=%d, acpEnd=%d (length=%d), reverted=%s", this, mSelection.StartOffset(), mSelection.EndOffset(), @@ -1966,10 +1966,10 @@ nsTextStore::GetDisplayAttribute(ITfProperty* aAttrProperty, HRESULT hr; - if (PR_LOG_TEST(sTextStoreLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(sTextStoreLog, LogLevel::Debug)) { LONG start = 0, length = 0; hr = GetRangeExtent(aRange, &start, &length); - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::GetDisplayAttribute(): " "GetDisplayAttribute range=%ld-%ld (hr=%s)", this, start - mComposition.mStart, @@ -1981,13 +1981,13 @@ nsTextStore::GetDisplayAttribute(ITfProperty* aAttrProperty, ::VariantInit(&propValue); hr = aAttrProperty->GetValue(TfEditCookie(mEditCookie), aRange, &propValue); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetDisplayAttribute() FAILED due to " "ITfProperty::GetValue() failed", this)); return hr; } if (VT_I4 != propValue.vt) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetDisplayAttribute() FAILED due to " "ITfProperty::GetValue() returns non-VT_I4 value", this)); ::VariantClear(&propValue); @@ -1999,7 +1999,7 @@ nsTextStore::GetDisplayAttribute(ITfProperty* aAttrProperty, hr = sCategoryMgr->GetGUID(DWORD(propValue.lVal), &guid); ::VariantClear(&propValue); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetDisplayAttribute() FAILED due to " "ITfCategoryMgr::GetGUID() failed", this)); return hr; @@ -2010,7 +2010,7 @@ nsTextStore::GetDisplayAttribute(ITfProperty* aAttrProperty, hr = sDisplayAttrMgr->GetDisplayAttributeInfo(guid, getter_AddRefs(info), nullptr); if (FAILED(hr) || !info) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetDisplayAttribute() FAILED due to " "ITfDisplayAttributeMgr::GetDisplayAttributeInfo() failed", this)); return hr; @@ -2018,13 +2018,13 @@ nsTextStore::GetDisplayAttribute(ITfProperty* aAttrProperty, hr = info->GetAttributeInfo(aResult); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetDisplayAttribute() FAILED due to " "ITfDisplayAttributeInfo::GetAttributeInfo() failed", this)); return hr; } - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::GetDisplayAttribute() succeeded: " "Result={ %s }", this, GetDisplayAttrStr(*aResult).get())); return S_OK; @@ -2033,13 +2033,13 @@ nsTextStore::GetDisplayAttribute(ITfProperty* aAttrProperty, HRESULT nsTextStore::RestartCompositionIfNecessary(ITfRange* aRangeNew) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::RestartCompositionIfNecessary(" "aRangeNew=0x%p), mComposition.mView=0x%p", this, aRangeNew, mComposition.mView.get())); if (!mComposition.IsComposing()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RestartCompositionIfNecessary() FAILED " "due to no composition view", this)); return E_FAIL; @@ -2051,7 +2051,7 @@ nsTextStore::RestartCompositionIfNecessary(ITfRange* aRangeNew) if (!composingRange) { hr = pComposition->GetRange(getter_AddRefs(composingRange)); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RestartCompositionIfNecessary() FAILED " "due to pComposition->GetRange() failure", this)); return hr; @@ -2062,13 +2062,13 @@ nsTextStore::RestartCompositionIfNecessary(ITfRange* aRangeNew) LONG compStart = 0, compLength = 0; hr = GetRangeExtent(composingRange, &compStart, &compLength); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RestartCompositionIfNecessary() FAILED " "due to GetRangeExtent() failure", this)); return hr; } - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::RestartCompositionIfNecessary(), " "range=%ld-%ld, mComposition={ mStart=%ld, mString.Length()=%lu }", this, compStart, compStart + compLength, mComposition.mStart, @@ -2081,14 +2081,14 @@ nsTextStore::RestartCompositionIfNecessary(ITfRange* aRangeNew) // because a part of the original composition was committed. hr = RestartComposition(pComposition, composingRange); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RestartCompositionIfNecessary() FAILED " "due to RestartComposition() failure", this)); return hr; } } - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::RestartCompositionIfNecessary() succeeded", this)); return S_OK; @@ -2104,7 +2104,7 @@ nsTextStore::RestartComposition(ITfCompositionView* aCompositionView, HRESULT hr = GetRangeExtent(aNewRange, &newStart, &newLength); LONG newEnd = newStart + newLength; - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::RestartComposition(aCompositionView=0x%p, " "aNewRange=0x%p { newStart=%d, newLength=%d }), " "mComposition={ mStart=%d, mCompositionString.Length()=%d }, " @@ -2115,14 +2115,14 @@ nsTextStore::RestartComposition(ITfCompositionView* aCompositionView, currentSelection.StartOffset(), currentSelection.Length())); if (currentSelection.IsDirty()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RestartComposition() FAILED " "due to CurrentSelection() failure", this)); return E_FAIL; } if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RestartComposition() FAILED " "due to GetRangeExtent() failure", this)); return hr; @@ -2159,7 +2159,7 @@ nsTextStore::RestartComposition(ITfCompositionView* aCompositionView, // Update the composition string. Content& lockedContent = LockedContent(); if (!lockedContent.IsInitialized()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RestartComposition() FAILED " "due to LockedContent() failure", this)); return E_FAIL; @@ -2192,7 +2192,7 @@ nsTextStore::RestartComposition(ITfCompositionView* aCompositionView, keepComposingLength)); currentSelection = oldSelection; - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::RestartComposition() succeeded, " "mComposition={ mStart=%d, mCompositionString.Length()=%d }, " "currentSelection={ IsDirty()=%s, StartOffset()=%d, Length()=%d }", @@ -2250,7 +2250,7 @@ GetLineStyle(TF_DA_LINESTYLE aTSFLineStyle, uint8_t &aTextRangeLineStyle) HRESULT nsTextStore::RecordCompositionUpdateAction() { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::RecordCompositionUpdateAction(), " "mComposition={ mView=0x%p, mStart=%d, mString=\"%s\" " "(Length()=%d) }", @@ -2259,7 +2259,7 @@ nsTextStore::RecordCompositionUpdateAction() mComposition.mString.Length())); if (!mComposition.IsComposing()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RecordCompositionUpdateAction() FAILED " "due to no composition view", this)); return E_FAIL; @@ -2277,7 +2277,7 @@ nsTextStore::RecordCompositionUpdateAction() HRESULT hr = mContext->GetProperty(GUID_PROP_ATTRIBUTE, getter_AddRefs(attrPropetry)); if (FAILED(hr) || !attrPropetry) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RecordCompositionUpdateAction() FAILED " "due to mContext->GetProperty() failure", this)); return FAILED(hr) ? hr : E_FAIL; @@ -2286,7 +2286,7 @@ nsTextStore::RecordCompositionUpdateAction() nsRefPtr composingRange; hr = mComposition.mView->GetRange(getter_AddRefs(composingRange)); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RecordCompositionUpdateAction() " "FAILED due to mComposition.mView->GetRange() failure", this)); return hr; @@ -2296,7 +2296,7 @@ nsTextStore::RecordCompositionUpdateAction() hr = attrPropetry->EnumRanges(TfEditCookie(mEditCookie), getter_AddRefs(enumRanges), composingRange); if (FAILED(hr) || !enumRanges) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RecordCompositionUpdateAction() FAILED " "due to attrPropetry->EnumRanges() failure", this)); return FAILED(hr) ? hr : E_FAIL; @@ -2305,7 +2305,7 @@ nsTextStore::RecordCompositionUpdateAction() // First, put the log of content and selection here. Selection& currentSel = CurrentSelection(); if (currentSel.IsDirty()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RecordCompositionUpdateAction() FAILED " "due to CurrentSelection() failure", this)); return E_FAIL; @@ -2342,7 +2342,7 @@ nsTextStore::RecordCompositionUpdateAction() mComposition.mStart); LONG length = end - start; if (length < 0) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RecordCompositionUpdateAction() " "ignores invalid range (%d-%d)", this, rangeStart - mComposition.mStart, @@ -2350,7 +2350,7 @@ nsTextStore::RecordCompositionUpdateAction() continue; } if (!length) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::RecordCompositionUpdateAction() " "ignores a range due to outside of the composition or empty " "(%d-%d)", @@ -2432,7 +2432,7 @@ nsTextStore::RecordCompositionUpdateAction() action->mIncomplete = false; - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RecordCompositionUpdateAction() " "succeeded", this)); @@ -2443,7 +2443,7 @@ HRESULT nsTextStore::SetSelectionInternal(const TS_SELECTION_ACP* pSelection, bool aDispatchCompositionChangeEvent) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::SetSelectionInternal(pSelection={ " "acpStart=%ld, acpEnd=%ld, style={ ase=%s, fInterimChar=%s} }, " "aDispatchCompositionChangeEvent=%s), mComposition.IsComposing()=%s", @@ -2457,7 +2457,7 @@ nsTextStore::SetSelectionInternal(const TS_SELECTION_ACP* pSelection, Selection& currentSel = CurrentSelection(); if (currentSel.IsDirty()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::SetSelectionInternal() FAILED due to " "CurrentSelection() failure", this)); return E_FAIL; @@ -2467,7 +2467,7 @@ nsTextStore::SetSelectionInternal(const TS_SELECTION_ACP* pSelection, if (aDispatchCompositionChangeEvent) { HRESULT hr = RestartCompositionIfNecessary(); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::SetSelectionInternal() FAILED due to " "RestartCompositionIfNecessary() failure", this)); return hr; @@ -2475,7 +2475,7 @@ nsTextStore::SetSelectionInternal(const TS_SELECTION_ACP* pSelection, } if (pSelection->acpStart < mComposition.mStart || pSelection->acpEnd > mComposition.EndOffset()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::SetSelectionInternal() FAILED due to " "the selection being out of the composition string", this)); return TS_E_INVALIDPOS; @@ -2485,7 +2485,7 @@ nsTextStore::SetSelectionInternal(const TS_SELECTION_ACP* pSelection, if (aDispatchCompositionChangeEvent) { HRESULT hr = RecordCompositionUpdateAction(); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::SetSelectionInternal() FAILED due to " "RecordCompositionUpdateAction() failure", this)); return hr; @@ -2510,7 +2510,7 @@ STDMETHODIMP nsTextStore::SetSelection(ULONG ulCount, const TS_SELECTION_ACP *pSelection) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::SetSelection(ulCount=%lu, pSelection=%p { " "acpStart=%ld, acpEnd=%ld, style={ ase=%s, fInterimChar=%s } }), " "mComposition.IsComposing()=%s", @@ -2522,19 +2522,19 @@ nsTextStore::SetSelection(ULONG ulCount, GetBoolName(mComposition.IsComposing()))); if (!IsReadWriteLocked()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::SetSelection() FAILED due to " "not locked (read-write)", this)); return TS_E_NOLOCK; } if (ulCount != 1) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::SetSelection() FAILED due to " "trying setting multiple selection", this)); return E_INVALIDARG; } if (!pSelection) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::SetSelection() FAILED due to " "null argument", this)); return E_INVALIDARG; @@ -2542,11 +2542,11 @@ nsTextStore::SetSelection(ULONG ulCount, HRESULT hr = SetSelectionInternal(pSelection, true); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::SetSelection() FAILED due to " "SetSelectionInternal() failure", this)); } else { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::SetSelection() succeeded", this)); } return hr; @@ -2563,7 +2563,7 @@ nsTextStore::GetText(LONG acpStart, ULONG *pulRunInfoOut, LONG *pacpNext) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetText(acpStart=%ld, acpEnd=%ld, pchPlain=0x%p, " "cchPlainReq=%lu, pcchPlainOut=0x%p, prgRunInfo=0x%p, ulRunInfoReq=%lu, " "pulRunInfoOut=0x%p, pacpNext=0x%p), mComposition={ mStart=%ld, " @@ -2574,7 +2574,7 @@ nsTextStore::GetText(LONG acpStart, GetBoolName(mComposition.IsComposing()))); if (!IsReadLocked()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetText() FAILED due to " "not locked (read)", this)); return TS_E_NOLOCK; @@ -2582,14 +2582,14 @@ nsTextStore::GetText(LONG acpStart, if (!pcchPlainOut || (!pchPlain && !prgRunInfo) || !cchPlainReq != !pchPlain || !ulRunInfoReq != !prgRunInfo) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetText() FAILED due to " "invalid argument", this)); return E_INVALIDARG; } if (acpStart < 0 || acpEnd < -1 || (acpEnd != -1 && acpStart > acpEnd)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetText() FAILED due to " "invalid position", this)); return TS_E_INVALIDPOS; @@ -2607,20 +2607,20 @@ nsTextStore::GetText(LONG acpStart, Content& lockedContent = LockedContent(); if (!lockedContent.IsInitialized()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetText() FAILED due to " "LockedContent() failure", this)); return E_FAIL; } if (lockedContent.Text().Length() < static_cast(acpStart)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetText() FAILED due to " "acpStart is larger offset than the actual text length", this)); return TS_E_INVALIDPOS; } if (acpEnd != -1 && lockedContent.Text().Length() < static_cast(acpEnd)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetText() FAILED due to " "acpEnd is larger offset than the actual text length", this)); return TS_E_INVALIDPOS; @@ -2647,7 +2647,7 @@ nsTextStore::GetText(LONG acpStart, if (pacpNext) *pacpNext = acpStart + length; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetText() succeeded: pcchPlainOut=0x%p, " "*prgRunInfo={ uCount=%lu, type=%s }, *pulRunInfoOut=%lu, " "*pacpNext=%ld)", @@ -2665,7 +2665,7 @@ nsTextStore::SetText(DWORD dwFlags, ULONG cch, TS_TEXTCHANGE *pChange) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::SetText(dwFlags=%s, acpStart=%ld, " "acpEnd=%ld, pchText=0x%p \"%s\", cch=%lu, pChange=0x%p), " "mComposition.IsComposing()=%s", @@ -2680,7 +2680,7 @@ nsTextStore::SetText(DWORD dwFlags, // ways to do this, this method acts as a helper to // call SetSelection followed by InsertTextAtSelection if (!IsReadWriteLocked()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::SetText() FAILED due to " "not locked (read)", this)); return TS_E_NOLOCK; @@ -2694,7 +2694,7 @@ nsTextStore::SetText(DWORD dwFlags, // Set selection to desired range HRESULT hr = SetSelectionInternal(&selection); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::SetText() FAILED due to " "SetSelectionInternal() failure", this)); return hr; @@ -2702,13 +2702,13 @@ nsTextStore::SetText(DWORD dwFlags, // Replace just selected text if (!InsertTextAtSelectionInternal(nsDependentSubstring(pchText, cch), pChange)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::SetText() FAILED due to " "InsertTextAtSelectionInternal() failure", this)); return E_FAIL; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::SetText() succeeded: pChange={ " "acpStart=%ld, acpOldEnd=%ld, acpNewEnd=%ld }", this, pChange ? pChange->acpStart : 0, @@ -2721,7 +2721,7 @@ nsTextStore::GetFormattedText(LONG acpStart, LONG acpEnd, IDataObject **ppDataObject) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetFormattedText() called " "but not supported (E_NOTIMPL)", this)); @@ -2735,7 +2735,7 @@ nsTextStore::GetEmbedded(LONG acpPos, REFIID riid, IUnknown **ppunk) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetEmbedded() called " "but not supported (E_NOTIMPL)", this)); @@ -2748,7 +2748,7 @@ nsTextStore::QueryInsertEmbedded(const GUID *pguidService, const FORMATETC *pFormatEtc, BOOL *pfInsertable) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::QueryInsertEmbedded() called " "but not supported, *pfInsertable=FALSE (S_OK)", this)); @@ -2764,7 +2764,7 @@ nsTextStore::InsertEmbedded(DWORD dwFlags, IDataObject *pDataObject, TS_TEXTCHANGE *pChange) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::InsertEmbedded() called " "but not supported (E_NOTIMPL)", this)); @@ -2843,7 +2843,7 @@ nsTextStore::HandleRequestAttrs(DWORD aFlags, ULONG aFilterCount, const TS_ATTRID* aFilterAttrs) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::HandleRequestAttrs(aFlags=%s, " "aFilterCount=%u)", this, GetFindFlagName(aFlags).get(), aFilterCount)); @@ -2860,7 +2860,7 @@ nsTextStore::HandleRequestAttrs(DWORD aFlags, mRequestedAttrValues = !!(aFlags & TS_ATTR_FIND_WANT_VALUE); for (uint32_t i = 0; i < aFilterCount; i++) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::HandleRequestAttrs(), " "requested attr=%s", this, GetGUIDNameStrWithTable(aFilterAttrs[i]).get())); @@ -2877,7 +2877,7 @@ nsTextStore::RequestSupportedAttrs(DWORD dwFlags, ULONG cFilterAttrs, const TS_ATTRID *paFilterAttrs) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RequestSupportedAttrs(dwFlags=%s, " "cFilterAttrs=%lu)", this, GetFindFlagName(dwFlags).get(), cFilterAttrs)); @@ -2891,7 +2891,7 @@ nsTextStore::RequestAttrsAtPosition(LONG acpPos, const TS_ATTRID *paFilterAttrs, DWORD dwFlags) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RequestAttrsAtPosition(acpPos=%ld, " "cFilterAttrs=%lu, dwFlags=%s)", this, acpPos, cFilterAttrs, GetFindFlagName(dwFlags).get())); @@ -2906,7 +2906,7 @@ nsTextStore::RequestAttrsTransitioningAtPosition(LONG acpPos, const TS_ATTRID *paFilterAttr, DWORD dwFlags) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RequestAttrsTransitioningAtPosition(" "acpPos=%ld, cFilterAttrs=%lu, dwFlags=%s) called but not supported " "(S_OK)", @@ -2927,13 +2927,13 @@ nsTextStore::FindNextAttrTransition(LONG acpStart, LONG *plFoundOffset) { if (!pacpNext || !pfFound || !plFoundOffset) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::FindNextAttrTransition() FAILED due to " "null argument", this)); return E_INVALIDARG; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::FindNextAttrTransition() called " "but not supported (S_OK)", this)); @@ -2949,7 +2949,7 @@ nsTextStore::RetrieveRequestedAttrs(ULONG ulCount, ULONG *pcFetched) { if (!pcFetched || !paAttrVals) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RetrieveRequestedAttrs() FAILED due to " "null argument", this)); return E_INVALIDARG; @@ -2962,14 +2962,14 @@ nsTextStore::RetrieveRequestedAttrs(ULONG ulCount, } } if (ulCount < expectedCount) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RetrieveRequestedAttrs() FAILED due to " "not enough count ulCount=%u, expectedCount=%u", this, ulCount, expectedCount)); return E_INVALIDARG; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RetrieveRequestedAttrs() called " "ulCount=%d, mRequestedAttrValues=%s", this, ulCount, GetBoolName(mRequestedAttrValues))); @@ -2983,7 +2983,7 @@ nsTextStore::RetrieveRequestedAttrs(ULONG ulCount, TS_ATTRID attrID = GetAttrID(i); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RetrieveRequestedAttrs() for %s", this, GetGUIDNameStrWithTable(attrID).get())); @@ -3030,7 +3030,7 @@ nsTextStore::RetrieveRequestedAttrs(ULONG ulCount, return S_OK; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RetrieveRequestedAttrs() called " "for unknown TS_ATTRVAL, *pcFetched=0 (S_OK)", this)); @@ -3043,18 +3043,18 @@ nsTextStore::RetrieveRequestedAttrs(ULONG ulCount, STDMETHODIMP nsTextStore::GetEndACP(LONG *pacp) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetEndACP(pacp=0x%p)", this, pacp)); if (!IsReadLocked()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetEndACP() FAILED due to " "not locked (read)", this)); return TS_E_NOLOCK; } if (!pacp) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetEndACP() FAILED due to " "null argument", this)); return E_INVALIDARG; @@ -3062,7 +3062,7 @@ nsTextStore::GetEndACP(LONG *pacp) Content& lockedContent = LockedContent(); if (!lockedContent.IsInitialized()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetEndACP() FAILED due to " "LockedContent() failure", this)); return E_FAIL; @@ -3074,11 +3074,11 @@ nsTextStore::GetEndACP(LONG *pacp) STDMETHODIMP nsTextStore::GetActiveView(TsViewCookie *pvcView) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetActiveView(pvcView=0x%p)", this, pvcView)); if (!pvcView) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetActiveView() FAILED due to " "null argument", this)); return E_INVALIDARG; @@ -3086,7 +3086,7 @@ nsTextStore::GetActiveView(TsViewCookie *pvcView) *pvcView = TEXTSTORE_DEFAULT_VIEW; - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetActiveView() succeeded: *pvcView=%ld", this, *pvcView)); return S_OK; @@ -3099,28 +3099,28 @@ nsTextStore::GetACPFromPoint(TsViewCookie vcView, LONG *pacp) { if (!IsReadLocked()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, PR_LOG_ERROR, ("TSF: 0x%p nsTextStore::GetACPFromPoint() FAILED due to " "not locked (read)", this)); return TS_E_NOLOCK; } if (vcView != TEXTSTORE_DEFAULT_VIEW) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, PR_LOG_ERROR, ("TSF: 0x%p nsTextStore::GetACPFromPoint() FAILED due to " "called with invalid view", this)); return E_INVALIDARG; } if (mLockedContent.IsLayoutChanged()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, PR_LOG_ERROR, ("TSF: 0x%p nsTextStore::GetACPFromPoint() FAILED due to " "layout not recomputed", this)); mPendingOnLayoutChange = true; return TS_E_NOLAYOUT; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, PR_LOG_INFO, ("TSF: 0x%p nsTextStore::GetACPFromPoint(vcView=%ld, " "pt(0x%p)={ x=%ld, y=%ld }, dwFlags=%s, pacp=0x%p) called " "but not supported (E_NOTIMPL)", this)); @@ -3136,34 +3136,34 @@ nsTextStore::GetTextExt(TsViewCookie vcView, RECT *prc, BOOL *pfClipped) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetTextExt(vcView=%ld, " "acpStart=%ld, acpEnd=%ld, prc=0x%p, pfClipped=0x%p)", this, vcView, acpStart, acpEnd, prc, pfClipped)); if (!IsReadLocked()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetTextExt() FAILED due to " "not locked (read)", this)); return TS_E_NOLOCK; } if (vcView != TEXTSTORE_DEFAULT_VIEW) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetTextExt() FAILED due to " "called with invalid view", this)); return E_INVALIDARG; } if (!prc || !pfClipped) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetTextExt() FAILED due to " "null argument", this)); return E_INVALIDARG; } if (acpStart < 0 || acpEnd < acpStart) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetTextExt() FAILED due to " "invalid position", this)); return TS_E_INVALIDPOS; @@ -3191,7 +3191,7 @@ nsTextStore::GetTextExt(TsViewCookie vcView, sDoNotReturnNoLayoutErrorToGoogleJaInputAtFirstChar && IsGoogleJapaneseInput(activeTIPKeyboardDescription)) { acpEnd = acpStart; - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::GetTextExt() hacked the offsets of " "the first character of changing range of the composition " "string for TIP acpStart=%d, acpEnd=%d", @@ -3207,7 +3207,7 @@ nsTextStore::GetTextExt(TsViewCookie vcView, sDoNotReturnNoLayoutErrorToGoogleJaInputAtCaret && IsGoogleJapaneseInput(activeTIPKeyboardDescription)) { acpEnd = acpStart = mLockedContent.MinOffsetOfLayoutChanged(); - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::GetTextExt() hacked the offsets of " "the caret of the composition string for TIP acpStart=%d, " "acpEnd=%d", this, acpStart, acpEnd)); @@ -3224,14 +3224,14 @@ nsTextStore::GetTextExt(TsViewCookie vcView, activeTIPKeyboardDescription.Equals(TIP_NAME_EASY_CHANGJEI))) { acpEnd = mComposition.mStart; acpStart = std::min(acpStart, acpEnd); - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::GetTextExt() hacked the offsets for " "TIP acpStart=%d, acpEnd=%d", this, acpStart, acpEnd)); } } if (mLockedContent.IsLayoutChangedAfter(acpEnd)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetTextExt() FAILED due to " "layout not recomputed at %d", this, acpEnd)); mPendingOnLayoutChange = true; @@ -3244,7 +3244,7 @@ nsTextStore::GetTextExt(TsViewCookie vcView, event.InitForQueryTextRect(acpStart, acpEnd - acpStart); mWidget->DispatchWindowEvent(&event); if (!event.mSucceeded) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetTextExt() FAILED due to " "NS_QUERY_TEXT_RECT failure", this)); return TS_E_INVALIDPOS; // but unexpected failure, maybe. @@ -3261,7 +3261,7 @@ nsTextStore::GetTextExt(TsViewCookie vcView, // Result rect is in top level widget coordinates refWindow = refWindow->GetTopLevelWindow(false); if (!refWindow) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetTextExt() FAILED due to " "no top level window", this)); return E_FAIL; @@ -3271,7 +3271,7 @@ nsTextStore::GetTextExt(TsViewCookie vcView, // get bounding screen rect to test for clipping if (!GetScreenExtInternal(*prc)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetTextExt() FAILED due to " "GetScreenExtInternal() failure", this)); return E_FAIL; @@ -3304,7 +3304,7 @@ nsTextStore::GetTextExt(TsViewCookie vcView, CreateNativeCaret(); } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetTextExt() succeeded: " "*prc={ left=%ld, top=%ld, right=%ld, bottom=%ld }, *pfClipped=%s", this, prc->left, prc->top, prc->right, prc->bottom, @@ -3317,32 +3317,32 @@ STDMETHODIMP nsTextStore::GetScreenExt(TsViewCookie vcView, RECT *prc) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetScreenExt(vcView=%ld, prc=0x%p)", this, vcView, prc)); if (vcView != TEXTSTORE_DEFAULT_VIEW) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetScreenExt() FAILED due to " "called with invalid view", this)); return E_INVALIDARG; } if (!prc) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetScreenExt() FAILED due to " "null argument", this)); return E_INVALIDARG; } if (!GetScreenExtInternal(*prc)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetScreenExt() FAILED due to " "GetScreenExtInternal() failure", this)); return E_FAIL; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetScreenExt() succeeded: " "*prc={ left=%ld, top=%ld, right=%ld, bottom=%ld }", this, prc->left, prc->top, prc->right, prc->bottom)); @@ -3352,7 +3352,7 @@ nsTextStore::GetScreenExt(TsViewCookie vcView, bool nsTextStore::GetScreenExtInternal(RECT &aScreenExt) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::GetScreenExtInternal()", this)); // use NS_QUERY_EDITOR_RECT to get rect in system, screen coordinates @@ -3360,7 +3360,7 @@ nsTextStore::GetScreenExtInternal(RECT &aScreenExt) mWidget->InitEvent(event); mWidget->DispatchWindowEvent(&event); if (!event.mSucceeded) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetScreenExtInternal() FAILED due to " "NS_QUERY_EDITOR_RECT failure", this)); return false; @@ -3372,7 +3372,7 @@ nsTextStore::GetScreenExtInternal(RECT &aScreenExt) // Result rect is in top level widget coordinates refWindow = refWindow->GetTopLevelWindow(false); if (!refWindow) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetScreenExtInternal() FAILED due to " "no top level window", this)); return false; @@ -3380,7 +3380,7 @@ nsTextStore::GetScreenExtInternal(RECT &aScreenExt) nsIntRect boundRect; if (NS_FAILED(refWindow->GetClientBounds(boundRect))) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetScreenExtInternal() FAILED due to " "failed to get the client bounds", this)); return false; @@ -3398,7 +3398,7 @@ nsTextStore::GetScreenExtInternal(RECT &aScreenExt) ::SetRectEmpty(&aScreenExt); } - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::GetScreenExtInternal() succeeded: " "aScreenExt={ left=%ld, top=%ld, right=%ld, bottom=%ld }", this, aScreenExt.left, aScreenExt.top, @@ -3410,20 +3410,20 @@ STDMETHODIMP nsTextStore::GetWnd(TsViewCookie vcView, HWND *phwnd) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetWnd(vcView=%ld, phwnd=0x%p), " "mWidget=0x%p", this, vcView, phwnd, mWidget.get())); if (vcView != TEXTSTORE_DEFAULT_VIEW) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetWnd() FAILED due to " "called with invalid view", this)); return E_INVALIDARG; } if (!phwnd) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::GetScreenExt() FAILED due to " "null argument", this)); return E_INVALIDARG; @@ -3431,7 +3431,7 @@ nsTextStore::GetWnd(TsViewCookie vcView, *phwnd = mWidget->GetWindowHandle(); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::GetWnd() succeeded: *phwnd=0x%p", this, static_cast(*phwnd))); return S_OK; @@ -3445,7 +3445,7 @@ nsTextStore::InsertTextAtSelection(DWORD dwFlags, LONG *pacpEnd, TS_TEXTCHANGE *pChange) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::InsertTextAtSelection(dwFlags=%s, " "pchText=0x%p \"%s\", cch=%lu, pacpStart=0x%p, pacpEnd=0x%p, " "pChange=0x%p), IsComposing()=%s", @@ -3458,7 +3458,7 @@ nsTextStore::InsertTextAtSelection(DWORD dwFlags, GetBoolName(mComposition.IsComposing()))); if (cch && !pchText) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::InsertTextAtSelection() FAILED due to " "null pchText", this)); return E_INVALIDARG; @@ -3466,14 +3466,14 @@ nsTextStore::InsertTextAtSelection(DWORD dwFlags, if (TS_IAS_QUERYONLY == dwFlags) { if (!IsReadLocked()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::InsertTextAtSelection() FAILED due to " "not locked (read)", this)); return TS_E_NOLOCK; } if (!pacpStart || !pacpEnd) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::InsertTextAtSelection() FAILED due to " "null argument", this)); return E_INVALIDARG; @@ -3482,7 +3482,7 @@ nsTextStore::InsertTextAtSelection(DWORD dwFlags, // Get selection first Selection& currentSel = CurrentSelection(); if (currentSel.IsDirty()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::InsertTextAtSelection() FAILED due to " "CurrentSelection() failure", this)); return E_FAIL; @@ -3498,21 +3498,21 @@ nsTextStore::InsertTextAtSelection(DWORD dwFlags, } } else { if (!IsReadWriteLocked()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::InsertTextAtSelection() FAILED due to " "not locked (read-write)", this)); return TS_E_NOLOCK; } if (!pChange) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::InsertTextAtSelection() FAILED due to " "null pChange", this)); return E_INVALIDARG; } if (TS_IAS_NOQUERY != dwFlags && (!pacpStart || !pacpEnd)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::InsertTextAtSelection() FAILED due to " "null argument", this)); return E_INVALIDARG; @@ -3520,7 +3520,7 @@ nsTextStore::InsertTextAtSelection(DWORD dwFlags, if (!InsertTextAtSelectionInternal(nsDependentSubstring(pchText, cch), pChange)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::InsertTextAtSelection() FAILED due to " "InsertTextAtSelectionInternal() failure", this)); return E_FAIL; @@ -3531,7 +3531,7 @@ nsTextStore::InsertTextAtSelection(DWORD dwFlags, *pacpEnd = pChange->acpNewEnd; } } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::InsertTextAtSelection() succeeded: " "*pacpStart=%ld, *pacpEnd=%ld, " "*pChange={ acpStart=%ld, acpOldEnd=%ld, acpNewEnd=%ld })", @@ -3545,7 +3545,7 @@ bool nsTextStore::InsertTextAtSelectionInternal(const nsAString &aInsertStr, TS_TEXTCHANGE* aTextChange) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::InsertTextAtSelectionInternal(" "aInsertStr=\"%s\", aTextChange=0x%p), IsComposing=%s", this, NS_ConvertUTF16toUTF8(aInsertStr).get(), aTextChange, @@ -3553,7 +3553,7 @@ nsTextStore::InsertTextAtSelectionInternal(const nsAString &aInsertStr, Content& lockedContent = LockedContent(); if (!lockedContent.IsInitialized()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::InsertTextAtSelectionInternal() failed " "due to LockedContent() failure()", this)); return false; @@ -3581,7 +3581,7 @@ nsTextStore::InsertTextAtSelectionInternal(const nsAString &aInsertStr, aTextChange->acpNewEnd = lockedContent.Selection().EndOffset(); } - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::InsertTextAtSelectionInternal() succeeded: " "mWidget=0x%p, mWidget->Destroyed()=%s, aTextChange={ acpStart=%ld, " "acpOldEnd=%ld, acpNewEnd=%ld }", @@ -3600,7 +3600,7 @@ nsTextStore::InsertEmbeddedAtSelection(DWORD dwFlags, LONG *pacpEnd, TS_TEXTCHANGE *pChange) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::InsertEmbeddedAtSelection() called " "but not supported (E_NOTIMPL)", this)); @@ -3613,7 +3613,7 @@ nsTextStore::RecordCompositionStartAction(ITfCompositionView* aComposition, ITfRange* aRange, bool aPreserveSelection) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::RecordCompositionStartAction(" "aComposition=0x%p, aRange=0x%p, aPreserveSelection=%s), " "mComposition.mView=0x%p", @@ -3623,7 +3623,7 @@ nsTextStore::RecordCompositionStartAction(ITfCompositionView* aComposition, LONG start = 0, length = 0; HRESULT hr = GetRangeExtent(aRange, &start, &length); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RecordCompositionStartAction() FAILED " "due to GetRangeExtent() failure", this)); return hr; @@ -3639,7 +3639,7 @@ nsTextStore::RecordCompositionStartAction(ITfCompositionView* aComposition, LONG aLength, bool aPreserveSelection) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::RecordCompositionStartAction(" "aComposition=0x%p, aStart=%d, aLength=%d, aPreserveSelection=%s), " "mComposition.mView=0x%p", @@ -3648,7 +3648,7 @@ nsTextStore::RecordCompositionStartAction(ITfCompositionView* aComposition, Content& lockedContent = LockedContent(); if (!lockedContent.IsInitialized()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RecordCompositionStartAction() FAILED " "due to LockedContent() failure", this)); return E_FAIL; @@ -3662,7 +3662,7 @@ nsTextStore::RecordCompositionStartAction(ITfCompositionView* aComposition, Selection& currentSel = CurrentSelection(); if (currentSel.IsDirty()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RecordCompositionStartAction() FAILED " "due to CurrentSelection() failure", this)); action->mAdjustSelection = true; @@ -3681,7 +3681,7 @@ nsTextStore::RecordCompositionStartAction(ITfCompositionView* aComposition, lockedContent.StartComposition(aComposition, *action, aPreserveSelection); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RecordCompositionStartAction() succeeded: " "mComposition={ mStart=%ld, mString.Length()=%ld, " "mSelection={ acpStart=%ld, acpEnd=%ld, style.ase=%s, " @@ -3696,7 +3696,7 @@ nsTextStore::RecordCompositionStartAction(ITfCompositionView* aComposition, HRESULT nsTextStore::RecordCompositionEndAction() { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::RecordCompositionEndAction(), " "mComposition={ mView=0x%p, mString=\"%s\" }", this, mComposition.mView.get(), @@ -3711,14 +3711,14 @@ nsTextStore::RecordCompositionEndAction() Content& lockedContent = LockedContent(); if (!lockedContent.IsInitialized()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::RecordCompositionEndAction() FAILED due " "to LockedContent() failure", this)); return E_FAIL; } lockedContent.EndComposition(*action); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::RecordCompositionEndAction(), succeeded", this)); return S_OK; @@ -3728,7 +3728,7 @@ STDMETHODIMP nsTextStore::OnStartComposition(ITfCompositionView* pComposition, BOOL* pfOk) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnStartComposition(pComposition=0x%p, " "pfOk=0x%p), mComposition.mView=0x%p", this, pComposition, pfOk, mComposition.mView.get())); @@ -3739,7 +3739,7 @@ nsTextStore::OnStartComposition(ITfCompositionView* pComposition, // Only one composition at a time if (mComposition.IsComposing()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnStartComposition() FAILED due to " "there is another composition already (but returns S_OK)", this)); return S_OK; @@ -3748,21 +3748,21 @@ nsTextStore::OnStartComposition(ITfCompositionView* pComposition, nsRefPtr range; HRESULT hr = pComposition->GetRange(getter_AddRefs(range)); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnStartComposition() FAILED due to " "pComposition->GetRange() failure", this)); return hr; } hr = RecordCompositionStartAction(pComposition, range, false); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnStartComposition() FAILED due to " "RecordCompositionStartAction() failure", this)); return hr; } *pfOk = TRUE; - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnStartComposition() succeeded", this)); return S_OK; } @@ -3771,7 +3771,7 @@ STDMETHODIMP nsTextStore::OnUpdateComposition(ITfCompositionView* pComposition, ITfRange* pRangeNew) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnUpdateComposition(pComposition=0x%p, " "pRangeNew=0x%p), mComposition.mView=0x%p", this, pComposition, pRangeNew, mComposition.mView.get())); @@ -3779,19 +3779,19 @@ nsTextStore::OnUpdateComposition(ITfCompositionView* pComposition, AutoPendingActionAndContentFlusher flusher(this); if (!mDocumentMgr || !mContext) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnUpdateComposition() FAILED due to " "not ready for the composition", this)); return E_UNEXPECTED; } if (!mComposition.IsComposing()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnUpdateComposition() FAILED due to " "no active composition", this)); return E_UNEXPECTED; } if (mComposition.mView != pComposition) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnUpdateComposition() FAILED due to " "different composition view specified", this)); return E_UNEXPECTED; @@ -3801,7 +3801,7 @@ nsTextStore::OnUpdateComposition(ITfCompositionView* pComposition, if (!pRangeNew) { PendingAction* action = LastOrNewPendingCompositionUpdate(); action->mIncomplete = true; - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnUpdateComposition() succeeded but " "not complete", this)); return S_OK; @@ -3809,7 +3809,7 @@ nsTextStore::OnUpdateComposition(ITfCompositionView* pComposition, HRESULT hr = RestartCompositionIfNecessary(pRangeNew); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnUpdateComposition() FAILED due to " "RestartCompositionIfNecessary() failure", this)); return hr; @@ -3817,21 +3817,21 @@ nsTextStore::OnUpdateComposition(ITfCompositionView* pComposition, hr = RecordCompositionUpdateAction(); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnUpdateComposition() FAILED due to " "RecordCompositionUpdateAction() failure", this)); return hr; } - if (PR_LOG_TEST(sTextStoreLog, PR_LOG_ALWAYS)) { + if (MOZ_LOG_TEST(sTextStoreLog, LogLevel::Info)) { Selection& currentSel = CurrentSelection(); if (currentSel.IsDirty()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnUpdateComposition() FAILED due to " "CurrentSelection() failure", this)); return E_FAIL; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnUpdateComposition() succeeded: " "mComposition={ mStart=%ld, mString=\"%s\" }, " "CurrentSelection()={ acpStart=%ld, acpEnd=%ld, style.ase=%s }", @@ -3846,7 +3846,7 @@ nsTextStore::OnUpdateComposition(ITfCompositionView* pComposition, STDMETHODIMP nsTextStore::OnEndComposition(ITfCompositionView* pComposition) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnEndComposition(pComposition=0x%p), " "mComposition={ mView=0x%p, mString=\"%s\" }", this, pComposition, mComposition.mView.get(), @@ -3855,14 +3855,14 @@ nsTextStore::OnEndComposition(ITfCompositionView* pComposition) AutoPendingActionAndContentFlusher flusher(this); if (!mComposition.IsComposing()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnEndComposition() FAILED due to " "no active composition", this)); return E_UNEXPECTED; } if (mComposition.mView != pComposition) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnEndComposition() FAILED due to " "different composition view specified", this)); return E_UNEXPECTED; @@ -3870,13 +3870,13 @@ nsTextStore::OnEndComposition(ITfCompositionView* pComposition) HRESULT hr = RecordCompositionEndAction(); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnEndComposition() FAILED due to " "RecordCompositionEndAction() failure", this)); return hr; } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnEndComposition(), succeeded", this)); return S_OK; } @@ -3886,12 +3886,12 @@ nsTextStore::AdviseMouseSink(ITfRangeACP* range, ITfMouseSink* pSink, DWORD* pdwCookie) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::AdviseMouseSink(range=0x%p, pSink=0x%p, " "pdwCookie=0x%p)", this, range, pSink, pdwCookie)); if (!pdwCookie) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::AdviseMouseSink() FAILED due to the " "pdwCookie is null", this)); return E_INVALIDARG; @@ -3900,13 +3900,13 @@ nsTextStore::AdviseMouseSink(ITfRangeACP* range, *pdwCookie = MouseTracker::kInvalidCookie; if (!range) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::AdviseMouseSink() FAILED due to the " "range is null", this)); return E_INVALIDARG; } if (!pSink) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::AdviseMouseSink() FAILED due to the " "pSink is null", this)); return E_INVALIDARG; @@ -3926,7 +3926,7 @@ nsTextStore::AdviseMouseSink(ITfRangeACP* range, tracker = mMouseTrackers.AppendElement(); HRESULT hr = tracker->Init(this); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::AdviseMouseSink() FAILED due to " "failure of MouseTracker::Init()", this)); return hr; @@ -3934,13 +3934,13 @@ nsTextStore::AdviseMouseSink(ITfRangeACP* range, } HRESULT hr = tracker->AdviseSink(this, range, pSink); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::AdviseMouseSink() FAILED due to failure " "of MouseTracker::Init()", this)); return hr; } *pdwCookie = tracker->Cookie(); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::AdviseMouseSink(), succeeded, " "*pdwCookie=%d", this, *pdwCookie)); return S_OK; @@ -3949,11 +3949,11 @@ nsTextStore::AdviseMouseSink(ITfRangeACP* range, STDMETHODIMP nsTextStore::UnadviseMouseSink(DWORD dwCookie) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::UnadviseMouseSink(dwCookie=%d)", this, dwCookie)); if (dwCookie == MouseTracker::kInvalidCookie) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::UnadviseMouseSink() FAILED due to " "the cookie is invalid value", this)); return E_INVALIDARG; @@ -3961,20 +3961,20 @@ nsTextStore::UnadviseMouseSink(DWORD dwCookie) // The cookie value must be an index of mMouseTrackers. // We can use this shortcut for now. if (static_cast(dwCookie) >= mMouseTrackers.Length()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::UnadviseMouseSink() FAILED due to " "the cookie is too large value", this)); return E_INVALIDARG; } MouseTracker& tracker = mMouseTrackers[dwCookie]; if (!tracker.IsUsing()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::UnadviseMouseSink() FAILED due to " "the found tracker uninstalled already", this)); return E_INVALIDARG; } tracker.UnadviseSink(); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::UnadviseMouseSink(), succeeded", this)); return S_OK; } @@ -3985,7 +3985,7 @@ nsTextStore::OnFocusChange(bool aGotFocus, nsWindowBase* aFocusedWidget, const InputContext& aContext) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: nsTextStore::OnFocusChange(aGotFocus=%s, " "aFocusedWidget=0x%p, aContext={ mIMEState={ mEnabled=%s }, " "mHTMLInputType=\"%s\" }), " @@ -4023,7 +4023,7 @@ nsTextStore::OnFocusChange(bool aGotFocus, if (!aGotFocus || !aContext.mIMEState.IsEditable()) { HRESULT hr = sThreadMgr->SetFocus(sDisabledDocumentMgr); if (NS_WARN_IF(FAILED(hr))) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::OnFocusChange() FAILED due to " "ITfThreadMgr::SetFocus() failure")); return NS_ERROR_FAILURE; @@ -4033,7 +4033,7 @@ nsTextStore::OnFocusChange(bool aGotFocus, // If an editor is getting focus, create new TextStore and set focus. if (NS_WARN_IF(!CreateAndSetFocus(aFocusedWidget, aContext))) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::OnFocusChange() FAILED due to " "ITfThreadMgr::CreateAndSetFocus() failure")); // If setting focus, we should destroy the TextStore completely because @@ -4057,13 +4057,13 @@ nsTextStore::CreateAndSetFocus(nsWindowBase* aFocusedWidget, // So, we should set sEnabledTextStore directly. sEnabledTextStore = new nsTextStore(); if (NS_WARN_IF(!sEnabledTextStore->Init(aFocusedWidget))) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::CreateAndSetFocus() FAILED due to " "nsTextStore::Init() failure")); return false; } if (NS_WARN_IF(!sEnabledTextStore->mDocumentMgr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::CreateAndSetFocus() FAILED due to " "invalid nsTextStore::mDocumentMgr")); return false; @@ -4078,7 +4078,7 @@ nsTextStore::CreateAndSetFocus(nsWindowBase* aFocusedWidget, } HRESULT hr = sThreadMgr->SetFocus(sEnabledTextStore->mDocumentMgr); if (NS_WARN_IF(FAILED(hr))) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::CreateAndSetFocus() FAILED due to " "ITfTheadMgr::SetFocus() failure")); return false; @@ -4090,7 +4090,7 @@ nsTextStore::CreateAndSetFocus(nsWindowBase* aFocusedWidget, sEnabledTextStore->mDocumentMgr, getter_AddRefs(prevFocusedDocumentMgr)); if (NS_WARN_IF(FAILED(hr))) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::CreateAndSetFocus() FAILED due to " "ITfTheadMgr::AssociateFocus() failure")); return false; @@ -4125,7 +4125,7 @@ nsTextStore::GetIMEUpdatePreference() nsresult nsTextStore::OnTextChangeInternal(const IMENotification& aIMENotification) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::OnTextChangeInternal(aIMENotification={ " "mMessage=0x%08X, mTextChangeData={ mStartOffset=%lu, " "mOldEndOffset=%lu, mNewEndOffset=%lu}), mSink=0x%p, mSinkMask=%s, " @@ -4148,7 +4148,7 @@ nsTextStore::OnTextChangeInternal(const IMENotification& aIMENotification) } if (!aIMENotification.mTextChangeData.IsInInt32Range()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::OnTextChangeInternal() FAILED due to " "offset is too big for calling mSink->OnTextChange()...", this)); @@ -4159,7 +4159,7 @@ nsTextStore::OnTextChangeInternal(const IMENotification& aIMENotification) // Especially, some of them stop working for composition in our process. // For preventing it, let's commit the composition. if (mComposition.IsComposing()) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnTextChangeInternal(), " "committing the composition for avoiding making TIP confused...", this)); @@ -4175,7 +4175,7 @@ nsTextStore::OnTextChangeInternal(const IMENotification& aIMENotification) textChange.acpNewEnd = static_cast(aIMENotification.mTextChangeData.mNewEndOffset); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnTextChangeInternal(), calling " "mSink->OnTextChange(0, { acpStart=%ld, acpOldEnd=%ld, " "acpNewEnd=%ld })...", this, textChange.acpStart, @@ -4188,7 +4188,7 @@ nsTextStore::OnTextChangeInternal(const IMENotification& aIMENotification) nsresult nsTextStore::OnSelectionChangeInternal(void) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::OnSelectionChangeInternal(), " "mSink=0x%p, mSinkMask=%s, mIsRecordingActionsWithoutLock=%s, " "mComposition.IsComposing()=%s", @@ -4210,7 +4210,7 @@ nsTextStore::OnSelectionChangeInternal(void) // Especially, some of them stop working for composition in our process. // For preventing it, let's commit the composition. if (mComposition.IsComposing()) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnSelectionChangeInternal(), " "committing the composition for avoiding making TIP confused...", this)); @@ -4219,12 +4219,12 @@ nsTextStore::OnSelectionChangeInternal(void) } if (!mIsRecordingActionsWithoutLock) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnSelectionChangeInternal(), calling " "mSink->OnSelectionChange()...", this)); mSink->OnSelectionChange(); } else { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnSelectionChangeInternal(), pending " "a call of mSink->OnSelectionChange()...", this)); mPendingOnSelectionChange = true; @@ -4238,7 +4238,7 @@ nsTextStore::OnLayoutChangeInternal() NS_ENSURE_TRUE(mContext, NS_ERROR_FAILURE); NS_ENSURE_TRUE(mSink, NS_ERROR_FAILURE); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::OnLayoutChangeInternal(), calling " "mSink->OnLayoutChange()...", this)); HRESULT hr = mSink->OnLayoutChange(TS_LC_CHANGE, TEXTSTORE_DEFAULT_VIEW); @@ -4254,7 +4254,7 @@ nsTextStore::OnMouseButtonEventInternal(const IMENotification& aIMENotification) return NS_OK; } - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::OnMouseButtonEventInternal(" "aIMENotification={ mEventMessage=%s, mOffset=%u, mCursorPos={ " "mX=%d, mY=%d }, mCharRect={ mX=%d, mY=%d, mWidth=%d, mHeight=%d }, " @@ -4324,14 +4324,14 @@ nsTextStore::OnMouseButtonEventInternal(const IMENotification& aIMENotification) void nsTextStore::CreateNativeCaret() { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::CreateNativeCaret(), " "mComposition.IsComposing()=%s", this, GetBoolName(mComposition.IsComposing()))); Selection& currentSel = CurrentSelection(); if (currentSel.IsDirty()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::CreateNativeCaret() FAILED due to " "CurrentSelection() failure", this)); return; @@ -4346,7 +4346,7 @@ nsTextStore::CreateNativeCaret() mWidget->InitEvent(queryCaretRect); mWidget->DispatchWindowEvent(&queryCaretRect); if (!queryCaretRect.mSucceeded) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::CreateNativeCaret() FAILED due to " "NS_QUERY_CARET_RECT failure (offset=%d)", this, caretOffset)); return; @@ -4356,7 +4356,7 @@ nsTextStore::CreateNativeCaret() mNativeCaretIsCreated = ::CreateCaret(mWidget->GetWindowHandle(), nullptr, caretRect.width, caretRect.height); if (!mNativeCaretIsCreated) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::CreateNativeCaret() FAILED due to " "CreateCaret() failure", this)); return; @@ -4365,7 +4365,7 @@ nsTextStore::CreateNativeCaret() nsWindow* window = static_cast(mWidget.get()); nsWindow* toplevelWindow = window->GetTopLevelWindow(false); if (!toplevelWindow) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::CreateNativeCaret() FAILED due to " "no top level window", this)); return; @@ -4382,7 +4382,7 @@ nsTextStore::CreateNativeCaret() void nsTextStore::CommitCompositionInternal(bool aDiscard) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::CommitCompositionInternal(aDiscard=%s), " "mSink=0x%p, mContext=0x%p, mComposition.mView=0x%p, " "mComposition.mString=\"%s\"", @@ -4398,7 +4398,7 @@ nsTextStore::CommitCompositionInternal(bool aDiscard) textChange.acpStart = mComposition.mStart; textChange.acpOldEnd = endOffset; textChange.acpNewEnd = mComposition.mStart; - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: 0x%p nsTextStore::CommitCompositionInternal(), calling" "mSink->OnTextChange(0, { acpStart=%ld, acpOldEnd=%ld, " "acpNewEnd=%ld })...", this, textChange.acpStart, @@ -4415,7 +4415,7 @@ nsTextStore::CommitCompositionInternal(bool aDiscard) context->QueryInterface(IID_ITfContextOwnerCompositionServices, getter_AddRefs(services)); if (services) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::CommitCompositionInternal(), " "requesting TerminateComposition() for the context 0x%p...", this, context.get())); @@ -4449,14 +4449,14 @@ GetCompartment(IUnknown* pUnk, void nsTextStore::SetIMEOpenState(bool aState) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: nsTextStore::SetIMEOpenState(aState=%s)", GetBoolName(aState))); nsRefPtr comp; if (!GetCompartment(sThreadMgr, GUID_COMPARTMENT_KEYBOARD_OPENCLOSE, getter_AddRefs(comp))) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: nsTextStore::SetIMEOpenState() FAILED due to" "no compartment available")); return; @@ -4465,7 +4465,7 @@ nsTextStore::SetIMEOpenState(bool aState) VARIANT variant; variant.vt = VT_I4; variant.lVal = aState; - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: nsTextStore::SetIMEOpenState(), setting " "0x%04X to GUID_COMPARTMENT_KEYBOARD_OPENCLOSE...", variant.lVal)); @@ -4497,7 +4497,7 @@ nsTextStore::SetInputContext(nsWindowBase* aWidget, const InputContext& aContext, const InputContextAction& aAction) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: nsTextStore::SetInputContext(aWidget=%p, " "aContext.mIMEState.mEnabled=%s, aAction.mFocusChange=%s), " "sEnabledTextStore=0x%p, ThinksHavingFocus()=%s", @@ -4535,13 +4535,13 @@ nsTextStore::MarkContextAsKeyboardDisabled(ITfContext* aContext) if (!GetCompartment(aContext, GUID_COMPARTMENT_KEYBOARD_DISABLED, getter_AddRefs(comp))) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::MarkContextAsKeyboardDisabled() failed" "aContext=0x%p...", aContext)); return; } - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: nsTextStore::MarkContextAsKeyboardDisabled(), setting " "to disable context 0x%p...", aContext)); @@ -4560,13 +4560,13 @@ nsTextStore::MarkContextAsEmpty(ITfContext* aContext) if (!GetCompartment(aContext, GUID_COMPARTMENT_EMPTYCONTEXT, getter_AddRefs(comp))) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::MarkContextAsEmpty() failed" "aContext=0x%p...", aContext)); return; } - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: nsTextStore::MarkContextAsEmpty(), setting " "to mark empty context 0x%p...", aContext)); comp->SetValue(sClientId, &variant_int4_value1); @@ -4580,11 +4580,11 @@ nsTextStore::Initialize() sTextStoreLog = PR_NewLogModule("nsTextStoreWidgets"); } - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: nsTextStore::Initialize() is called...")); if (sThreadMgr) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::Initialize() FAILED due to already initialized")); return; } @@ -4593,7 +4593,7 @@ nsTextStore::Initialize() Preferences::GetBool(kPrefNameForceEnableTSF, false) || (IsVistaOrLater() && Preferences::GetBool(kPrefNameEnableTSF, false) && !BrowserTabsRemoteAutostart()); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: nsTextStore::Initialize(), TSF is %s", enableTsf ? "enabled" : "disabled")); if (!enableTsf) { @@ -4611,7 +4611,7 @@ nsTextStore::Initialize() IID_ITfInputProcessorProfiles, getter_AddRefs(inputProcessorProfiles)); if (FAILED(hr) || !inputProcessorProfiles) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::Initialize() FAILED to create input processor " "profiles, hr=0x%08X", hr)); return; @@ -4622,7 +4622,7 @@ nsTextStore::Initialize() CLSCTX_INPROC_SERVER, IID_ITfThreadMgr, getter_AddRefs(threadMgr)); if (FAILED(hr) || !threadMgr) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::Initialize() FAILED to " "create the thread manager, hr=0x%08X", hr)); return; @@ -4632,7 +4632,7 @@ nsTextStore::Initialize() hr = threadMgr->QueryInterface(IID_ITfMessagePump, getter_AddRefs(messagePump)); if (FAILED(hr) || !messagePump) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::Initialize() FAILED to " "QI message pump from the thread manager, hr=0x%08X", hr)); return; @@ -4642,7 +4642,7 @@ nsTextStore::Initialize() hr = threadMgr->QueryInterface(IID_ITfKeystrokeMgr, getter_AddRefs(keystrokeMgr)); if (FAILED(hr) || !keystrokeMgr) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::Initialize() FAILED to " "QI keystroke manager from the thread manager, hr=0x%08X", hr)); return; @@ -4650,7 +4650,7 @@ nsTextStore::Initialize() hr = threadMgr->Activate(&sClientId); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::Initialize() FAILED to activate, hr=0x%08X", hr)); return; } @@ -4660,7 +4660,7 @@ nsTextStore::Initialize() CLSCTX_INPROC_SERVER, IID_ITfDisplayAttributeMgr, getter_AddRefs(displayAttributeMgr)); if (FAILED(hr) || !displayAttributeMgr) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::Initialize() FAILED to create " "a display attribute manager instance, hr=0x%08X", hr)); return; @@ -4671,7 +4671,7 @@ nsTextStore::Initialize() CLSCTX_INPROC_SERVER, IID_ITfCategoryMgr, getter_AddRefs(categoryMgr)); if (FAILED(hr) || !categoryMgr) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::Initialize() FAILED to create " "a category manager instance, hr=0x%08X", hr)); return; @@ -4680,7 +4680,7 @@ nsTextStore::Initialize() nsRefPtr disabledDocumentMgr; hr = threadMgr->CreateDocumentMgr(getter_AddRefs(disabledDocumentMgr)); if (FAILED(hr) || !disabledDocumentMgr) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::Initialize() FAILED to create " "a document manager for disabled mode, hr=0x%08X", hr)); return; @@ -4692,7 +4692,7 @@ nsTextStore::Initialize() getter_AddRefs(disabledContext), &editCookie); if (FAILED(hr) || !disabledContext) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::Initialize() FAILED to create " "a context for disabled mode, hr=0x%08X", hr)); return; @@ -4701,13 +4701,13 @@ nsTextStore::Initialize() MarkContextAsKeyboardDisabled(disabledContext); MarkContextAsEmpty(disabledContext); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: nsTextStore::Initialize() is creating " "a TSFStaticSink instance...")); TSFStaticSink* staticSink = TSFStaticSink::GetInstance(); if (!staticSink->Init(threadMgr, inputProcessorProfiles)) { TSFStaticSink::Shutdown(); - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::Initialize() FAILED to initialize TSFStaticSink " "instance")); return; @@ -4739,7 +4739,7 @@ nsTextStore::Initialize() "intl.tsf.hack.google_ja_input.do_not_return_no_layout_error_at_caret", true); - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: nsTextStore::Initialize(), sThreadMgr=0x%p, " "sClientId=0x%08X, sDisplayAttrMgr=0x%p, " "sCategoryMgr=0x%p, sDisabledDocumentMgr=0x%p, sDisabledContext=%p, " @@ -4761,7 +4761,7 @@ nsTextStore::Initialize() void nsTextStore::Terminate(void) { - PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, ("TSF: nsTextStore::Terminate()")); + MOZ_LOG(sTextStoreLog, LogLevel::Info, ("TSF: nsTextStore::Terminate()")); TSFStaticSink::Shutdown(); @@ -4994,19 +4994,19 @@ nsTextStore::MouseTracker::MouseTracker() HRESULT nsTextStore::MouseTracker::Init(nsTextStore* aTextStore) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::MouseTracker::Init(aTextStore=0x%p), " "aTextStore->mMouseTrackers.Length()=%d", this, aTextStore->mMouseTrackers.Length())); if (&aTextStore->mMouseTrackers.LastElement() != this) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::MouseTracker::Init() FAILED due to " "this is not the last element of mMouseTrackers", this)); return E_FAIL; } if (aTextStore->mMouseTrackers.Length() > kInvalidCookie) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::MouseTracker::Init() FAILED due to " "no new cookie available", this)); return E_FAIL; @@ -5022,14 +5022,14 @@ nsTextStore::MouseTracker::AdviseSink(nsTextStore* aTextStore, ITfRangeACP* aTextRange, ITfMouseSink* aMouseSink) { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::MouseTracker::AdviseSink(aTextStore=0x%p, " "aTextRange=0x%p, aMouseSink=0x%p), mCookie=%d, mSink=0x%p", this, aTextStore, aTextRange, aMouseSink, mCookie, mSink.get())); MOZ_ASSERT(mCookie != kInvalidCookie, "This hasn't been initalized?"); if (mSink) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::MouseTracker::AdviseMouseSink() FAILED " "due to already being used", this)); return E_FAIL; @@ -5037,14 +5037,14 @@ nsTextStore::MouseTracker::AdviseSink(nsTextStore* aTextStore, HRESULT hr = aTextRange->GetExtent(&mStart, &mLength); if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::MouseTracker::AdviseMouseSink() FAILED " "due to failure of ITfRangeACP::GetExtent()", this)); return hr; } if (mStart < 0 || mLength <= 0) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::MouseTracker::AdviseMouseSink() FAILED " "due to odd result of ITfRangeACP::GetExtent(), " "mStart=%d, mLength=%d", this, mStart, mLength)); @@ -5053,7 +5053,7 @@ nsTextStore::MouseTracker::AdviseSink(nsTextStore* aTextStore, nsAutoString textContent; if (NS_WARN_IF(!aTextStore->GetCurrentText(textContent))) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::MouseTracker::AdviseMouseSink() FAILED " "due to failure of nsTextStore::GetCurrentText()", this)); return E_FAIL; @@ -5061,7 +5061,7 @@ nsTextStore::MouseTracker::AdviseSink(nsTextStore* aTextStore, if (textContent.Length() <= static_cast(mStart) || textContent.Length() < static_cast(mStart + mLength)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: 0x%p nsTextStore::MouseTracker::AdviseMouseSink() FAILED " "due to out of range, mStart=%d, mLength=%d, " "textContent.Length()=%d", @@ -5071,7 +5071,7 @@ nsTextStore::MouseTracker::AdviseSink(nsTextStore* aTextStore, mSink = aMouseSink; - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::MouseTracker::AdviseMouseSink(), " "succeeded, mStart=%d, mLength=%d, textContent.Length()=%d", this, mStart, mLength, textContent.Length())); @@ -5081,7 +5081,7 @@ nsTextStore::MouseTracker::AdviseSink(nsTextStore* aTextStore, void nsTextStore::MouseTracker::UnadviseSink() { - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::MouseTracker::UnadviseSink(), " "mCookie=%d, mSink=0x%p, mStart=%d, mLength=%d", this, mCookie, mSink.get(), mStart, mLength)); @@ -5099,7 +5099,7 @@ nsTextStore::MouseTracker::OnMouseButtonEvent(ULONG aEdge, BOOL eaten = FALSE; HRESULT hr = mSink->OnMouseEvent(aEdge, aQuadrant, aButtonStatus, &eaten); - PR_LOG(sTextStoreLog, PR_LOG_DEBUG, + MOZ_LOG(sTextStoreLog, LogLevel::Debug, ("TSF: 0x%p nsTextStore::MouseTracker::OnMouseEvent(aEdge=%d, " "aQuadrant=%d, aButtonStatus=0x%08X), hr=0x%08X, eaten=%s", this, aEdge, aQuadrant, aButtonStatus, hr, GetBoolName(!!eaten))); @@ -5113,7 +5113,7 @@ bool nsTextStore::CurrentKeyboardLayoutHasIME() { if (!sInputProcessorProfiles) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::CurrentKeyboardLayoutHasIME() FAILED due to there is " "no input processor profiles instance")); return false; @@ -5127,7 +5127,7 @@ nsTextStore::CurrentKeyboardLayoutHasIME() // If we failed to obtain the profile manager, we cannot know if current // keyboard layout has IME. if (IsVistaOrLater()) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, PR_LOG_ERROR, ("TSF: nsTextStore::CurrentKeyboardLayoutHasIME() FAILED to query " "ITfInputProcessorProfileMgr")); return false; @@ -5144,7 +5144,7 @@ nsTextStore::CurrentKeyboardLayoutHasIME() return false; // not found or not active } if (FAILED(hr)) { - PR_LOG(sTextStoreLog, PR_LOG_ERROR, + MOZ_LOG(sTextStoreLog, LogLevel::Error, ("TSF: nsTextStore::CurrentKeyboardLayoutHasIME() FAILED to retreive " "active profile")); return false; diff --git a/widget/windows/nsWinGesture.cpp b/widget/windows/nsWinGesture.cpp index d612579371..3bd037d5e6 100644 --- a/widget/windows/nsWinGesture.cpp +++ b/widget/windows/nsWinGesture.cpp @@ -455,7 +455,7 @@ nsWinGesture::ProcessPanMessage(HWND hWnd, WPARAM wParam, LPARAM lParam) #ifdef DBG_jimm int32_t deltaX = mPanIntermediate.x - coord.x; int32_t deltaY = mPanIntermediate.y - coord.y; - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("coordX=%d coordY=%d deltaX=%d deltaY=%d x:%d y:%d\n", coord.x, coord.y, deltaX, deltaY, mXAxisFeedback, mYAxisFeedback)); #endif diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp index ebf200944c..05f22c5364 100644 --- a/widget/windows/nsWindow.cpp +++ b/widget/windows/nsWindow.cpp @@ -1387,7 +1387,7 @@ NS_METHOD nsWindow::Move(double aX, double aY) ::SystemParametersInfo(SPI_GETWORKAREA, 0, &workArea, 0); // no annoying assertions. just mention the issue. if (x < 0 || x >= workArea.right || y < 0 || y >= workArea.bottom) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("window moved to offscreen position\n")); } } @@ -1800,10 +1800,10 @@ NS_METHOD nsWindow::SetFocus(bool aRaise) if (mWnd) { #ifdef WINSTATE_DEBUG_OUTPUT if (mWnd == WinUtils::GetTopLevelHWND(mWnd)) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("*** SetFocus: [ top] raise=%d\n", aRaise)); } else { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("*** SetFocus: [child] raise=%d\n", aRaise)); } #endif @@ -2692,7 +2692,7 @@ void nsWindow::UpdateGlass() break; } - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("glass margins: left:%d top:%d right:%d bottom:%d\n", margins.cxLeftWidth, margins.cyTopHeight, margins.cxRightWidth, margins.cyBottomHeight)); @@ -3046,7 +3046,7 @@ NS_METHOD nsWindow::SetIcon(const nsAString& aIconSpec) #ifdef DEBUG_SetIcon else { NS_LossyConvertUTF16toASCII cPath(iconPath); - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("\nIcon load error; icon=%s, rc=0x%08X\n\n", cPath.get(), ::GetLastError())); } @@ -3060,7 +3060,7 @@ NS_METHOD nsWindow::SetIcon(const nsAString& aIconSpec) #ifdef DEBUG_SetIcon else { NS_LossyConvertUTF16toASCII cPath(iconPath); - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("\nSmall icon load error; icon=%s, rc=0x%08X\n\n", cPath.get(), ::GetLastError())); } @@ -3918,7 +3918,7 @@ bool nsWindow::DispatchMouseEvent(uint32_t aEventType, WPARAM wParam, event.clickCount = sLastClickCount; #ifdef NS_DEBUG_XX - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("Msg Time: %d Click Count: %d\n", curMsgTime, event.clickCount)); #endif @@ -5938,30 +5938,30 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS* wp) #ifdef WINSTATE_DEBUG_OUTPUT if (mWnd == WinUtils::GetTopLevelHWND(mWnd)) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("*** OnWindowPosChanged: [ top] ")); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("*** OnWindowPosChanged: [ top] ")); } else { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("*** OnWindowPosChanged: [child] ")); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("*** OnWindowPosChanged: [child] ")); } - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("WINDOWPOS flags:")); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("WINDOWPOS flags:")); if (wp->flags & SWP_FRAMECHANGED) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("SWP_FRAMECHANGED ")); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("SWP_FRAMECHANGED ")); } if (wp->flags & SWP_SHOWWINDOW) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("SWP_SHOWWINDOW ")); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("SWP_SHOWWINDOW ")); } if (wp->flags & SWP_NOSIZE) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("SWP_NOSIZE ")); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("SWP_NOSIZE ")); } if (wp->flags & SWP_HIDEWINDOW) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("SWP_HIDEWINDOW ")); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("SWP_HIDEWINDOW ")); } if (wp->flags & SWP_NOZORDER) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("SWP_NOZORDER ")); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("SWP_NOZORDER ")); } if (wp->flags & SWP_NOACTIVATE) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("SWP_NOACTIVATE ")); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("SWP_NOACTIVATE ")); } - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("\n")); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("\n")); #endif // Handle window size mode changes @@ -6005,19 +6005,19 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS* wp) #ifdef WINSTATE_DEBUG_OUTPUT switch (mSizeMode) { case nsSizeMode_Normal: - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("*** mSizeMode: nsSizeMode_Normal\n")); break; case nsSizeMode_Minimized: - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("*** mSizeMode: nsSizeMode_Minimized\n")); break; case nsSizeMode_Maximized: - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("*** mSizeMode: nsSizeMode_Maximized\n")); break; default: - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("*** mSizeMode: ??????\n")); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("*** mSizeMode: ??????\n")); break; }; #endif @@ -6101,7 +6101,7 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS* wp) mLastSize.height = newHeight; #ifdef WINSTATE_DEBUG_OUTPUT - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("*** Resize window: %d x %d x %d x %d\n", wp->x, wp->y, newWidth, newHeight)); #endif @@ -6790,7 +6790,7 @@ NS_IMETHODIMP nsWindow::GetToggledKeyState(uint32_t aKeyCode, bool* aLEDState) { #ifdef DEBUG_KBSTATE - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("GetToggledKeyState\n")); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("GetToggledKeyState\n")); #endif NS_ENSURE_ARG_POINTER(aLEDState); *aLEDState = (::GetKeyState(aKeyCode) & 1) != 0; @@ -7030,13 +7030,13 @@ LRESULT CALLBACK nsWindow::MozSpecialMsgFilter(int code, WPARAM wParam, LPARAM l if (code != gLastMsgCode) { if (gMSGFEvents[inx].mId == code) { #ifdef DEBUG - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("MozSpecialMessageProc - code: 0x%X - %s hw: %p\n", code, gMSGFEvents[inx].mStr, pMsg->hwnd)); #endif } else { #ifdef DEBUG - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("MozSpecialMessageProc - code: 0x%X - %d hw: %p\n", code, gMSGFEvents[inx].mId, pMsg->hwnd)); #endif @@ -7122,7 +7122,7 @@ void nsWindow::RegisterSpecialDropdownHooks() nullptr, GetCurrentThreadId()); #ifdef POPUP_ROLLUP_DEBUG_OUTPUT if (!sMsgFilterHook) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("***** SetWindowsHookEx is NOT installed for WH_MSGFILTER!\n")); } #endif @@ -7135,7 +7135,7 @@ void nsWindow::RegisterSpecialDropdownHooks() nullptr, GetCurrentThreadId()); #ifdef POPUP_ROLLUP_DEBUG_OUTPUT if (!sCallProcHook) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("***** SetWindowsHookEx is NOT installed for WH_CALLWNDPROC!\n")); } #endif @@ -7148,7 +7148,7 @@ void nsWindow::RegisterSpecialDropdownHooks() nullptr, GetCurrentThreadId()); #ifdef POPUP_ROLLUP_DEBUG_OUTPUT if (!sCallMouseHook) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("***** SetWindowsHookEx is NOT installed for WH_MOUSE!\n")); } #endif diff --git a/widget/windows/nsWindowDbg.cpp b/widget/windows/nsWindowDbg.cpp index e569c389ec..61bf4e992c 100644 --- a/widget/windows/nsWindowDbg.cpp +++ b/widget/windows/nsWindowDbg.cpp @@ -37,7 +37,7 @@ void PrintEvent(UINT msg, bool aShowAllEvents, bool aShowMouseMoves) } if (aShowAllEvents || (!aShowAllEvents && gLastEventMsg != (long)msg)) { if (aShowMouseMoves || (!aShowMouseMoves && msg != 0x0020 && msg != 0x0200 && msg != 0x0084)) { - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, + MOZ_LOG(gWindowsLog, LogLevel::Info, ("%6d - 0x%04X %s\n", gEventCounter++, msg, gAllEvents[inx].mStr ? gAllEvents[inx].mStr : "Unknown")); gLastEventMsg = msg; @@ -49,7 +49,7 @@ void PrintEvent(UINT msg, bool aShowAllEvents, bool aShowMouseMoves) void DDError(const char *msg, HRESULT hr) { /*XXX make nicer */ - PR_LOG(gWindowsLog, PR_LOG_ERROR, + MOZ_LOG(gWindowsLog, LogLevel::Error, ("direct draw error %s: 0x%08lx\n", msg, hr)); } #endif @@ -59,7 +59,7 @@ bool is_vk_down(int vk) { SHORT st = GetKeyState(vk); #ifdef DEBUG - PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ("is_vk_down vk=%x st=%x\n",vk, st)); + MOZ_LOG(gWindowsLog, LogLevel::Info, ("is_vk_down vk=%x st=%x\n",vk, st)); #endif return (st < 0); } diff --git a/widget/windows/nsWindowDbg.h b/widget/windows/nsWindowDbg.h index 5c1a1ef47a..6607699527 100644 --- a/widget/windows/nsWindowDbg.h +++ b/widget/windows/nsWindowDbg.h @@ -42,7 +42,7 @@ typedef struct { int mId; } MSGFEventMsgInfo; -#define DISPLAY_NMM_PRT(_arg) PR_LOG(gWindowsLog, PR_LOG_ALWAYS, ((_arg))); +#define DISPLAY_NMM_PRT(_arg) MOZ_LOG(gWindowsLog, mozilla::LogLevel::Info, ((_arg))); #else #define DISPLAY_NMM_PRT(_arg) #endif // defined(POPUP_ROLLUP_DEBUG_OUTPUT) diff --git a/widget/xremoteclient/XRemoteClient.cpp b/widget/xremoteclient/XRemoteClient.cpp index a7f0060cb7..cdc2e84fc5 100644 --- a/widget/xremoteclient/XRemoteClient.cpp +++ b/widget/xremoteclient/XRemoteClient.cpp @@ -51,6 +51,8 @@ #define ARRAY_LENGTH(array_) (sizeof(array_)/sizeof(array_[0])) +using mozilla::LogLevel; + static PRLogModuleInfo *sRemoteLm = nullptr; static int (*sOldHandler)(Display *, XErrorEvent *); @@ -69,12 +71,12 @@ XRemoteClient::XRemoteClient() mLockData = 0; if (!sRemoteLm) sRemoteLm = PR_NewLogModule("XRemoteClient"); - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("XRemoteClient::XRemoteClient")); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("XRemoteClient::XRemoteClient")); } XRemoteClient::~XRemoteClient() { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("XRemoteClient::~XRemoteClient")); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("XRemoteClient::~XRemoteClient")); if (mInitialized) Shutdown(); } @@ -96,7 +98,7 @@ static Atom XAtoms[ARRAY_LENGTH(XAtomNames)]; nsresult XRemoteClient::Init() { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("XRemoteClient::Init")); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("XRemoteClient::Init")); if (mInitialized) return NS_OK; @@ -129,7 +131,7 @@ XRemoteClient::Init() void XRemoteClient::Shutdown (void) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("XRemoteClient::Shutdown")); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("XRemoteClient::Shutdown")); if (!mInitialized) return; @@ -150,7 +152,7 @@ XRemoteClient::SendCommand (const char *aProgram, const char *aUsername, const char* aDesktopStartupID, char **aResponse, bool *aWindowFound) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("XRemoteClient::SendCommand")); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("XRemoteClient::SendCommand")); return SendCommandInternal(aProgram, aUsername, aProfile, aCommand, 0, nullptr, @@ -165,7 +167,7 @@ XRemoteClient::SendCommandLine (const char *aProgram, const char *aUsername, const char* aDesktopStartupID, char **aResponse, bool *aWindowFound) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("XRemoteClient::SendCommandLine")); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("XRemoteClient::SendCommandLine")); return SendCommandInternal(aProgram, aUsername, aProfile, nullptr, argc, argv, @@ -242,7 +244,7 @@ XRemoteClient::SendCommandInternal(const char *aProgram, const char *aUsername, XSetErrorHandler(sOldHandler); - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("SendCommandInternal returning 0x%x\n", rv)); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("SendCommandInternal returning 0x%x\n", rv)); return rv; } @@ -387,7 +389,7 @@ XRemoteClient::GetLock(Window aWindow, bool *aDestroyed) /* We tried to grab the lock this time, and failed because someone else is holding it already. So, wait for a PropertyDelete event to come in, and try again. */ - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("window 0x%x is locked by %s; waiting...\n", (unsigned int) aWindow, data)); waited = True; @@ -406,11 +408,11 @@ XRemoteClient::GetLock(Window aWindow, bool *aDestroyed) &select_set, nullptr, nullptr, &delay); // did we time out? if (select_retval == 0) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("timed out waiting for window\n")); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("timed out waiting for window\n")); rv = NS_ERROR_FAILURE; break; } - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("xevent...\n")); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("xevent...\n")); XNextEvent (mDisplay, &event); if (event.xany.type == DestroyNotify && event.xdestroywindow.window == aWindow) { @@ -424,7 +426,7 @@ XRemoteClient::GetLock(Window aWindow, bool *aDestroyed) event.xproperty.atom == mMozLockAtom) { /* Ok! Someone deleted their lock, so now we can try again. */ - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("(0x%x unlocked, trying again...)\n", (unsigned int) aWindow)); break; @@ -436,9 +438,9 @@ XRemoteClient::GetLock(Window aWindow, bool *aDestroyed) } while (!locked && !NS_FAILED(rv)); if (waited && locked) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("obtained lock.\n")); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("obtained lock.\n")); } else if (*aDestroyed) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("window 0x%x unexpectedly destroyed.\n", (unsigned int) aWindow)); } @@ -459,13 +461,13 @@ XRemoteClient::FindBestWindow(const char *aProgram, const char *aUsername, // Get a list of the children of the root window, walk the list // looking for the best window that fits the criteria. if (!XQueryTree(mDisplay, root, &root2, &parent, &kids, &nkids)) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("XQueryTree failed in XRemoteClient::FindBestWindow")); return 0; } if (!(kids && nkids)) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("root window has no children")); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("root window has no children")); return 0; } @@ -614,20 +616,20 @@ XRemoteClient::FreeLock(Window aWindow) &nitems, &bytes_after, &data); if (result != Success) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("unable to read and delete " MOZILLA_LOCK_PROP " property\n")); return NS_ERROR_FAILURE; } else if (!data || !*data){ - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("invalid data on " MOZILLA_LOCK_PROP " of window 0x%x.\n", (unsigned int) aWindow)); return NS_ERROR_FAILURE; } else if (strcmp((char *)data, mLockData)) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, (MOZILLA_LOCK_PROP " was stolen! Expected \"%s\", saw \"%s\"!\n", mLockData, data)); return NS_ERROR_FAILURE; @@ -645,7 +647,7 @@ XRemoteClient::DoSendCommand(Window aWindow, const char *aCommand, { *aDestroyed = false; - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("(writing " MOZILLA_COMMAND_PROP " \"%s\" to 0x%x)\n", aCommand, (unsigned int) aWindow)); @@ -777,7 +779,7 @@ XRemoteClient::WaitForResponse(Window aWindow, char **aResponse, if (event.xany.type == DestroyNotify && event.xdestroywindow.window == aWindow) { /* Print to warn user...*/ - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("window 0x%x was destroyed.\n", (unsigned int) aWindow)); *aResponse = strdup("Window was destroyed while reading response."); @@ -801,7 +803,7 @@ XRemoteClient::WaitForResponse(Window aWindow, char **aResponse, &nitems, &bytes_after, &data); if (result != Success) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("failed reading " MOZILLA_RESPONSE_PROP " from window 0x%0x.\n", (unsigned int) aWindow)); @@ -809,7 +811,7 @@ XRemoteClient::WaitForResponse(Window aWindow, char **aResponse, done = true; } else if (!data || strlen((char *) data) < 5) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("invalid data on " MOZILLA_RESPONSE_PROP " property of window 0x%0x.\n", (unsigned int) aWindow)); @@ -817,7 +819,7 @@ XRemoteClient::WaitForResponse(Window aWindow, char **aResponse, done = true; } else if (*data == '1') { /* positive preliminary reply */ - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("%s\n", data + 4)); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("%s\n", data + 4)); /* keep going */ done = false; } @@ -829,14 +831,14 @@ XRemoteClient::WaitForResponse(Window aWindow, char **aResponse, } else if (*data == '2') { /* positive completion */ - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("%s\n", data + 4)); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("%s\n", data + 4)); *aResponse = strdup((char *)data); accepted = true; done = true; } else if (*data == '3') { /* positive intermediate reply */ - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("internal error: " "server wants more information? (%s)\n", data)); @@ -846,13 +848,13 @@ XRemoteClient::WaitForResponse(Window aWindow, char **aResponse, else if (*data == '4' || /* transient negative completion */ *data == '5') { /* permanent negative completion */ - PR_LOG(sRemoteLm, PR_LOG_DEBUG, ("%s\n", data + 4)); + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("%s\n", data + 4)); *aResponse = strdup((char *)data); done = true; } else { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("unrecognised " MOZILLA_RESPONSE_PROP " from window 0x%x: %s\n", (unsigned int) aWindow, data)); @@ -868,7 +870,7 @@ XRemoteClient::WaitForResponse(Window aWindow, char **aResponse, event.xproperty.window == aWindow && event.xproperty.state == PropertyDelete && event.xproperty.atom == aCommandAtom) { - PR_LOG(sRemoteLm, PR_LOG_DEBUG, + MOZ_LOG(sRemoteLm, LogLevel::Debug, ("(server 0x%x has accepted " MOZILLA_COMMAND_PROP ".)\n", (unsigned int) aWindow)); diff --git a/xpcom/base/nsDebugImpl.cpp b/xpcom/base/nsDebugImpl.cpp index 719f2d2fbe..1c5f13d8a6 100644 --- a/xpcom/base/nsDebugImpl.cpp +++ b/xpcom/base/nsDebugImpl.cpp @@ -317,23 +317,23 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr, InitLog(); FixedBuffer buf; - PRLogModuleLevel ll = PR_LOG_WARNING; + mozilla::LogLevel ll = LogLevel::Warning; const char* sevString = "WARNING"; switch (aSeverity) { case NS_DEBUG_ASSERTION: sevString = "###!!! ASSERTION"; - ll = PR_LOG_ERROR; + ll = LogLevel::Error; break; case NS_DEBUG_BREAK: sevString = "###!!! BREAK"; - ll = PR_LOG_ALWAYS; + ll = LogLevel::Error; break; case NS_DEBUG_ABORT: sevString = "###!!! ABORT"; - ll = PR_LOG_ALWAYS; + ll = LogLevel::Error; break; default: @@ -369,12 +369,12 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr, # undef PrintToBuffer // Write out the message to the debug log - PR_LOG(gDebugLog, ll, ("%s", buf.buffer)); + MOZ_LOG(gDebugLog, ll, ("%s", buf.buffer)); PR_LogFlush(); // errors on platforms without a debugdlg ring a bell on stderr #if !defined(XP_WIN) - if (ll != PR_LOG_WARNING) { + if (ll != LogLevel::Warning) { fprintf(stderr, "\07"); } #endif diff --git a/xpcom/base/nsTraceRefcnt.cpp b/xpcom/base/nsTraceRefcnt.cpp index ea5e52c311..cd75450a2e 100644 --- a/xpcom/base/nsTraceRefcnt.cpp +++ b/xpcom/base/nsTraceRefcnt.cpp @@ -1014,7 +1014,7 @@ NS_LogAddRef(void* aPtr, nsrefcnt aRefcnt, } if (gRefcntsLog && loggingThisType && loggingThisObject) { - // Can't use PR_LOG(), b/c it truncates the line + // Can't use MOZ_LOG(), b/c it truncates the line fprintf(gRefcntsLog, "\n<%s> %p %" PRIuPTR " AddRef %" PRIuPTR "\n", aClass, aPtr, serialno, aRefcnt); nsTraceRefcnt::WalkTheStackCached(gRefcntsLog); @@ -1062,7 +1062,7 @@ NS_LogRelease(void* aPtr, nsrefcnt aRefcnt, const char* aClass) bool loggingThisObject = (!gObjectsToLog || LogThisObj(serialno)); if (gRefcntsLog && loggingThisType && loggingThisObject) { - // Can't use PR_LOG(), b/c it truncates the line + // Can't use MOZ_LOG(), b/c it truncates the line fprintf(gRefcntsLog, "\n<%s> %p %" PRIuPTR " Release %" PRIuPTR "\n", aClass, aPtr, serialno, aRefcnt); diff --git a/xpcom/build/perfprobe.cpp b/xpcom/build/perfprobe.cpp index 9eb99f3fe3..dee35ddcbf 100644 --- a/xpcom/build/perfprobe.cpp +++ b/xpcom/build/perfprobe.cpp @@ -26,7 +26,7 @@ GetProbeLog() } return sLog; } -#define LOG(x) PR_LOG(GetProbeLog(), PR_LOG_DEBUG, x) +#define LOG(x) MOZ_LOG(GetProbeLog(), mozilla::LogLevel::Debug, x) #else #define LOG(x) #endif diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp index 5c44fdc942..7ce18c002e 100644 --- a/xpcom/components/nsComponentManager.cpp +++ b/xpcom/components/nsComponentManager.cpp @@ -458,7 +458,7 @@ nsComponentManagerImpl::Init() // point. So we wait until now. nsCategoryManager::GetSingleton()->InitMemoryReporter(); - PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, + MOZ_LOG(nsComponentManagerLog, LogLevel::Debug, ("nsComponentManager: Initialized.")); mStatus = NORMAL; @@ -908,7 +908,7 @@ nsresult nsComponentManagerImpl::Shutdown(void) mStatus = SHUTDOWN_IN_PROGRESS; // Shutdown the component manager - PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, + MOZ_LOG(nsComponentManagerLog, LogLevel::Debug, ("nsComponentManager: Beginning Shutdown.")); #if !defined(MOZILLA_XPCOMRT_API) @@ -939,7 +939,7 @@ nsresult nsComponentManagerImpl::Shutdown(void) mStatus = SHUTDOWN_COMPLETE; - PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, + MOZ_LOG(nsComponentManagerLog, LogLevel::Debug, ("nsComponentManager: Shutdown complete.")); return NS_OK; @@ -947,14 +947,14 @@ nsresult nsComponentManagerImpl::Shutdown(void) nsComponentManagerImpl::~nsComponentManagerImpl() { - PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, + MOZ_LOG(nsComponentManagerLog, LogLevel::Debug, ("nsComponentManager: Beginning destruction.")); if (SHUTDOWN_COMPLETE != mStatus) { Shutdown(); } - PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, + MOZ_LOG(nsComponentManagerLog, LogLevel::Debug, ("nsComponentManager: Destroyed.")); } @@ -1026,7 +1026,7 @@ nsComponentManagerImpl::GetClassObject(const nsCID& aClass, const nsIID& aIID, { nsresult rv; - if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(nsComponentManagerLog, LogLevel::Debug)) { char* buf = aClass.ToString(); PR_LogPrint("nsComponentManager: GetClassObject(%s)", buf); if (buf) { @@ -1043,7 +1043,7 @@ nsComponentManagerImpl::GetClassObject(const nsCID& aClass, const nsIID& aIID, rv = factory->QueryInterface(aIID, aResult); - PR_LOG(nsComponentManagerLog, PR_LOG_WARNING, + MOZ_LOG(nsComponentManagerLog, LogLevel::Warning, ("\t\tGetClassObject() %s", NS_SUCCEEDED(rv) ? "succeeded" : "FAILED")); return rv; @@ -1062,7 +1062,7 @@ nsComponentManagerImpl::GetClassObjectByContractID(const char* aContractID, nsresult rv; - PR_LOG(nsComponentManagerLog, PR_LOG_DEBUG, + MOZ_LOG(nsComponentManagerLog, LogLevel::Debug, ("nsComponentManager: GetClassObject(%s)", aContractID)); nsCOMPtr factory = FindFactory(aContractID, strlen(aContractID)); @@ -1072,7 +1072,7 @@ nsComponentManagerImpl::GetClassObjectByContractID(const char* aContractID, rv = factory->QueryInterface(aIID, aResult); - PR_LOG(nsComponentManagerLog, PR_LOG_WARNING, + MOZ_LOG(nsComponentManagerLog, LogLevel::Warning, ("\t\tGetClassObject() %s", NS_SUCCEEDED(rv) ? "succeeded" : "FAILED")); return rv; @@ -1142,9 +1142,9 @@ nsComponentManagerImpl::CreateInstance(const nsCID& aClass, rv = NS_ERROR_FACTORY_NOT_REGISTERED; } - if (PR_LOG_TEST(nsComponentManagerLog, PR_LOG_WARNING)) { + if (MOZ_LOG_TEST(nsComponentManagerLog, LogLevel::Warning)) { char* buf = aClass.ToString(); - PR_LOG(nsComponentManagerLog, PR_LOG_WARNING, + MOZ_LOG(nsComponentManagerLog, LogLevel::Warning, ("nsComponentManager: CreateInstance(%s) %s", buf, NS_SUCCEEDED(rv) ? "succeeded" : "FAILED")); if (buf) { @@ -1225,7 +1225,7 @@ nsComponentManagerImpl::CreateInstanceByContractID(const char* aContractID, rv = NS_ERROR_FACTORY_NOT_REGISTERED; } - PR_LOG(nsComponentManagerLog, PR_LOG_WARNING, + MOZ_LOG(nsComponentManagerLog, LogLevel::Warning, ("nsComponentManager: CreateInstanceByContractID(%s) %s", aContractID, NS_SUCCEEDED(rv) ? "succeeded" : "FAILED")); diff --git a/xpcom/components/nsNativeModuleLoader.cpp b/xpcom/components/nsNativeModuleLoader.cpp index e230c169db..c8842d6e11 100644 --- a/xpcom/components/nsNativeModuleLoader.cpp +++ b/xpcom/components/nsNativeModuleLoader.cpp @@ -58,13 +58,13 @@ GetNativeModuleLoaderLog() return sLog; } -#define LOG(level, args) PR_LOG(GetNativeModuleLoaderLog(), level, args) +#define LOG(level, args) MOZ_LOG(GetNativeModuleLoaderLog(), level, args) nsresult nsNativeModuleLoader::Init() { MOZ_ASSERT(NS_IsMainThread(), "Startup not on main thread?"); - LOG(PR_LOG_DEBUG, ("nsNativeModuleLoader::Init()")); + LOG(LogLevel::Debug, ("nsNativeModuleLoader::Init()")); return NS_OK; } @@ -124,7 +124,7 @@ nsNativeModuleLoader::LoadModule(FileLocation& aFile) if (mLibraries.Get(hashedFile, &data)) { NS_ASSERTION(data.mModule, "Corrupt mLibraries hash"); - LOG(PR_LOG_DEBUG, + LOG(LogLevel::Debug, ("nsNativeModuleLoader::LoadModule(\"%s\") - found in cache", filePath.get())); return data.mModule; @@ -202,13 +202,13 @@ PLDHashOperator nsNativeModuleLoader::UnloaderFunc(nsIHashable* aHashedFile, NativeLoadData& aLoadData, void*) { - if (PR_LOG_TEST(GetNativeModuleLoaderLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetNativeModuleLoaderLog(), LogLevel::Debug)) { nsCOMPtr file(do_QueryInterface(aHashedFile)); nsAutoCString filePath; file->GetNativePath(filePath); - LOG(PR_LOG_DEBUG, + LOG(LogLevel::Debug, ("nsNativeModuleLoader::UnloaderFunc(\"%s\")", filePath.get())); } diff --git a/xpcom/ds/TimeStamp_windows.cpp b/xpcom/ds/TimeStamp_windows.cpp index d7140d7a98..3c278cf17a 100644 --- a/xpcom/ds/TimeStamp_windows.cpp +++ b/xpcom/ds/TimeStamp_windows.cpp @@ -27,7 +27,7 @@ // set NSPR_LOG_MODULES=TimeStampWindows:5 // set NSPR_LOG_FILE=nspr.log // -// this enables PR_LOG_DEBUG level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file nspr.log static PRLogModuleInfo* GetTimeStampLog() @@ -38,7 +38,7 @@ GetTimeStampLog() } return sLog; } -#define LOG(x) PR_LOG(GetTimeStampLog(), PR_LOG_DEBUG, x) +#define LOG(x) MOZ_LOG(GetTimeStampLog(), mozilla::LogLevel::Debug, x) // Estimate of the smallest duration of time we can measure. static volatile ULONGLONG sResolution; diff --git a/xpcom/ds/nsObserverService.cpp b/xpcom/ds/nsObserverService.cpp index e8b4de34b7..469e0003a7 100644 --- a/xpcom/ds/nsObserverService.cpp +++ b/xpcom/ds/nsObserverService.cpp @@ -24,7 +24,7 @@ // set NSPR_LOG_MODULES=ObserverService:5 // set NSPR_LOG_FILE=nspr.log // -// this enables PR_LOG_DEBUG level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file nspr.log static PRLogModuleInfo* GetObserverServiceLog() @@ -35,7 +35,7 @@ GetObserverServiceLog() } return sLog; } -#define LOG(x) PR_LOG(GetObserverServiceLog(), PR_LOG_DEBUG, x) +#define LOG(x) MOZ_LOG(GetObserverServiceLog(), mozilla::LogLevel::Debug, x) namespace mozilla { diff --git a/xpcom/glue/Logging.h b/xpcom/glue/Logging.h index 0e9c35f9bc..55b60668a0 100644 --- a/xpcom/glue/Logging.h +++ b/xpcom/glue/Logging.h @@ -63,5 +63,8 @@ inline bool log_test(const PRLogModuleInfo* module, LogLevel level) { } \ PR_END_MACRO +#undef PR_LOG +#undef PR_LOG_TEST + #endif // mozilla_logging_h diff --git a/xpcom/io/nsInputStreamTee.cpp b/xpcom/io/nsInputStreamTee.cpp index a382f202dd..28fceb509e 100644 --- a/xpcom/io/nsInputStreamTee.cpp +++ b/xpcom/io/nsInputStreamTee.cpp @@ -31,7 +31,7 @@ GetTeeLog() } return sLog; } -#define LOG(args) PR_LOG(GetTeeLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(GetTeeLog(), mozilla::LogLevel::Debug, args) class nsInputStreamTee final : public nsIInputStreamTee { diff --git a/xpcom/io/nsPipe3.cpp b/xpcom/io/nsPipe3.cpp index b5f7ff9589..260d87b91e 100644 --- a/xpcom/io/nsPipe3.cpp +++ b/xpcom/io/nsPipe3.cpp @@ -40,7 +40,7 @@ GetPipeLog() } return sLog; } -#define LOG(args) PR_LOG(GetPipeLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(GetPipeLog(), mozilla::LogLevel::Debug, args) #define DEFAULT_SEGMENT_SIZE 4096 #define DEFAULT_SEGMENT_COUNT 16 diff --git a/xpcom/io/nsStorageStream.cpp b/xpcom/io/nsStorageStream.cpp index 881dd2ab55..9ad360e795 100644 --- a/xpcom/io/nsStorageStream.cpp +++ b/xpcom/io/nsStorageStream.cpp @@ -38,7 +38,7 @@ using mozilla::ipc::StringInputStreamParams; // set NSPR_LOG_MODULES=StorageStreamLog:5 // set NSPR_LOG_FILE=nspr.log // -// this enables PR_LOG_DEBUG level information and places all output in +// this enables LogLevel::Debug level information and places all output in // the file nspr.log // static PRLogModuleInfo* @@ -53,7 +53,7 @@ GetStorageStreamLog() #ifdef LOG #undef LOG #endif -#define LOG(args) PR_LOG(GetStorageStreamLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(GetStorageStreamLog(), mozilla::LogLevel::Debug, args) nsStorageStream::nsStorageStream() : mSegmentedBuffer(0), mSegmentSize(0), mWriteInProgress(false), diff --git a/xpcom/threads/TimerThread.cpp b/xpcom/threads/TimerThread.cpp index 87d29eb829..3d2b376d99 100644 --- a/xpcom/threads/TimerThread.cpp +++ b/xpcom/threads/TimerThread.cpp @@ -82,7 +82,7 @@ TimerObserverRunnable::Run() nsresult TimerThread::Init() { - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("TimerThread::Init [%d]\n", mInitialized)); if (mInitialized) { @@ -129,7 +129,7 @@ TimerThread::Init() nsresult TimerThread::Shutdown() { - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, ("TimerThread::Shutdown begin\n")); + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("TimerThread::Shutdown begin\n")); if (!mThread) { return NS_ERROR_NOT_INITIALIZED; @@ -167,7 +167,7 @@ TimerThread::Shutdown() mThread->Shutdown(); // wait for the thread to die - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, ("TimerThread::Shutdown end\n")); + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("TimerThread::Shutdown end\n")); return NS_OK; } @@ -260,7 +260,7 @@ TimerThread::Run() RemoveTimerInternal(timer); timer = nullptr; - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("Timer thread woke up %fms from when it was supposed to\n", fabs((now - timerRef->mTimeout).ToMilliseconds()))); @@ -342,12 +342,12 @@ TimerThread::Run() } } - if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetTimerLog(), LogLevel::Debug)) { if (waitFor == PR_INTERVAL_NO_TIMEOUT) - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("waiting for PR_INTERVAL_NO_TIMEOUT\n")); else - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("waiting for %u\n", PR_IntervalToMilliseconds(waitFor))); } } diff --git a/xpcom/threads/nsEventQueue.cpp b/xpcom/threads/nsEventQueue.cpp index c02e156967..b858a7c512 100644 --- a/xpcom/threads/nsEventQueue.cpp +++ b/xpcom/threads/nsEventQueue.cpp @@ -25,7 +25,7 @@ GetLog() #ifdef LOG #undef LOG #endif -#define LOG(args) PR_LOG(GetLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(GetLog(), mozilla::LogLevel::Debug, args) nsEventQueue::nsEventQueue() : mReentrantMonitor("nsEventQueue.mReentrantMonitor") diff --git a/xpcom/threads/nsThread.cpp b/xpcom/threads/nsThread.cpp index 8caa7c373a..bf2a666c7c 100644 --- a/xpcom/threads/nsThread.cpp +++ b/xpcom/threads/nsThread.cpp @@ -83,7 +83,7 @@ GetThreadLog() #ifdef LOG #undef LOG #endif -#define LOG(args) PR_LOG(GetThreadLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(GetThreadLog(), mozilla::LogLevel::Debug, args) NS_DECL_CI_INTERFACE_GETTER(nsThread) diff --git a/xpcom/threads/nsThreadPool.cpp b/xpcom/threads/nsThreadPool.cpp index e61824bca6..62380342f0 100644 --- a/xpcom/threads/nsThreadPool.cpp +++ b/xpcom/threads/nsThreadPool.cpp @@ -27,7 +27,7 @@ GetThreadPoolLog() #ifdef LOG #undef LOG #endif -#define LOG(args) PR_LOG(GetThreadPoolLog(), PR_LOG_DEBUG, args) +#define LOG(args) MOZ_LOG(GetThreadPoolLog(), mozilla::LogLevel::Debug, args) // DESIGN: // o Allocate anonymous threads. diff --git a/xpcom/threads/nsTimerImpl.cpp b/xpcom/threads/nsTimerImpl.cpp index 77f70f1dec..27e18e1a61 100644 --- a/xpcom/threads/nsTimerImpl.cpp +++ b/xpcom/threads/nsTimerImpl.cpp @@ -13,11 +13,13 @@ #include "pratom.h" #include "GeckoProfiler.h" #include "mozilla/Atomics.h" +#include "mozilla/Logging.h" #ifdef MOZ_NUWA_PROCESS #include "ipc/Nuwa.h" #endif using mozilla::Atomic; +using mozilla::LogLevel; using mozilla::TimeDuration; using mozilla::TimeStamp; @@ -313,14 +315,14 @@ nsTimerImpl::Startup() void nsTimerImpl::Shutdown() { - if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetTimerLog(), LogLevel::Debug)) { double mean = 0, stddev = 0; myNS_MeanAndStdDev(sDeltaNum, sDeltaSum, sDeltaSumSquared, &mean, &stddev); - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("sDeltaNum = %f, sDeltaSum = %f, sDeltaSumSquared = %f\n", sDeltaNum, sDeltaSum, sDeltaSumSquared)); - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("mean: %fms, stddev: %fms\n", mean, stddev)); } @@ -569,7 +571,7 @@ nsTimerImpl::Fire() #endif TimeStamp now = TimeStamp::Now(); - if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetTimerLog(), LogLevel::Debug)) { TimeDuration a = now - mStart; // actual delay in intervals TimeDuration b = TimeDuration::FromMilliseconds(mDelay); // expected delay in intervals TimeDuration delta = (a > b) ? a - b : b - a; @@ -578,14 +580,14 @@ nsTimerImpl::Fire() sDeltaSumSquared += double(d) * double(d); sDeltaNum++; - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("[this=%p] expected delay time %4ums\n", this, mDelay)); - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("[this=%p] actual delay time %fms\n", this, a.ToMilliseconds())); - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("[this=%p] (mType is %d) -------\n", this, mType)); - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("[this=%p] delta %4dms\n", this, (a > b) ? (int32_t)d : -(int32_t)d)); @@ -650,7 +652,7 @@ nsTimerImpl::Fire() mFiring = false; mTimerCallbackWhileFiring = nullptr; - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("[this=%p] Took %fms to fire timer callback\n", this, (TimeStamp::Now() - now).ToMilliseconds())); @@ -698,9 +700,9 @@ nsTimerEvent::Run() return NS_OK; } - if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetTimerLog(), LogLevel::Debug)) { TimeStamp now = TimeStamp::Now(); - PR_LOG(GetTimerLog(), PR_LOG_DEBUG, + MOZ_LOG(GetTimerLog(), LogLevel::Debug, ("[this=%p] time between PostTimerEvent() and Fire(): %fms\n", this, (now - mInitTime).ToMilliseconds())); } @@ -739,7 +741,7 @@ nsTimerImpl::PostTimerEvent(already_AddRefed aTimerRef) return timer.forget(); } - if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetTimerLog(), LogLevel::Debug)) { event->mInitTime = TimeStamp::Now(); } @@ -786,7 +788,7 @@ nsTimerImpl::SetDelayInternal(uint32_t aDelay) mTimeout += delayInterval; - if (PR_LOG_TEST(GetTimerLog(), PR_LOG_DEBUG)) { + if (MOZ_LOG_TEST(GetTimerLog(), LogLevel::Debug)) { if (mStart.IsNull()) { mStart = now; } else {