Changeset 153736 in webkit


Ignore:
Timestamp:
Aug 5, 2013 7:53:49 PM (11 years ago)
Author:
mrowe@apple.com
Message:

Logging should be configurable using human-readable channel names rather than crazy bitmasks
<http://webkit.org/b/119031>

Implement shared logic for initializing logging channels based on human-readable channel names in WTF,
and rework the WebCore, WebKit and WebKit2 logging initialization on top of it.

Logging channels may now be enabled by providing a comma-separated list of channel names, with the special
"all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel
being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except
for history and loading being enabled.

For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow
the old user defaults to remain set for those people that need to switch between version of WebKit before and
after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel,
the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging.

For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for
consistency with the other platforms and to enable more code sharing.

While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when
adding a new logging channel. Now only the header in the relevant project needs to be updated.

Reviewed by Sam Weinig.

Source/WebCore:

  • GNUmakefile.list.am: Remove the now-unused InitializeLogging.h
  • Target.pri: Ditto.
  • WebCore.xcodeproj/project.pbxproj: Ditto.
  • platform/InitializeLogging.h: Removed. Ditto.
  • platform/Logging.cpp: Use WEBCORE_LOG_CHANNELS to define all of the channels.

(WebCore::logChannelByName): Renamed to match our naming conventions. Calls through to the new WTF function
to find a log channel rather than repeating the names of the log channels a further two times each.
(WebCore::initializeLoggingChannelsIfNecessary): Pass the channels and the log level string to the new
WTF function that handles the initialization.

  • platform/Logging.h: Declare a WEBCORE_LOG_CHANNELS macro that can be used to apply a preprocessor macro

across the set of all logging channels. Use this macro to declare the logging channels.

  • platform/blackberry/LoggingBlackBerry.cpp:

(WebCore::logLevelString): Pull the value out of the WEBKIT_DEBUG environment variable.

  • platform/efl/LoggingEfl.cpp:

(WebCore::logLevelString): Pull the value out of the WEBKIT_DEBUG environment variable, and then prepend
NotYetImplemented to it so that that channel will be enabled by default.

  • platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:

(WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink): Accommodate the rename to logChannelByName.

  • platform/gtk/LoggingGtk.cpp:

(WebCore::logLevelString): Pull the value out of the WEBKIT_DEBUG environment variable, and then prepend
NotYetImplemented to it so that that channel will be enabled by default.

  • platform/mac/LoggingMac.mm:

(WebCore::logLevelString): Pull the value out of the WebCoreLogging user default key.

  • platform/qt/LoggingQt.cpp:

(WebCore::logLevelString): Pull the value out of the QT_WEBKIT_LOG environment variable, and then prepend
NotYetImplemented to it so that the channel will be enabled by default.

  • platform/win/LoggingWin.cpp:

(WebCore::logLevelString): Pull the value out of the WebCoreLogging environment variable.

Source/WebKit/blackberry:

  • Api/BlackBerryGlobal.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.

Source/WebKit/efl:

  • ewk/ewk_main.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.

Source/WebKit/gtk:

  • webkit/webkitglobals.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.

Source/WebKit/mac:

  • Misc/WebKitLogging.h: Declare a WEBKIT_LOG_CHANNELS macro that can be used to apply a preprocessor macro

across the set of all logging channels. Use this macro to declare the logging channels.

  • Misc/WebKitLogging.m: Use WEBKIT_LOG_CHANNELS to define all of the channels. Pass the channels and the

preference value to the new WTF function that handles the initialization.

  • WebView/WebPreferenceKeysPrivate.h: Remove a key that does not need to be here.
  • WebView/WebView.mm: Switch from WebCore's InitializeLogging.h to Logging.h.

Source/WebKit/qt:

  • WebCoreSupport/InitWebCoreQt.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.

Source/WebKit/win:

  • WebKitLogging.cpp: Declare a WEBKIT_LOG_CHANNELS macro that can be used to apply a preprocessor macro across

the set of all logging channels. Use this macro to declare the logging channels.

  • WebKitLogging.h: Use WEBKIT_LOG_CHANNELS to define all of the channels. Pass the channels to the new WTF

function that handles the initialization. As per the previous implementation a developer needs to hard-code
their desired log level here.

  • WebView.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.

Source/WebKit2:

  • NetworkProcess/NetworkProcess.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.
  • Platform/Logging.cpp: Use WEBKIT2_LOG_CHANNELS to define all of the channels.

(WebKit::initializeLogChannelsIfNecessary): Pass the channels and the log level string to the new WTF function
that handles the initialization.
(WebKit::logChannelByName): Renamed to match our naming conventions. Calls through to the new WTF function
to find a log channel rather than repeating the names of the log channels a further two times each.
(WebKit::logLevelString): Provide a no-op implementation.

  • Platform/Logging.h: Declare a WEBKIT2_LOG_CHANNELS macro that can be used to apply a preprocessor macro

across the set of all logging channels. Use this macro to declare the logging channels.

  • Platform/efl/LoggingEfl.cpp:

(WebKit::logLevelString): Pull the value out of the WEBKIT_DEBUG environment variable.

  • Platform/gtk/LoggingGtk.cpp:

(WebKit::logLevelString): Ditto.

  • Platform/mac/Logging.mac.mm:

(WebKit::logLevelString): Pull the value out of the WebKit2Logging user default key.

  • Platform/qt/LoggingQt.cpp:

(WebKit::logLevelString): Pull the value out of the QT_WEBKIT_LOG environment variable.

  • Shared/WebKit2Initialize.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.
  • UIProcess/WebContext.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.

Source/WTF:

  • wtf/Assertions.cpp:

(WTFLogChannelByName): Iterate over the provided array of log channels, returning the first whose name
matches case-insensitively.
(setStateOfAllChannels): Helper function to set the state of all channels to a single value.
(WTFInitializeLogChannelStatesFromString): Parse a string containing a case-insensitive, comma-separated list
of channel names to enable or disable, with the latter being prefixed by a "-".

  • wtf/Assertions.h: Update the layout of WTFLogChannel to include only the state of the channel and its name.

Declare WTFLogChannelByName and WTFInitializeLogChannelStatesFromString.

  • wtf/RefCountedLeakCounter.cpp: Update to the new format of WTFLogChannel.
Location:
trunk/Source
Files:
1 deleted
44 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r153730 r153736  
     12013-07-26  Mark Rowe  <mrowe@apple.com>
     2
     3        Logging should be configurable using human-readable channel names rather than crazy bitmasks
     4        <http://webkit.org/b/119031>
     5
     6        Implement shared logic for initializing logging channels based on human-readable channel names in WTF,
     7        and rework the WebCore, WebKit and WebKit2 logging initialization on top of it.
     8
     9        Logging channels may now be enabled by providing a comma-separated list of channel names, with the special
     10        "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel
     11        being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except
     12        for history and loading being enabled.
     13
     14        For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow
     15        the old user defaults to remain set for those people that need to switch between version of WebKit before and
     16        after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel,
     17        the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging.
     18
     19        For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for
     20        consistency with the other platforms and to enable more code sharing.
     21
     22        While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when
     23        adding a new logging channel. Now only the header in the relevant project needs to be updated.
     24
     25        Reviewed by Sam Weinig.
     26
     27        * wtf/Assertions.cpp:
     28        (WTFLogChannelByName): Iterate over the provided array of log channels, returning the first whose name
     29        matches case-insensitively.
     30        (setStateOfAllChannels): Helper function to set the state of all channels to a single value.
     31        (WTFInitializeLogChannelStatesFromString): Parse a string containing a case-insensitive, comma-separated list
     32        of channel names to enable or disable, with the latter being prefixed by a "-".
     33        * wtf/Assertions.h: Update the layout of WTFLogChannel to include only the state of the channel and its name.
     34        Declare WTFLogChannelByName and WTFInitializeLogChannelStatesFromString.
     35        * wtf/RefCountedLeakCounter.cpp: Update to the new format of WTFLogChannel.
     36
    1372013-08-05  Benjamin Poulain  <bpoulain@apple.com>
    238
  • trunk/Source/WTF/wtf/Assertions.cpp

    r150228 r153736  
    11/*
    2  * Copyright (C) 2003, 2006, 2007 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2003, 2006, 2007, 2013 Apple Inc.  All rights reserved.
    33 * Copyright (C) 2007-2009 Torch Mobile, Inc.
    44 * Copyright (C) 2011 University of Szeged. All rights reserved.
     
    3737#include "Compiler.h"
    3838#include "OwnArrayPtr.h"
     39#include <wtf/StdLibExtras.h>
     40#include <wtf/text/CString.h>
     41#include <wtf/text/WTFString.h>
    3942
    4043#include <stdio.h>
     
    434437}
    435438
     439WTFLogChannel* WTFLogChannelByName(WTFLogChannel* channels[], size_t count, const char* name)
     440{
     441    for (size_t i = 0; i < count; ++i) {
     442        WTFLogChannel* channel = channels[i];
     443        if (!strcasecmp(name, channel->name))
     444            return channel;
     445    }
     446
     447    return 0;
     448}
     449
     450static void setStateOfAllChannels(WTFLogChannel* channels[], size_t channelCount, WTFLogChannelState state)
     451{
     452    for (size_t i = 0; i < channelCount; ++i)
     453        channels[i]->state = state;
     454}
     455
     456void WTFInitializeLogChannelStatesFromString(WTFLogChannel* channels[], size_t count, const char* logLevel)
     457{
     458    String logLevelString = logLevel;
     459    Vector<String> components;
     460    logLevelString.split(',', components);
     461
     462    for (size_t i = 0; i < components.size(); ++i) {
     463        String component = components[i];
     464
     465        WTFLogChannelState logChannelState = WTFLogChannelOn;
     466        if (component.startsWith('-')) {
     467            logChannelState = WTFLogChannelOff;
     468            component = component.substring(1);
     469        }
     470
     471        if (equalIgnoringCase(component, "all")) {
     472            setStateOfAllChannels(channels, count, logChannelState);
     473            continue;
     474        }
     475
     476        if (WTFLogChannel* channel = WTFLogChannelByName(channels, count, component.utf8().data()))
     477            channel->state = logChannelState;
     478        else
     479            WTFLogAlways("Unknown logging channel: %s", component.utf8().data());
     480    }
     481}
     482
    436483} // extern "C"
  • trunk/Source/WTF/wtf/Assertions.h

    r150228 r153736  
    11/*
    2  * Copyright (C) 2003, 2006, 2007 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2003, 2006, 2007, 2013 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    104104
    105105typedef struct {
    106     unsigned mask;
    107     const char *defaultName;
    108106    WTFLogChannelState state;
     107    const char* name;
    109108} WTFLogChannel;
    110109
     
    117116WTF_EXPORT_PRIVATE void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel*, const char* format, ...) WTF_ATTRIBUTE_PRINTF(5, 6);
    118117WTF_EXPORT_PRIVATE void WTFLogAlways(const char* format, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
     118WTF_EXPORT_PRIVATE WTFLogChannel* WTFLogChannelByName(WTFLogChannel*[], size_t count, const char*);
     119WTF_EXPORT_PRIVATE void WTFInitializeLogChannelStatesFromString(WTFLogChannel*[], size_t count, const char*);
    119120
    120121WTF_EXPORT_PRIVATE void WTFGetBacktrace(void** stack, int* size);
  • trunk/Source/WTF/wtf/RefCountedLeakCounter.cpp

    r130612 r153736  
    4040
    4141#define LOG_CHANNEL_PREFIX Log
    42 static WTFLogChannel LogRefCountedLeaks = { 0x00000000, "", WTFLogChannelOn };
     42static WTFLogChannel LogRefCountedLeaks = { WTFLogChannelOn, "RefCountedLeaks" };
    4343
    4444typedef HashCountedSet<const char*, PtrHash<const char*> > ReasonSet;
  • trunk/Source/WebCore/ChangeLog

    r153734 r153736  
     12013-07-27  Mark Rowe  <mrowe@apple.com>
     2
     3        Logging should be configurable using human-readable channel names rather than crazy bitmasks
     4        <http://webkit.org/b/119031>
     5
     6        Implement shared logic for initializing logging channels based on human-readable channel names in WTF,
     7        and rework the WebCore, WebKit and WebKit2 logging initialization on top of it.
     8
     9        Logging channels may now be enabled by providing a comma-separated list of channel names, with the special
     10        "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel
     11        being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except
     12        for history and loading being enabled.
     13
     14        For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow
     15        the old user defaults to remain set for those people that need to switch between version of WebKit before and
     16        after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel,
     17        the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging.
     18
     19        For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for
     20        consistency with the other platforms and to enable more code sharing.
     21
     22        While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when
     23        adding a new logging channel. Now only the header in the relevant project needs to be updated.
     24
     25        Reviewed by Sam Weinig.
     26
     27        * GNUmakefile.list.am: Remove the now-unused InitializeLogging.h
     28        * Target.pri: Ditto.
     29        * WebCore.xcodeproj/project.pbxproj: Ditto.
     30        * platform/InitializeLogging.h: Removed. Ditto.
     31        * platform/Logging.cpp: Use WEBCORE_LOG_CHANNELS to define all of the channels.
     32        (WebCore::logChannelByName): Renamed to match our naming conventions. Calls through to the new WTF function
     33        to find a log channel rather than repeating the names of the log channels a further two times each.
     34        (WebCore::initializeLoggingChannelsIfNecessary): Pass the channels and the log level string to the new
     35        WTF function that handles the initialization.
     36        * platform/Logging.h: Declare a WEBCORE_LOG_CHANNELS macro that can be used to apply a preprocessor macro
     37        across the set of all logging channels. Use this macro to declare the logging channels.
     38        * platform/blackberry/LoggingBlackBerry.cpp:
     39        (WebCore::logLevelString): Pull the value out of the WEBKIT_DEBUG environment variable.
     40        * platform/efl/LoggingEfl.cpp:
     41        (WebCore::logLevelString): Pull the value out of the WEBKIT_DEBUG environment variable, and then prepend
     42        NotYetImplemented to it so that that channel will be enabled by default.
     43        * platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp:
     44        (WebCore::MediaPlayerPrivateGStreamerBase::createVideoSink): Accommodate the rename to logChannelByName.
     45        * platform/gtk/LoggingGtk.cpp:
     46        (WebCore::logLevelString): Pull the value out of the WEBKIT_DEBUG environment variable, and then prepend
     47        NotYetImplemented to it so that that channel will be enabled by default.
     48        * platform/mac/LoggingMac.mm:
     49        (WebCore::logLevelString): Pull the value out of the WebCoreLogging user default key.
     50        * platform/qt/LoggingQt.cpp:
     51        (WebCore::logLevelString): Pull the value out of the QT_WEBKIT_LOG environment variable, and then prepend
     52        NotYetImplemented to it so that the channel will be enabled by default.
     53        * platform/win/LoggingWin.cpp:
     54        (WebCore::logLevelString): Pull the value out of the WebCoreLogging environment variable.
     55
    1562013-08-05  Ryosuke Niwa  <rniwa@webkit.org>
    257
  • trunk/Source/WebCore/GNUmakefile.list.am

    r153460 r153736  
    60676067        Source/WebCore/platform/HistogramSupport.h \
    60686068        Source/WebCore/platform/HostWindow.h \
    6069         Source/WebCore/platform/InitializeLogging.h \
    60706069        Source/WebCore/platform/KURL.cpp \
    60716070        Source/WebCore/platform/KURL.h \
  • trunk/Source/WebCore/Target.pri

    r152565 r153736  
    21352135    platform/FileSystem.h \
    21362136    platform/HistogramSupport.h \
    2137     platform/InitializeLogging.h \
    21382137    platform/image-decoders/ImageDecoder.h \
    21392138    platform/mock/DeviceMotionClientMock.h \
  • trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj

    r153541 r153736  
    35923592                A81872250977D3C0005826D9 /* ChildNodeList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A818721A0977D3C0005826D9 /* ChildNodeList.cpp */; };
    35933593                A8239E0009B3CF8A00B60641 /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8239DFE09B3CF8A00B60641 /* Logging.cpp */; };
    3594                 A8239E0109B3CF8A00B60641 /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = A8239DFF09B3CF8A00B60641 /* Logging.h */; settings = {ATTRIBUTES = (); }; };
     3594                A8239E0109B3CF8A00B60641 /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = A8239DFF09B3CF8A00B60641 /* Logging.h */; settings = {ATTRIBUTES = (Private, ); }; };
    35953595                A824B4650E2EF2EA0081A7B7 /* TextRun.h in Headers */ = {isa = PBXBuildFile; fileRef = A824B4640E2EF2EA0081A7B7 /* TextRun.h */; settings = {ATTRIBUTES = (Private, ); }; };
    35963596                A833C7CA0A2CF06B00D57664 /* SVGNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 656581E809D1508D000E61D7 /* SVGNames.cpp */; };
     
    53875387                E14F1C4414B5DAC600EA9009 /* HTMLFormControlElementWithState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E14F1C4214B5DAC600EA9009 /* HTMLFormControlElementWithState.cpp */; };
    53885388                E14F1C4514B5DAC600EA9009 /* HTMLFormControlElementWithState.h in Headers */ = {isa = PBXBuildFile; fileRef = E14F1C4314B5DAC600EA9009 /* HTMLFormControlElementWithState.h */; settings = {ATTRIBUTES = (Private, ); }; };
    5389                 E1513D4F1677EA8300149FCB /* InitializeLogging.h in Headers */ = {isa = PBXBuildFile; fileRef = E1513D4E1677EA8300149FCB /* InitializeLogging.h */; settings = {ATTRIBUTES = (Private, ); }; };
    53905389                E1513D511677F08800149FCB /* NotImplemented.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E1513D501677F08800149FCB /* NotImplemented.cpp */; };
    53915390                E152551516FD2350003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h in Headers */ = {isa = PBXBuildFile; fileRef = E152551316FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h */; };
     
    1217812177                E14F1C4214B5DAC600EA9009 /* HTMLFormControlElementWithState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLFormControlElementWithState.cpp; sourceTree = "<group>"; };
    1217912178                E14F1C4314B5DAC600EA9009 /* HTMLFormControlElementWithState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLFormControlElementWithState.h; sourceTree = "<group>"; };
    12180                 E1513D4E1677EA8300149FCB /* InitializeLogging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InitializeLogging.h; sourceTree = "<group>"; };
    1218112179                E1513D501677F08800149FCB /* NotImplemented.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NotImplemented.cpp; sourceTree = "<group>"; };
    1218212180                E152551316FD234F003D7ADB /* WebCoreResourceHandleAsOperationQueueDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreResourceHandleAsOperationQueueDelegate.h; sourceTree = "<group>"; };
     
    1933219330                                D630E2AB149BF344005B2F93 /* HistogramSupport.h */,
    1933319331                                BC3BC29B0E91AB0F00835588 /* HostWindow.h */,
    19334                                 E1513D4E1677EA8300149FCB /* InitializeLogging.h */,
    1933519332                                521D46F711AEC9B100514613 /* KillRing.h */,
    1933619333                                4306E4E514955543007F17AC /* KillRingNone.cpp */,
     
    2217422171                                07367DDF172CA67F00D861B9 /* InbandTextTrackPrivateLegacyAVFObjC.h in Headers */,
    2217522172                                DB23C2CC0A508D29002489EB /* IndentOutdentCommand.h in Headers */,
    22176                                 E1513D4F1677EA8300149FCB /* InitializeLogging.h in Headers */,
    2217722173                                F3644B001119805900E0D537 /* InjectedScript.h in Headers */,
    2217822174                                AAB6054F15874C58007B5031 /* InjectedScriptBase.h in Headers */,
  • trunk/Source/WebCore/platform/Logging.cpp

    r148071 r153736  
    11/*
    2  * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2003, 2006, 2013 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2727#include "Logging.h"
    2828
     29#include <wtf/StdLibExtras.h>
     30#include <wtf/text/CString.h>
    2931#include <wtf/text/WTFString.h>
    3032
     
    3335namespace WebCore {
    3436
    35 WTFLogChannel LogNotYetImplemented = { 0x00000001, "WebCoreLogLevel", WTFLogChannelOff };
     37#define DEFINE_LOG_CHANNEL(name) \
     38    WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name) = { WTFLogChannelOff, #name };
     39WEBCORE_LOG_CHANNELS(DEFINE_LOG_CHANNEL)
    3640
    37 WTFLogChannel LogFrames =            { 0x00000010, "WebCoreLogLevel", WTFLogChannelOff };
    38 WTFLogChannel LogLoading =           { 0x00000020, "WebCoreLogLevel", WTFLogChannelOff };
    39 WTFLogChannel LogPopupBlocking =     { 0x00000040, "WebCoreLogLevel", WTFLogChannelOff };
    40 WTFLogChannel LogEvents =            { 0x00000080, "WebCoreLogLevel", WTFLogChannelOff };
     41#define LOG_CHANNEL_ADDRESS(name)  &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name),
     42WTFLogChannel* logChannels[] = {
     43    WEBCORE_LOG_CHANNELS(LOG_CHANNEL_ADDRESS)
     44};
    4145
    42 WTFLogChannel LogEditing =           { 0x00000100, "WebCoreLogLevel", WTFLogChannelOff };
    43 WTFLogChannel LogLiveConnect =       { 0x00000200, "WebCoreLogLevel", WTFLogChannelOff };
    44 WTFLogChannel LogIconDatabase =      { 0x00000400, "WebCoreLogLevel", WTFLogChannelOff };
    45 WTFLogChannel LogSQLDatabase =       { 0x00000800, "WebCoreLogLevel", WTFLogChannelOff };
     46size_t logChannelCount = WTF_ARRAY_LENGTH(logChannels);
    4647
    47 WTFLogChannel LogSpellingAndGrammar ={ 0x00001000, "WebCoreLogLevel", WTFLogChannelOff };
    48 WTFLogChannel LogBackForward =       { 0x00002000, "WebCoreLogLevel", WTFLogChannelOff };
    49 WTFLogChannel LogHistory =           { 0x00004000, "WebCoreLogLevel", WTFLogChannelOff };
    50 WTFLogChannel LogPageCache =         { 0x00008000, "WebCoreLogLevel", WTFLogChannelOff };
     48WTFLogChannel* logChannelByName(const String& name)
     49{
     50    return WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data());
     51}
    5152
    52 WTFLogChannel LogPlatformLeaks =     { 0x00010000, "WebCoreLogLevel", WTFLogChannelOff };
    53 WTFLogChannel LogResourceLoading =   { 0x00020000, "WebCoreLogLevel", WTFLogChannelOff };
    54 WTFLogChannel LogAnimations =        { 0x00040000, "WebCoreLogLevel", WTFLogChannelOff };
     53void initializeLoggingChannelsIfNecessary()
     54{
     55    static bool haveInitializedLoggingChannels = false;
     56    if (haveInitializedLoggingChannels)
     57        return;
     58    haveInitializedLoggingChannels = true;
    5559
    56 WTFLogChannel LogNetwork =           { 0x00100000, "WebCoreLogLevel", WTFLogChannelOff };
    57 WTFLogChannel LogFTP =               { 0x00200000, "WebCoreLogLevel", WTFLogChannelOff };
    58 WTFLogChannel LogThreading =         { 0x00400000, "WebCoreLogLevel", WTFLogChannelOff };
    59 WTFLogChannel LogStorageAPI =        { 0x00800000, "WebCoreLogLevel", WTFLogChannelOff };
    60 
    61 WTFLogChannel LogMedia =             { 0x01000000, "WebCoreLogLevel", WTFLogChannelOff };
    62 WTFLogChannel LogPlugins =           { 0x02000000, "WebCoreLogLevel", WTFLogChannelOff };
    63 WTFLogChannel LogArchives =          { 0x04000000, "WebCoreLogLevel", WTFLogChannelOff };
    64 WTFLogChannel LogProgress =          { 0x08000000, "WebCoreLogLevel", WTFLogChannelOff };
    65 
    66 WTFLogChannel LogFileAPI =           { 0x10000000, "WebCoreLogLevel", WTFLogChannelOff };
    67 
    68 WTFLogChannel LogWebAudio =          { 0x20000000, "WebCoreLogLevel", WTFLogChannelOff };
    69 WTFLogChannel LogCompositing =       { 0x40000000, "WebCoreLogLevel", WTFLogChannelOff };
    70 WTFLogChannel LogGamepad =           { 0x80000000, "WebCoreLogLevel", WTFLogChannelOff };
    71 
    72 
    73 WTFLogChannel* getChannelFromName(const String& channelName)
    74 {
    75     if (!(channelName.length() >= 2))
    76         return 0;
    77 
    78     if (equalIgnoringCase(channelName, String("BackForward")))
    79         return &LogBackForward;
    80 
    81     if (equalIgnoringCase(channelName, String("Editing")))
    82         return &LogEditing;
    83 
    84     if (equalIgnoringCase(channelName, String("Events")))
    85         return &LogEvents;
    86 
    87     if (equalIgnoringCase(channelName, String("Frames")))
    88         return &LogFrames;
    89 
    90     if (equalIgnoringCase(channelName, String("FTP")))
    91         return &LogFTP;
    92 
    93     if (equalIgnoringCase(channelName, String("History")))
    94         return &LogHistory;
    95 
    96     if (equalIgnoringCase(channelName, String("IconDatabase")))
    97         return &LogIconDatabase;
    98 
    99     if (equalIgnoringCase(channelName, String("Loading")))
    100         return &LogLoading;
    101 
    102     if (equalIgnoringCase(channelName, String("Media")))
    103         return &LogMedia;
    104 
    105     if (equalIgnoringCase(channelName, String("Network")))
    106         return &LogNetwork;
    107 
    108     if (equalIgnoringCase(channelName, String("NotYetImplemented")))
    109         return &LogNotYetImplemented;
    110 
    111     if (equalIgnoringCase(channelName, String("PageCache")))
    112         return &LogPageCache;
    113 
    114     if (equalIgnoringCase(channelName, String("PlatformLeaks")))
    115         return &LogPlatformLeaks;
    116 
    117     if (equalIgnoringCase(channelName, String("ResourceLoading")))
    118         return &LogResourceLoading;
    119 
    120     if (equalIgnoringCase(channelName, String("Animations")))
    121         return &LogAnimations;
    122 
    123     if (equalIgnoringCase(channelName, String("Plugins")))
    124         return &LogPlugins;
    125 
    126     if (equalIgnoringCase(channelName, String("PopupBlocking")))
    127         return &LogPopupBlocking;
    128 
    129     if (equalIgnoringCase(channelName, String("Progress")))
    130         return &LogProgress;
    131 
    132     if (equalIgnoringCase(channelName, String("SpellingAndGrammar")))
    133         return &LogSpellingAndGrammar;
    134 
    135     if (equalIgnoringCase(channelName, String("SQLDatabase")))
    136         return &LogSQLDatabase;
    137 
    138     if (equalIgnoringCase(channelName, String("StorageAPI")))
    139         return &LogStorageAPI;
    140 
    141     if (equalIgnoringCase(channelName, String("LiveConnect")))
    142         return &LogLiveConnect;
    143 
    144     if (equalIgnoringCase(channelName, String("Threading")))
    145         return &LogThreading;
    146 
    147     if (equalIgnoringCase(channelName, String("FileAPI")))
    148         return &LogFileAPI;
    149 
    150     if (equalIgnoringCase(channelName, String("WebAudio")))
    151         return &LogWebAudio;
    152 
    153     if (equalIgnoringCase(channelName, String("Compositing")))
    154         return &LogCompositing;
    155 
    156     if (equalIgnoringCase(channelName, String("Gamepad")))
    157         return &LogGamepad;
    158 
    159     return 0;
     60    WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, logLevelString().utf8().data());
    16061}
    16162
  • trunk/Source/WebCore/platform/Logging.h

    r148071 r153736  
    11/*
    2  * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2003, 2006, 2013 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3838namespace WebCore {
    3939
    40     extern WTFLogChannel LogNotYetImplemented;
    41     extern WTFLogChannel LogFrames;
    42     extern WTFLogChannel LogLoading;
    43     extern WTFLogChannel LogPopupBlocking;
    44     extern WTFLogChannel LogEvents;
    45     extern WTFLogChannel LogEditing;
    46     extern WTFLogChannel LogLiveConnect;
    47     extern WTFLogChannel LogIconDatabase;
    48     extern WTFLogChannel LogSQLDatabase;
    49     extern WTFLogChannel LogSpellingAndGrammar;
    50     extern WTFLogChannel LogBackForward;
    51     extern WTFLogChannel LogHistory;
    52     extern WTFLogChannel LogPageCache;
    53     extern WTFLogChannel LogPlatformLeaks;
    54     extern WTFLogChannel LogResourceLoading;
    55     extern WTFLogChannel LogAnimations;
    56     extern WTFLogChannel LogNetwork;
    57     extern WTFLogChannel LogFTP;
    58     extern WTFLogChannel LogThreading;
    59     extern WTFLogChannel LogStorageAPI;
    60     extern WTFLogChannel LogMedia;
    61     extern WTFLogChannel LogPlugins;
    62     extern WTFLogChannel LogArchives;
    63     extern WTFLogChannel LogProgress;
    64     extern WTFLogChannel LogFileAPI;
    65     extern WTFLogChannel LogWebAudio;
    66     extern WTFLogChannel LogCompositing;
    67     extern WTFLogChannel LogGamepad;
     40#define WEBCORE_LOG_CHANNELS(M) \
     41    M(Animations) \
     42    M(Archives) \
     43    M(BackForward) \
     44    M(Compositing) \
     45    M(Editing) \
     46    M(Events) \
     47    M(FTP) \
     48    M(FileAPI) \
     49    M(Frames) \
     50    M(Gamepad) \
     51    M(History) \
     52    M(IconDatabase) \
     53    M(LiveConnect) \
     54    M(Loading) \
     55    M(Media) \
     56    M(Network) \
     57    M(NotYetImplemented) \
     58    M(PageCache) \
     59    M(PlatformLeaks) \
     60    M(Plugins) \
     61    M(PopupBlocking) \
     62    M(Progress) \
     63    M(ResourceLoading) \
     64    M(SQLDatabase) \
     65    M(SpellingAndGrammar) \
     66    M(StorageAPI) \
     67    M(Threading) \
     68    M(WebAudio) \
    6869
    69     WTFLogChannel* getChannelFromName(const String& channelName);
     70#define DECLARE_LOG_CHANNEL(name) \
     71    extern WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name);
     72
     73WEBCORE_LOG_CHANNELS(DECLARE_LOG_CHANNEL)
     74
     75#undef DECLARE_LOG_CHANNEL
     76
     77    extern WTFLogChannel* logChannels[];
     78    extern size_t logChannelCount;
     79
     80    String logLevelString();
     81    WTFLogChannel* logChannelByName(const String&);
     82    void initializeLoggingChannelsIfNecessary();
    7083}
    7184
  • trunk/Source/WebCore/platform/blackberry/LoggingBlackBerry.cpp

    r149822 r153736  
    11/*
    22 * Copyright (C) 2009, 2010, 2011 Research In Motion Limited. All rights reserved.
     3 * Copyright (C) 2013 Apple Inc. All Rights Reserved.
    34 *
    45 * This library is free software; you can redistribute it and/or
     
    2021#include "Logging.h"
    2122
    22 #include "InitializeLogging.h"
    23 
    2423#if !LOG_DISABLED
    2524
     
    2827namespace WebCore {
    2928
    30 static inline void initializeWithUserDefault(WTFLogChannel& channel, bool enabled)
     29String logLevelString()
    3130{
    32     if (enabled)
    33         channel.state = WTFLogChannelOn;
    34     else
    35         channel.state = WTFLogChannelOff;
    36 }
    37 
    38 void initializeLoggingChannelsIfNecessary()
    39 {
    40     static bool haveInitializedLoggingChannels = false;
    41     if (haveInitializedLoggingChannels)
    42         return;
    43     haveInitializedLoggingChannels = true;
    44 
    45     String logEnv = getenv("WEBKIT_DEBUG");
    46     if (logEnv.isEmpty())
    47         return;
    48 
    49     Vector<String> logv;
    50     logEnv.split(" ", logv);
    51 
    52     Vector<String>::const_iterator it = logv.begin();
    53     for (; it != logv.end(); ++it) {
    54         if (WTFLogChannel* channel = getChannelFromName(*it))
    55             channel->state = WTFLogChannelOn;
    56     }
     31    return getenv("WEBKIT_DEBUG");
    5732}
    5833
  • trunk/Source/WebCore/platform/efl/LoggingEfl.cpp

    r137486 r153736  
    44 * Copyright (C) 2009-2010 ProFUSION embedded systems
    55 * Copyright (C) 2009-2010 Samsung Electronics
     6 * Copyright (C) 2013 Apple Inc. All rights reserved.
    67 *
    78 * This library is free software; you can redistribute it and/or
     
    2223
    2324#include "config.h"
    24 #include "InitializeLogging.h"
    2525#include "Logging.h"
    2626
    2727#if !LOG_DISABLED
    2828
    29 #include <Eina.h>
    3029#include <wtf/text/WTFString.h>
    3130
    3231namespace WebCore {
    3332
    34 void initializeLoggingChannelsIfNecessary()
     33String logLevelString()
    3534{
    36     static bool didInitializeLoggingChannels = false;
    37     if (didInitializeLoggingChannels)
    38         return;
    39 
    40     didInitializeLoggingChannels = true;
    41 
    4235    char* logEnv = getenv("WEBKIT_DEBUG");
    4336    if (!logEnv)
    44         return;
     37        return emptyString();
    4538
    4639#if defined(NDEBUG)
     
    4841#endif
    4942
    50     char** logv = eina_str_split(logEnv, ",", -1);
    51 
    52     EINA_SAFETY_ON_NULL_RETURN(logv);
    53 
    54     for (int i = 0; logv[i]; i++) {
    55         if (WTFLogChannel* channel = getChannelFromName(logv[i]))
    56             channel->state = WTFLogChannelOn;
    57     }
    58 
    59     free(*logv);
    60     free(logv);
    61 
    62     // To disable logging notImplemented set the DISABLE_NI_WARNING
    63     // environment variable to 1.
    64     LogNotYetImplemented.state = WTFLogChannelOn;
     43    // To disable logging notImplemented set the DISABLE_NI_WARNING environment variable to 1.
     44    String logLevel = "NotYetImplemented,";
     45    logLevel.append(logEnv);
     46    return logLevel;
    6547}
    6648
  • trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerPrivateGStreamerBase.cpp

    r152711 r153736  
    573573            g_object_set(m_fpsSink, "text-overlay", FALSE , NULL);
    574574#else
    575             WTFLogChannel* channel = getChannelFromName("Media");
     575            WTFLogChannel* channel = logChannelByName("Media");
    576576            if (channel->state != WTFLogChannelOn)
    577577                g_object_set(m_fpsSink, "text-overlay", FALSE , NULL);
  • trunk/Source/WebCore/platform/gtk/LoggingGtk.cpp

    r137486 r153736  
    22 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
    33 * Copyright (C) 2009 Gustavo Noronha Silva <gns@gnome.org>
     4 * Copyright (C) 2013 Apple Inc. All rights reserved.
    45 *
    56 * This library is free software; you can redistribute it and/or
     
    2021
    2122#include "config.h"
    22 #include "InitializeLogging.h"
    2323#include "Logging.h"
    2424
     
    3131namespace WebCore {
    3232
    33 // Inspired by the code used by the Qt port
    34 
    35 void initializeLoggingChannelsIfNecessary()
     33String logLevelString()
    3634{
    37     static bool didInitializeLoggingChannels = false;
    38     if (didInitializeLoggingChannels)
    39         return;
    40 
    41     didInitializeLoggingChannels = true;
    42 
    4335    char* logEnv = getenv("WEBKIT_DEBUG");
    4436    if (!logEnv)
    45         return;
     37        return emptyString();
    4638
    47     // we set up the logs anyway because some of our logging, such as
    48     // soup's is available in release builds
     39    // We set up the logs anyway because some of our logging, such as Soup's is available in release builds.
    4940#if defined(NDEBUG)
    5041    g_warning("WEBKIT_DEBUG is not empty, but this is a release build. Notice that many log messages will only appear in a debug build.");
    5142#endif
    5243
    53     char** logv = g_strsplit(logEnv, " ", -1);
    54 
    55     for (int i = 0; logv[i]; i++) {
    56         if (WTFLogChannel* channel = getChannelFromName(logv[i]))
    57             channel->state = WTFLogChannelOn;
    58     }
    59 
    60     g_strfreev(logv);
    61 
    62     // to disable logging notImplemented set the DISABLE_NI_WARNING
    63     // environment variable to 1
    64     LogNotYetImplemented.state = WTFLogChannelOn;
     44    // To disable logging notImplemented set the DISABLE_NI_WARNING environment variable to 1.
     45    String logLevel = "NotYetImplemented,";
     46    logLevel.append(logEnv);
     47    return logLevel;
    6548}
    6649
  • trunk/Source/WebCore/platform/mac/LoggingMac.mm

    r148071 r153736  
    11/*
    2  * Copyright (C) 2003, 2006 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2003, 2006, 2013 Apple Computer, Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2525
    2626#include "config.h"
    27 #include "InitializeLogging.h"
    2827#include "Logging.h"
     28
     29#include <wtf/text/WTFString.h>
    2930
    3031#if !LOG_DISABLED
     
    3233namespace WebCore {
    3334
    34 static inline void initializeWithUserDefault(WTFLogChannel& channel)
     35static NSString * const defaultsDomain = @"WebCoreLogging";
     36
     37String logLevelString()
    3538{
    36     NSString *logLevelString = [[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithUTF8String:channel.defaultName]];
    37     if (logLevelString) {
    38         unsigned logLevel;
    39         if (![[NSScanner scannerWithString:logLevelString] scanHexInt:&logLevel])
    40             NSLog(@"unable to parse hex value for %s (%@), logging is off", channel.defaultName, logLevelString);
    41         if ((logLevel & channel.mask) == channel.mask)
    42             channel.state = WTFLogChannelOn;
    43         else
    44             channel.state = WTFLogChannelOff;
    45     }
    46 }
    47 
    48 void initializeLoggingChannelsIfNecessary()
    49 {
    50     static bool haveInitializedLoggingChannels = false;
    51     if (haveInitializedLoggingChannels)
    52         return;
    53     haveInitializedLoggingChannels = true;
    54    
    55     initializeWithUserDefault(LogNotYetImplemented);
    56     initializeWithUserDefault(LogFrames);
    57     initializeWithUserDefault(LogLoading);
    58     initializeWithUserDefault(LogPopupBlocking);
    59     initializeWithUserDefault(LogEvents);
    60     initializeWithUserDefault(LogEditing);
    61     initializeWithUserDefault(LogLiveConnect);
    62     initializeWithUserDefault(LogIconDatabase);
    63     initializeWithUserDefault(LogSQLDatabase);
    64     initializeWithUserDefault(LogSpellingAndGrammar);
    65     initializeWithUserDefault(LogBackForward);
    66     initializeWithUserDefault(LogHistory);
    67     initializeWithUserDefault(LogPageCache);
    68     initializeWithUserDefault(LogPlatformLeaks);
    69     initializeWithUserDefault(LogResourceLoading);
    70     initializeWithUserDefault(LogAnimations);
    71     initializeWithUserDefault(LogNetwork);
    72     initializeWithUserDefault(LogFTP);
    73     initializeWithUserDefault(LogThreading);
    74     initializeWithUserDefault(LogStorageAPI);
    75     initializeWithUserDefault(LogMedia);
    76     initializeWithUserDefault(LogPlugins);
    77     initializeWithUserDefault(LogArchives);
    78     initializeWithUserDefault(LogWebAudio);
    79     initializeWithUserDefault(LogCompositing);
     39    return [[NSUserDefaults standardUserDefaults] stringForKey:defaultsDomain];
    8040}
    8141
  • trunk/Source/WebCore/platform/qt/LoggingQt.cpp

    r137486 r153736  
    11/*
    22    Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
     3    Copyright (C) 2013 Apple Inc. All rights reserved.
    34
    45    This library is free software; you can redistribute it and/or
     
    1920
    2021#include "config.h"
    21 #include "InitializeLogging.h"
    2222#include "Logging.h"
    2323
     
    2525
    2626#include <QDebug>
    27 #include <QStringList>
    2827#include <wtf/text/WTFString.h>
    2928
    3029namespace WebCore {
    3130
    32 void initializeLoggingChannelsIfNecessary()
     31String logLevelString()
    3332{
    34     static bool haveInitializedLoggingChannels = false;
    35     if (haveInitializedLoggingChannels)
    36         return;
    37 
    38     haveInitializedLoggingChannels = true;
    39 
    4033    QByteArray loggingEnv = qgetenv("QT_WEBKIT_LOG");
    4134    if (loggingEnv.isEmpty())
    42         return;
     35        return emptyString();
    4336
    4437#if defined(NDEBUG)
    4538    qWarning("This is a release build. Setting QT_WEBKIT_LOG will have no effect.");
    4639#else
    47     QStringList channels = QString::fromLocal8Bit(loggingEnv).split(QLatin1String(","));
    48     for (int i = 0; i < channels.count(); i++) {
    49         if (WTFLogChannel* channel = getChannelFromName(channels.at(i)))
    50             channel->state = WTFLogChannelOn;
    51     }
    5240
    53     // By default we log calls to notImplemented(). This can be turned
    54     // off by setting the environment variable DISABLE_NI_WARNING to 1
    55     LogNotYetImplemented.state = WTFLogChannelOn;
     41    // To disable logging notImplemented set the DISABLE_NI_WARNING environment variable to 1.
     42    String logLevel = "NotYetImplemented,";
     43    logLevel.append(QString::fromLocal8Bit(loggingEnv));
     44    return logLevel;
    5645#endif
    5746}
  • trunk/Source/WebCore/platform/win/LoggingWin.cpp

    r148071 r153736  
    11/*
    2  * Copyright (C) 2008 Apple Inc. All Rights Reserved.
     2 * Copyright (C) 2008, 2013 Apple Inc. All Rights Reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2525
    2626#include "config.h"
    27 #include "InitializeLogging.h"
    2827#include "Logging.h"
    2928
     
    3635namespace WebCore {
    3736
    38 static inline void initializeWithUserDefault(WTFLogChannel& channel)
     37static char * const loggingEnvironmentVariable = "WebCoreLogging";
     38
     39String logLevelString()
    3940{
    40     DWORD length = GetEnvironmentVariableA(channel.defaultName, 0, 0);
     41    DWORD length = GetEnvironmentVariableA(loggingEnvironmentVariable, 0, 0);
    4142    if (!length)
    42         return;
     43        return emptyString();
    4344
    4445    OwnArrayPtr<char> buffer = adoptArrayPtr(new char[length]);
    4546
    46     if (!GetEnvironmentVariableA(channel.defaultName, buffer.get(), length))
    47         return;
     47    if (!GetEnvironmentVariableA(loggingEnvironmentVariable, buffer.get(), length))
     48        return emptyString();
    4849
    49     String variableValue(buffer.get());
    50 
    51     static const String& hexadecimalPrefix = *new String("0x");
    52     if (variableValue.length() < 3 || !variableValue.startsWith(hexadecimalPrefix, false)) {
    53         LOG_ERROR("Unable to parse hex value for %s (%s), logging is off", channel.defaultName, buffer.get());
    54         return;
    55     }
    56 
    57     String unprefixedValue = variableValue.substring(2);
    58 
    59     // Now parse the unprefixed string as a hexadecimal number.
    60     bool parsedSuccessfully = false;
    61     unsigned logLevel = unprefixedValue.toUIntStrict(&parsedSuccessfully, 16);
    62 
    63     if (!parsedSuccessfully) {
    64         LOG_ERROR("Unable to parse hex value for %s (%s), logging is off", channel.defaultName, buffer.get());
    65         return;
    66     }
    67 
    68     if ((logLevel & channel.mask) == channel.mask)
    69         channel.state = WTFLogChannelOn;
    70     else
    71         channel.state = WTFLogChannelOff;
    72 }
    73 
    74 void initializeLoggingChannelsIfNecessary()
    75 {
    76     static bool haveInitializedLoggingChannels = false;
    77     if (haveInitializedLoggingChannels)
    78         return;
    79     haveInitializedLoggingChannels = true;
    80 
    81     initializeWithUserDefault(LogNotYetImplemented);
    82     initializeWithUserDefault(LogFrames);
    83     initializeWithUserDefault(LogLoading);
    84     initializeWithUserDefault(LogPopupBlocking);
    85     initializeWithUserDefault(LogEvents);
    86     initializeWithUserDefault(LogEditing);
    87     initializeWithUserDefault(LogLiveConnect);
    88     initializeWithUserDefault(LogIconDatabase);
    89     initializeWithUserDefault(LogSQLDatabase);
    90     initializeWithUserDefault(LogSpellingAndGrammar);
    91     initializeWithUserDefault(LogBackForward);
    92     initializeWithUserDefault(LogHistory);
    93     initializeWithUserDefault(LogPageCache);
    94     initializeWithUserDefault(LogPlatformLeaks);
    95     initializeWithUserDefault(LogResourceLoading);
    96     initializeWithUserDefault(LogAnimations);
    97     initializeWithUserDefault(LogNetwork);
    98     initializeWithUserDefault(LogFTP);
    99     initializeWithUserDefault(LogThreading);
    100     initializeWithUserDefault(LogStorageAPI);
    101     initializeWithUserDefault(LogMedia);
    102     initializeWithUserDefault(LogPlugins);
    103     initializeWithUserDefault(LogArchives);
    104     initializeWithUserDefault(LogProgress);
    105     initializeWithUserDefault(LogFileAPI);
     50    return String(buffer.get());
    10651}
    10752
  • trunk/Source/WebKit/blackberry/Api/BlackBerryGlobal.cpp

    r150062 r153736  
    2626#include "FontCache.h"
    2727#include "ImageSource.h"
    28 #include "InitializeLogging.h"
    2928#include "InitializeThreading.h"
    3029#include "JSDOMWindow.h"
    31 #include "VM.h"
     30#include "Logging.h"
    3231#include "MemoryCache.h"
    3332#include "NetworkStateNotifier.h"
     
    3736#include "Settings.h"
    3837#include "TextureCacheCompositingThread.h"
     38#include "VM.h"
    3939#include "bindings/js/GCController.h"
    4040#include "runtime/JSLock.h"
  • trunk/Source/WebKit/blackberry/ChangeLog

    r153562 r153736  
     12013-07-27  Mark Rowe  <mrowe@apple.com>
     2
     3        Logging should be configurable using human-readable channel names rather than crazy bitmasks
     4        <http://webkit.org/b/119031>
     5
     6        Implement shared logic for initializing logging channels based on human-readable channel names in WTF,
     7        and rework the WebCore, WebKit and WebKit2 logging initialization on top of it.
     8
     9        Logging channels may now be enabled by providing a comma-separated list of channel names, with the special
     10        "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel
     11        being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except
     12        for history and loading being enabled.
     13
     14        For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow
     15        the old user defaults to remain set for those people that need to switch between version of WebKit before and
     16        after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel,
     17        the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging.
     18
     19        For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for
     20        consistency with the other platforms and to enable more code sharing.
     21
     22        While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when
     23        adding a new logging channel. Now only the header in the relevant project needs to be updated.
     24
     25        Reviewed by Sam Weinig.
     26
     27        * Api/BlackBerryGlobal.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.
     28
    1292013-07-31  Jacky Jiang  <zhajiang@blackberry.com>
    230
  • trunk/Source/WebKit/efl/ChangeLog

    r153408 r153736  
     12013-07-27  Mark Rowe  <mrowe@apple.com>
     2
     3        Logging should be configurable using human-readable channel names rather than crazy bitmasks
     4        <http://webkit.org/b/119031>
     5
     6        Implement shared logic for initializing logging channels based on human-readable channel names in WTF,
     7        and rework the WebCore, WebKit and WebKit2 logging initialization on top of it.
     8
     9        Logging channels may now be enabled by providing a comma-separated list of channel names, with the special
     10        "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel
     11        being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except
     12        for history and loading being enabled.
     13
     14        For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow
     15        the old user defaults to remain set for those people that need to switch between version of WebKit before and
     16        after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel,
     17        the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging.
     18
     19        For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for
     20        consistency with the other platforms and to enable more code sharing.
     21
     22        While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when
     23        adding a new logging channel. Now only the header in the relevant project needs to be updated.
     24
     25        Reviewed by Sam Weinig.
     26
     27        * ewk/ewk_main.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.
     28
    1292013-07-27  Jacky Jiang  <zhajiang@blackberry.com>
    230
  • trunk/Source/WebKit/efl/ewk/ewk_main.cpp

    r139541 r153736  
    2323
    2424#include "FileSystem.h"
    25 #include "InitializeLogging.h"
     25#include "Logging.h"
    2626#include "PageCache.h"
    2727#include "PageGroup.h"
  • trunk/Source/WebKit/gtk/ChangeLog

    r153652 r153736  
     12013-07-27  Mark Rowe  <mrowe@apple.com>
     2
     3        Logging should be configurable using human-readable channel names rather than crazy bitmasks
     4        <http://webkit.org/b/119031>
     5
     6        Implement shared logic for initializing logging channels based on human-readable channel names in WTF,
     7        and rework the WebCore, WebKit and WebKit2 logging initialization on top of it.
     8
     9        Logging channels may now be enabled by providing a comma-separated list of channel names, with the special
     10        "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel
     11        being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except
     12        for history and loading being enabled.
     13
     14        For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow
     15        the old user defaults to remain set for those people that need to switch between version of WebKit before and
     16        after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel,
     17        the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging.
     18
     19        For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for
     20        consistency with the other platforms and to enable more code sharing.
     21
     22        While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when
     23        adding a new logging channel. Now only the header in the relevant project needs to be updated.
     24
     25        Reviewed by Sam Weinig.
     26
     27        * webkit/webkitglobals.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.
     28
    1292013-08-02  Mario Sanchez Prada  <mario.prada@samsung.com>
    230
  • trunk/Source/WebKit/gtk/webkit/webkitglobals.cpp

    r152483 r153736  
    2727#include "FrameNetworkingContextGtk.h"
    2828#include "IconDatabase.h"
    29 #include "InitializeLogging.h"
     29#include "Logging.h"
    3030#include "MemoryCache.h"
    3131#include "Page.h"
    3232#include "PageCache.h"
    3333#include "PageGroup.h"
    34 #include "PlatformStrategiesGtk.h"
    35 #include "TextEncodingRegistry.h"
    3634#include "Pasteboard.h"
    3735#include "PasteboardHelperGtk.h"
     36#include "PlatformStrategiesGtk.h"
    3837#include "ResourceHandle.h"
    3938#include "ResourceHandleClient.h"
     
    4140#include "ResourceResponse.h"
    4241#include "SchemeRegistry.h"
     42#include "TextEncodingRegistry.h"
    4343#include "webkitapplicationcache.h"
    4444#include "webkitfavicondatabase.h"
  • trunk/Source/WebKit/mac/ChangeLog

    r153633 r153736  
     12013-07-26  Mark Rowe  <mrowe@apple.com>
     2
     3        Logging should be configurable using human-readable channel names rather than crazy bitmasks
     4        <http://webkit.org/b/119031>
     5
     6        Implement shared logic for initializing logging channels based on human-readable channel names in WTF,
     7        and rework the WebCore, WebKit and WebKit2 logging initialization on top of it.
     8
     9        Logging channels may now be enabled by providing a comma-separated list of channel names, with the special
     10        "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel
     11        being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except
     12        for history and loading being enabled.
     13
     14        For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow
     15        the old user defaults to remain set for those people that need to switch between version of WebKit before and
     16        after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel,
     17        the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging.
     18
     19        For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for
     20        consistency with the other platforms and to enable more code sharing.
     21
     22        While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when
     23        adding a new logging channel. Now only the header in the relevant project needs to be updated.
     24
     25        Reviewed by Sam Weinig.
     26
     27        * Misc/WebKitLogging.h: Declare a WEBKIT_LOG_CHANNELS macro that can be used to apply a preprocessor macro
     28        across the set of all logging channels. Use this macro to declare the logging channels.
     29        * Misc/WebKitLogging.m: Use WEBKIT_LOG_CHANNELS to define all of the channels. Pass the channels and the
     30        preference value to the new WTF function that handles the initialization.
     31        * WebView/WebPreferenceKeysPrivate.h: Remove a key that does not need to be here.
     32        * WebView/WebView.mm: Switch from WebCore's InitializeLogging.h to Logging.h.
     33
    1342013-08-01  Ruth Fong  <ruth_fong@apple.com>
    235
  • trunk/Source/WebKit/mac/Misc/WebKitLogging.h

    r121707 r153736  
    11/*
    2  * Copyright (C) 2005, 2007, 2008 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005, 2007, 2008, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3838
    3939#if !LOG_DISABLED
    40 extern WTFLogChannel WebKitLogTiming;
    41 extern WTFLogChannel WebKitLogLoading;
    42 extern WTFLogChannel WebKitLogFontCache;
    43 extern WTFLogChannel WebKitLogFontSubstitution;
    44 extern WTFLogChannel WebKitLogFontSelection;
    45 extern WTFLogChannel WebKitLogDownload;
    46 extern WTFLogChannel WebKitLogDocumentLoad;
    47 extern WTFLogChannel WebKitLogPlugins;
    48 extern WTFLogChannel WebKitLogEvents;
    49 extern WTFLogChannel WebKitLogView;
    50 extern WTFLogChannel WebKitLogRedirect;
    51 extern WTFLogChannel WebKitLogPageCache;
    52 extern WTFLogChannel WebKitLogCacheSizes;
    53 extern WTFLogChannel WebKitLogFormDelegate;
    54 extern WTFLogChannel WebKitLogFileDatabaseActivity;
    55 extern WTFLogChannel WebKitLogHistory;
    56 extern WTFLogChannel WebKitLogBindings;
    57 extern WTFLogChannel WebKitLogEncoding;
    58 extern WTFLogChannel WebKitLogLiveConnect;
    59 extern WTFLogChannel WebKitLogBackForward;
    60 extern WTFLogChannel WebKitLogProgress;
    61 extern WTFLogChannel WebKitLogPluginEvents;
    62 extern WTFLogChannel WebKitLogIconDatabase;
    63 extern WTFLogChannel WebKitLogTextInput;
     40
     41#define WEBKIT_LOG_CHANNELS(M) \
     42    M(BackForward) \
     43    M(Bindings) \
     44    M(CacheSizes) \
     45    M(DocumentLoad) \
     46    M(Download) \
     47    M(Encoding) \
     48    M(Events) \
     49    M(FileDatabaseActivity) \
     50    M(FontCache) \
     51    M(FontSelection) \
     52    M(FontSubstitution) \
     53    M(FormDelegate) \
     54    M(History) \
     55    M(IconDatabase) \
     56    M(LiveConnect) \
     57    M(Loading) \
     58    M(PageCache) \
     59    M(PluginEvents) \
     60    M(Plugins) \
     61    M(Progress) \
     62    M(Redirect) \
     63    M(TextInput) \
     64    M(Timing) \
     65    M(View) \
     66
     67#define DECLARE_LOG_CHANNEL(name) \
     68extern WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name);
     69
     70WEBKIT_LOG_CHANNELS(DECLARE_LOG_CHANNEL)
     71
     72#undef DECLARE_LOG_CHANNEL
    6473
    6574void WebKitInitializeLoggingChannelsIfNecessary(void);
  • trunk/Source/WebKit/mac/Misc/WebKitLogging.m

    r141447 r153736  
    11/*
    2  * Copyright (C) 2005, 2007 Apple Inc. All rights reserved.
     2 * Copyright (C) 2005, 2007, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3131#if !LOG_DISABLED
    3232
    33 WTFLogChannel WebKitLogTextInput =              { 0x00000010, "WebKitLogLevel", WTFLogChannelOff };
    34 WTFLogChannel WebKitLogTiming =                 { 0x00000020, "WebKitLogLevel", WTFLogChannelOff };
    35 WTFLogChannel WebKitLogLoading =                { 0x00000040, "WebKitLogLevel", WTFLogChannelOff };
    36 WTFLogChannel WebKitLogFontCache =              { 0x00000100, "WebKitLogLevel", WTFLogChannelOff };
    37 WTFLogChannel WebKitLogFontSubstitution =       { 0x00000200, "WebKitLogLevel", WTFLogChannelOff };
    38 WTFLogChannel WebKitLogDownload =               { 0x00000800, "WebKitLogLevel", WTFLogChannelOff };
    39 WTFLogChannel WebKitLogDocumentLoad =           { 0x00001000, "WebKitLogLevel", WTFLogChannelOff };
    40 WTFLogChannel WebKitLogPlugins =                { 0x00002000, "WebKitLogLevel", WTFLogChannelOff };
    41 WTFLogChannel WebKitLogEvents =                 { 0x00010000, "WebKitLogLevel", WTFLogChannelOff };
    42 WTFLogChannel WebKitLogView =                   { 0x00020000, "WebKitLogLevel", WTFLogChannelOff };
    43 WTFLogChannel WebKitLogRedirect =               { 0x00040000, "WebKitLogLevel", WTFLogChannelOff };
    44 WTFLogChannel WebKitLogPageCache =              { 0x00080000, "WebKitLogLevel", WTFLogChannelOff };
    45 WTFLogChannel WebKitLogCacheSizes =             { 0x00100000, "WebKitLogLevel", WTFLogChannelOff };
    46 WTFLogChannel WebKitLogFormDelegate =           { 0x00200000, "WebKitLogLevel", WTFLogChannelOff };
    47 WTFLogChannel WebKitLogFileDatabaseActivity =   { 0x00400000, "WebKitLogLevel", WTFLogChannelOff };
    48 WTFLogChannel WebKitLogHistory =                { 0x00800000, "WebKitLogLevel", WTFLogChannelOff };
    49 WTFLogChannel WebKitLogBindings =               { 0x01000000, "WebKitLogLevel", WTFLogChannelOff };
    50 WTFLogChannel WebKitLogFontSelection =          { 0x02000000, "WebKitLogLevel", WTFLogChannelOff };
    51 WTFLogChannel WebKitLogEncoding =               { 0x04000000, "WebKitLogLevel", WTFLogChannelOff };
    52 WTFLogChannel WebKitLogLiveConnect =            { 0x08000000, "WebKitLogLevel", WTFLogChannelOff };
    53 WTFLogChannel WebKitLogBackForward =            { 0x10000000, "WebKitLogLevel", WTFLogChannelOff };
    54 WTFLogChannel WebKitLogProgress =               { 0x20000000, "WebKitLogLevel", WTFLogChannelOff };
    55 WTFLogChannel WebKitLogPluginEvents =           { 0x40000000, "WebKitLogLevel", WTFLogChannelOff };
    56 WTFLogChannel WebKitLogIconDatabase =           { 0x80000000, "WebKitLogLevel", WTFLogChannelOff };
     33#define DEFINE_LOG_CHANNEL(name) \
     34    WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name) = { WTFLogChannelOff, #name };
     35WEBKIT_LOG_CHANNELS(DEFINE_LOG_CHANNEL)
    5736
    58 static void initializeLogChannel(WTFLogChannel *channel)
    59 {
    60     NSString *logLevelString = [[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithUTF8String:channel->defaultName]];
     37#define LOG_CHANNEL_ADDRESS(name)  &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name),
     38static WTFLogChannel* logChannels[] = {
     39    WEBKIT_LOG_CHANNELS(LOG_CHANNEL_ADDRESS)
     40};
    6141
    62     // If there's no log level string from the user defaults, don't obliterate the compiled in values.
    63     if (logLevelString) {
    64         channel->state = WTFLogChannelOff;
    65         unsigned logLevel;
    66         if (![[NSScanner scannerWithString:logLevelString] scanHexInt:&logLevel])
    67             NSLog(@"unable to parse hex value for %s (%@), logging is off", channel->defaultName, logLevelString);
    68         if ((logLevel & channel->mask) == channel->mask)
    69             channel->state = WTFLogChannelOn;
    70     }
    71 }
     42static const size_t logChannelCount = sizeof(logChannels) / sizeof(logChannels[0]);
     43
     44
     45static NSString * const defaultsDomain = @"WebKitLogging";
    7246
    7347void WebKitInitializeLoggingChannelsIfNecessary()
     
    7751        return;
    7852    haveInitializedLoggingChannels = true;
     53
     54    NSString *logLevel = [[NSUserDefaults standardUserDefaults] stringForKey:defaultsDomain];
     55    if (!logLevel)
     56        return;
    7957   
    80     initializeLogChannel(&WebKitLogTiming);
    81     initializeLogChannel(&WebKitLogLoading);
    82     initializeLogChannel(&WebKitLogFontCache);
    83     initializeLogChannel(&WebKitLogFontSubstitution);
    84     initializeLogChannel(&WebKitLogDownload);
    85     initializeLogChannel(&WebKitLogDocumentLoad);
    86     initializeLogChannel(&WebKitLogPlugins);
    87     initializeLogChannel(&WebKitLogEvents);
    88     initializeLogChannel(&WebKitLogView);
    89     initializeLogChannel(&WebKitLogRedirect);
    90     initializeLogChannel(&WebKitLogPageCache);
    91     initializeLogChannel(&WebKitLogCacheSizes);
    92     initializeLogChannel(&WebKitLogFormDelegate);
    93     initializeLogChannel(&WebKitLogFileDatabaseActivity);
    94     initializeLogChannel(&WebKitLogHistory);
    95     initializeLogChannel(&WebKitLogBindings);
    96     initializeLogChannel(&WebKitLogFontSelection);
    97     initializeLogChannel(&WebKitLogEncoding);
    98     initializeLogChannel(&WebKitLogLiveConnect);
    99     initializeLogChannel(&WebKitLogBackForward);
    100     initializeLogChannel(&WebKitLogProgress);
    101     initializeLogChannel(&WebKitLogPluginEvents);
    102     initializeLogChannel(&WebKitLogIconDatabase);
    103     initializeLogChannel(&WebKitLogTextInput);
     58    WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, [logLevel UTF8String]);
    10459}
     60
    10561#endif // !LOG_DISABLED
    10662
  • trunk/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h

    r152234 r153736  
    3030// a Private (as opposed to Internal) header file because Safari uses some of them
    3131// for managed preferences.
    32 #define WebKitLogLevelPreferenceKey @"WebKitLogLevel"
    3332#define WebKitStandardFontPreferenceKey @"WebKitStandardFont"
    3433#define WebKitFixedFontPreferenceKey @"WebKitFixedFont"
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r153549 r153736  
    143143#import <WebCore/HistoryItem.h>
    144144#import <WebCore/IconDatabase.h>
    145 #import <WebCore/InitializeLogging.h>
    146145#import <WebCore/JSCSSStyleDeclaration.h>
    147146#import <WebCore/JSDocument.h>
     
    149148#import <WebCore/JSNodeList.h>
    150149#import <WebCore/JSNotification.h>
     150#import <WebCore/Logging.h>
     151#import <WebCore/MIMETypeRegistry.h>
    151152#import <WebCore/MemoryPressureHandler.h>
    152 #import <WebCore/MIMETypeRegistry.h>
    153153#import <WebCore/NodeList.h>
    154154#import <WebCore/Notification.h>
  • trunk/Source/WebKit/qt/ChangeLog

    r153546 r153736  
     12013-07-27  Mark Rowe  <mrowe@apple.com>
     2
     3        Logging should be configurable using human-readable channel names rather than crazy bitmasks
     4        <http://webkit.org/b/119031>
     5
     6        Implement shared logic for initializing logging channels based on human-readable channel names in WTF,
     7        and rework the WebCore, WebKit and WebKit2 logging initialization on top of it.
     8
     9        Logging channels may now be enabled by providing a comma-separated list of channel names, with the special
     10        "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel
     11        being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except
     12        for history and loading being enabled.
     13
     14        For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow
     15        the old user defaults to remain set for those people that need to switch between version of WebKit before and
     16        after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel,
     17        the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging.
     18
     19        For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for
     20        consistency with the other platforms and to enable more code sharing.
     21
     22        While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when
     23        adding a new logging channel. Now only the header in the relevant project needs to be updated.
     24
     25        Reviewed by Sam Weinig.
     26
     27        * WebCoreSupport/InitWebCoreQt.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.
     28
    1292013-07-31  Kwang Yul Seo  <skyul@company100.net>
    230
  • trunk/Source/WebKit/qt/WebCoreSupport/InitWebCoreQt.cpp

    r151642 r153736  
    3535#include "Font.h"
    3636#include "Image.h"
    37 #include "InitializeLogging.h"
     37#include "Logging.h"
    3838#include "MemoryCache.h"
    3939#include "NotImplemented.h"
  • trunk/Source/WebKit/win/ChangeLog

    r153628 r153736  
     12013-07-26  Mark Rowe  <mrowe@apple.com>
     2
     3        Logging should be configurable using human-readable channel names rather than crazy bitmasks
     4        <http://webkit.org/b/119031>
     5
     6        Implement shared logic for initializing logging channels based on human-readable channel names in WTF,
     7        and rework the WebCore, WebKit and WebKit2 logging initialization on top of it.
     8
     9        Logging channels may now be enabled by providing a comma-separated list of channel names, with the special
     10        "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel
     11        being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except
     12        for history and loading being enabled.
     13
     14        For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow
     15        the old user defaults to remain set for those people that need to switch between version of WebKit before and
     16        after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel,
     17        the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging.
     18
     19        For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for
     20        consistency with the other platforms and to enable more code sharing.
     21
     22        While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when
     23        adding a new logging channel. Now only the header in the relevant project needs to be updated.
     24
     25        Reviewed by Sam Weinig.
     26
     27        * WebKitLogging.cpp: Declare a WEBKIT_LOG_CHANNELS macro that can be used to apply a preprocessor macro across
     28        the set of all logging channels. Use this macro to declare the logging channels.
     29        * WebKitLogging.h: Use WEBKIT_LOG_CHANNELS to define all of the channels. Pass the channels to the new WTF
     30        function that handles the initialization. As per the previous implementation a developer needs to hard-code
     31        their desired log level here.
     32        * WebView.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.
     33
    1342013-08-01  Brent Fulgham  <bfulgham@apple.com>
    235
  • trunk/Source/WebKit/win/WebKitLogging.cpp

    r52754 r153736  
    11/*
    2  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
    3  * Copyright (C) 2007 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2005, 2007, 2013 Apple Inc.  All rights reserved.
    43 *
    54 * Redistribution and use in source and binary forms, with or without
     
    3029#include "WebKitLogging.h"
    3130
    32 WTFLogChannel WebKitLogTextInput =              { 0x00000010, "WebKitLogLevel", WTFLogChannelOff };
    33 WTFLogChannel WebKitLogTiming =                 { 0x00000020, "WebKitLogLevel", WTFLogChannelOff };
    34 WTFLogChannel WebKitLogLoading =                { 0x00000040, "WebKitLogLevel", WTFLogChannelOff };
    35 WTFLogChannel WebKitLogFontCache =              { 0x00000100, "WebKitLogLevel", WTFLogChannelOff };
    36 WTFLogChannel WebKitLogFontSubstitution =       { 0x00000200, "WebKitLogLevel", WTFLogChannelOff };
    37 WTFLogChannel WebKitLogDownload =               { 0x00000800, "WebKitLogLevel", WTFLogChannelOff };
    38 WTFLogChannel WebKitLogDocumentLoad =           { 0x00001000, "WebKitLogLevel", WTFLogChannelOff };
    39 WTFLogChannel WebKitLogPlugins =                { 0x00002000, "WebKitLogLevel", WTFLogChannelOff };
    40 WTFLogChannel WebKitLogEvents =                 { 0x00010000, "WebKitLogLevel", WTFLogChannelOff };
    41 WTFLogChannel WebKitLogView =                   { 0x00020000, "WebKitLogLevel", WTFLogChannelOff };
    42 WTFLogChannel WebKitLogRedirect =               { 0x00040000, "WebKitLogLevel", WTFLogChannelOff };
    43 WTFLogChannel WebKitLogPageCache =              { 0x00080000, "WebKitLogLevel", WTFLogChannelOff };
    44 WTFLogChannel WebKitLogCacheSizes =             { 0x00100000, "WebKitLogLevel", WTFLogChannelOff };
    45 WTFLogChannel WebKitLogFormDelegate =           { 0x00200000, "WebKitLogLevel", WTFLogChannelOff };
    46 WTFLogChannel WebKitLogFileDatabaseActivity =   { 0x00400000, "WebKitLogLevel", WTFLogChannelOff };
    47 WTFLogChannel WebKitLogHistory =                { 0x00800000, "WebKitLogLevel", WTFLogChannelOff };
    48 WTFLogChannel WebKitLogBindings =               { 0x01000000, "WebKitLogLevel", WTFLogChannelOff };
    49 WTFLogChannel WebKitLogFontSelection =          { 0x02000000, "WebKitLogLevel", WTFLogChannelOff };
    50 WTFLogChannel WebKitLogEncoding =               { 0x04000000, "WebKitLogLevel", WTFLogChannelOff };
    51 WTFLogChannel WebKitLogLiveConnect =            { 0x08000000, "WebKitLogLevel", WTFLogChannelOff };
    52 WTFLogChannel WebKitLogBackForward =            { 0x10000000, "WebKitLogLevel", WTFLogChannelOff };
    53 WTFLogChannel WebKitLogProgress =               { 0x20000000, "WebKitLogLevel", WTFLogChannelOff };
    54 WTFLogChannel WebKitLogPluginEvents =           { 0x40000000, "WebKitLogLevel", WTFLogChannelOff };
    55 WTFLogChannel WebKitLogIconDatabase =           { 0x80000000, "WebKitLogLevel", WTFLogChannelOff };
     31#define DEFINE_LOG_CHANNEL(name) \
     32    WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name) = { WTFLogChannelOff, #name };
     33WEBKIT_LOG_CHANNELS(DEFINE_LOG_CHANNEL)
    5634
    57 static void initializeLogChannel(WTFLogChannel *)
    58 {
    59     // FIXME: Get the LogChannel preferences from somewhere, otherwise people will have to hard code
    60     // the logging channels they want to WTFLogChannelOn
    61 /*
    62     channel->state = WTFLogChannelOff;
    63     NSString *logLevelString = [[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithUTF8String:channel->defaultName]];
    64     if (logLevelString) {
    65         unsigned logLevel;
    66         if (![[NSScanner scannerWithString:logLevelString] scanHexInt:&logLevel])
    67             NSLog(@"unable to parse hex value for %s (%@), logging is off", channel->defaultName, logLevelString);
    68         if ((logLevel & channel->mask) == channel->mask)
    69             channel->state = WTFLogChannelOn;
    70     }
    71 */
    72 }
     35#define LOG_CHANNEL_ADDRESS(name)  &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name),
     36static WTFLogChannel* logChannels[] = {
     37    WEBKIT_LOG_CHANNELS(LOG_CHANNEL_ADDRESS)
     38};
     39
     40static const size_t logChannelCount = sizeof(logChannels) / sizeof(logChannels[0]);
    7341
    7442void WebKitInitializeLoggingChannelsIfNecessary()
     
    7846        return;
    7947    haveInitializedLoggingChannels = true;
    80    
    81     initializeLogChannel(&WebKitLogTextInput);
    82     initializeLogChannel(&WebKitLogTiming);
    83     initializeLogChannel(&WebKitLogLoading);
    84     initializeLogChannel(&WebKitLogFontCache);
    85     initializeLogChannel(&WebKitLogFontSubstitution);
    86     initializeLogChannel(&WebKitLogDownload);
    87     initializeLogChannel(&WebKitLogDocumentLoad);
    88     initializeLogChannel(&WebKitLogPlugins);
    89     initializeLogChannel(&WebKitLogEvents);
    90     initializeLogChannel(&WebKitLogView);
    91     initializeLogChannel(&WebKitLogRedirect);
    92     initializeLogChannel(&WebKitLogPageCache);
    93     initializeLogChannel(&WebKitLogCacheSizes);
    94     initializeLogChannel(&WebKitLogFormDelegate);
    95     initializeLogChannel(&WebKitLogFileDatabaseActivity);
    96     initializeLogChannel(&WebKitLogHistory);
    97     initializeLogChannel(&WebKitLogBindings);
    98     initializeLogChannel(&WebKitLogFontSelection);
    99     initializeLogChannel(&WebKitLogEncoding);
    100     initializeLogChannel(&WebKitLogLiveConnect);
    101     initializeLogChannel(&WebKitLogBackForward);
    102     initializeLogChannel(&WebKitLogProgress);
    103     initializeLogChannel(&WebKitLogPluginEvents);
    104     initializeLogChannel(&WebKitLogIconDatabase);
     48
     49    // FIXME: Get the log channel string from somewhere so people don't have to hardcode it here.
     50    WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, "");
    10551}
    106 
  • trunk/Source/WebKit/win/WebKitLogging.h

    r52754 r153736  
    11/*
    2  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
    3  * Copyright (C) 2007 Apple Inc.  All rights reserved.
     2 * Copyright (C) 2005, 2007, 2013 Apple Inc. All rights reserved.
    43 *
    54 * Redistribution and use in source and binary forms, with or without
     
    3635#endif
    3736
     37#define WEBKIT_LOG_CHANNELS(M) \
     38    M(BackForward) \
     39    M(Bindings) \
     40    M(CacheSizes) \
     41    M(DocumentLoad) \
     42    M(Download) \
     43    M(Encoding) \
     44    M(Events) \
     45    M(FileDatabaseActivity) \
     46    M(FontCache) \
     47    M(FontSelection) \
     48    M(FontSubstitution) \
     49    M(FormDelegate) \
     50    M(History) \
     51    M(IconDatabase) \
     52    M(LiveConnect) \
     53    M(Loading) \
     54    M(PageCache) \
     55    M(PluginEvents) \
     56    M(Plugins) \
     57    M(Progress) \
     58    M(Redirect) \
     59    M(TextInput) \
     60    M(Timing) \
     61    M(View) \
    3862
    39 extern WTFLogChannel WebKitLogTextInput;
    40 extern WTFLogChannel WebKitLogTiming;
    41 extern WTFLogChannel WebKitLogLoading;
    42 extern WTFLogChannel WebKitLogFontCache;
    43 extern WTFLogChannel WebKitLogFontSubstitution;
    44 extern WTFLogChannel WebKitLogFontSelection;
    45 extern WTFLogChannel WebKitLogDownload;
    46 extern WTFLogChannel WebKitLogDocumentLoad;
    47 extern WTFLogChannel WebKitLogPlugins;
    48 extern WTFLogChannel WebKitLogEvents;
    49 extern WTFLogChannel WebKitLogView;
    50 extern WTFLogChannel WebKitLogRedirect;
    51 extern WTFLogChannel WebKitLogPageCache;
    52 extern WTFLogChannel WebKitLogCacheSizes;
    53 extern WTFLogChannel WebKitLogFormDelegate;
    54 extern WTFLogChannel WebKitLogFileDatabaseActivity;
    55 extern WTFLogChannel WebKitLogHistory;
    56 extern WTFLogChannel WebKitLogBindings;
    57 extern WTFLogChannel WebKitLogEncoding;
    58 extern WTFLogChannel WebKitLogLiveConnect;
    59 extern WTFLogChannel WebKitLogBackForward;
    60 extern WTFLogChannel WebKitLogProgress;
    61 extern WTFLogChannel WebKitLogPluginEvents;
    62 extern WTFLogChannel WebKitLogIconDatabase;
     63#define DECLARE_LOG_CHANNEL(name) \
     64extern WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name);
     65
     66WEBKIT_LOG_CHANNELS(DECLARE_LOG_CHANNEL)
     67
     68#undef DECLARE_LOG_CHANNEL
    6369
    6470void WebKitInitializeLoggingChannelsIfNecessary(void);
  • trunk/Source/WebKit/win/WebView.cpp

    r153628 r153736  
    105105#include <WebCore/HitTestRequest.h>
    106106#include <WebCore/HitTestResult.h>
    107 #include <WebCore/InitializeLogging.h>
    108107#include <WebCore/IntRect.h>
    109108#include <WebCore/JSElement.h>
    110109#include <WebCore/KeyboardEvent.h>
     110#include <WebCore/Logging.h>
    111111#include <WebCore/MIMETypeRegistry.h>
    112112#include <WebCore/MemoryCache.h>
  • trunk/Source/WebKit2/ChangeLog

    r153724 r153736  
     12013-07-26  Mark Rowe  <mrowe@apple.com>
     2
     3        Logging should be configurable using human-readable channel names rather than crazy bitmasks
     4        <http://webkit.org/b/119031>
     5
     6        Implement shared logic for initializing logging channels based on human-readable channel names in WTF,
     7        and rework the WebCore, WebKit and WebKit2 logging initialization on top of it.
     8
     9        Logging channels may now be enabled by providing a comma-separated list of channel names, with the special
     10        "all" name enabling all channels. Channel names prefixed with a leading "-" will result in the named channel
     11        being disabled. For instance, specifying "all,-history,-loading" will result in all logging channels except
     12        for history and loading being enabled.
     13
     14        For OS X developers, this also changes the name of the user defaults used to enable logging. This is done to allow
     15        the old user defaults to remain set for those people that need to switch between version of WebKit before and
     16        after this change. Where the old user default keys were WebCoreLogLevel, WebKitLogLevel and WebKit2LogLevel,
     17        the new user default keys are WebCoreLogging, WebKitLogging and WebKit2Logging.
     18
     19        For GTK developers, this changes the separator used in the WEBKIT_DEBUG environment variable to a comma for
     20        consistency with the other platforms and to enable more code sharing.
     21
     22        While doing this work I've also taken the opportunity to eliminate the need to touch multiple files when
     23        adding a new logging channel. Now only the header in the relevant project needs to be updated.
     24
     25        Reviewed by Sam Weinig.
     26
     27        * NetworkProcess/NetworkProcess.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.
     28        * Platform/Logging.cpp: Use WEBKIT2_LOG_CHANNELS to define all of the channels.
     29        (WebKit::initializeLogChannelsIfNecessary): Pass the channels and the log level string to the new WTF function
     30        that handles the initialization.
     31        (WebKit::logChannelByName): Renamed to match our naming conventions. Calls through to the new WTF function
     32        to find a log channel rather than repeating the names of the log channels a further two times each.
     33        (WebKit::logLevelString): Provide a no-op implementation.
     34        * Platform/Logging.h: Declare a WEBKIT2_LOG_CHANNELS macro that can be used to apply a preprocessor macro
     35        across the set of all logging channels. Use this macro to declare the logging channels.
     36        * Platform/efl/LoggingEfl.cpp:
     37        (WebKit::logLevelString): Pull the value out of the WEBKIT_DEBUG environment variable.
     38        * Platform/gtk/LoggingGtk.cpp:
     39        (WebKit::logLevelString): Ditto.
     40        * Platform/mac/Logging.mac.mm:
     41        (WebKit::logLevelString): Pull the value out of the WebKit2Logging user default key.
     42        * Platform/qt/LoggingQt.cpp:
     43        (WebKit::logLevelString): Pull the value out of the QT_WEBKIT_LOG environment variable.
     44        * Shared/WebKit2Initialize.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.
     45        * UIProcess/WebContext.cpp: Switch from WebCore's InitializeLogging.h to Logging.h.
     46
    1472013-08-05  Anders Carlsson  <andersca@apple.com>
    248
  • trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp

    r149413 r153736  
    4343#include "WebContextMessages.h"
    4444#include "WebCookieManager.h"
    45 #include <WebCore/InitializeLogging.h>
     45#include <WebCore/Logging.h>
    4646#include <WebCore/ResourceRequest.h>
    4747#include <WebCore/RunLoop.h>
  • trunk/Source/WebKit2/Platform/Logging.cpp

    r137486 r153736  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2013 Apple Inc. All rights reserved.
    33 * Copyright (C) 2011 Samsung Electronics
    44 *
     
    2828#include "Logging.h"
    2929
     30#include <wtf/text/CString.h>
     31
    3032#if !LOG_DISABLED
    3133
    3234namespace WebKit {
    3335
    34 WTFLogChannel LogSessionState      = { 0x00000001, "WebKit2LogLevel", WTFLogChannelOff };
    35 WTFLogChannel LogContextMenu       = { 0x00000002, "WebKit2LogLevel", WTFLogChannelOff };
    36 WTFLogChannel LogTextInput         = { 0x00000004, "WebKit2LogLevel", WTFLogChannelOff };
    37 WTFLogChannel LogView              = { 0x00000008, "WebKit2LogLevel", WTFLogChannelOff };
    38 WTFLogChannel LogIconDatabase      = { 0x00000010, "WebKit2LogLevel", WTFLogChannelOff };
    39 WTFLogChannel LogKeyHandling       = { 0x00000020, "WebKit2LogLevel", WTFLogChannelOff };
    40 WTFLogChannel LogPlugins           = { 0x00000040, "WebKit2LogLevel", WTFLogChannelOff };
    41 WTFLogChannel LogNetwork           = { 0x00000080, "WebKit2LogLevel", WTFLogChannelOff };
    42 WTFLogChannel LogNetworkScheduling = { 0x00000100, "WebKit2LogLevel", WTFLogChannelOff };
    43 WTFLogChannel LogInspectorServer   = { 0x00000200, "WebKit2LogLevel", WTFLogChannelOff };
     36#define DEFINE_LOG_CHANNEL(name) \
     37    WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name) = { WTFLogChannelOff, #name };
     38WEBKIT2_LOG_CHANNELS(DEFINE_LOG_CHANNEL)
    4439
    45 #if !PLATFORM(MAC) && !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL)
    46 void initializeLogChannel(WTFLogChannel* channel)
    47 {
    48     // FIXME: Each platform will need to define their own initializeLogChannel().
    49 }
    50 #endif
     40#define LOG_CHANNEL_ADDRESS(name)  &JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name),
     41static WTFLogChannel* logChannels[] = {
     42    WEBKIT2_LOG_CHANNELS(LOG_CHANNEL_ADDRESS)
     43};
    5144
    52 #if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL)
    53 WTFLogChannel* getChannelFromName(const String& channelName)
    54 {
    55     if (!(channelName.length() >= 2))
    56         return 0;
    57 
    58     if (equalIgnoringCase(channelName, String("SessionState")))
    59         return &LogSessionState;
    60 
    61     if (equalIgnoringCase(channelName, String("ContextMenu")))
    62         return &LogContextMenu;
    63 
    64     if (equalIgnoringCase(channelName, String("TextInput")))
    65         return &LogTextInput;
    66 
    67     if (equalIgnoringCase(channelName, String("View")))
    68         return &LogView;
    69 
    70     if (equalIgnoringCase(channelName, String("IconDatabase")))
    71         return &LogIconDatabase;
    72 
    73     if (equalIgnoringCase(channelName, String("KeyHandling")))
    74         return &LogKeyHandling;
    75 
    76     if (equalIgnoringCase(channelName, String("Plugins")))
    77         return &LogPlugins;
    78 
    79     if (equalIgnoringCase(channelName, String("Network")))
    80         return &LogNetwork;
    81 
    82     if (equalIgnoringCase(channelName, String("InspectorServer")))
    83         return &LogInspectorServer;
    84 
    85     return 0;
    86 }
    87 #endif
     45const size_t logChannelCount = WTF_ARRAY_LENGTH(logChannels);
    8846
    8947void initializeLogChannelsIfNecessary()
     
    9452    haveInitializedLogChannels = true;
    9553
    96     initializeLogChannel(&LogSessionState);
    97     initializeLogChannel(&LogContextMenu);
    98     initializeLogChannel(&LogTextInput);
    99     initializeLogChannel(&LogView);
    100     initializeLogChannel(&LogIconDatabase);
    101     initializeLogChannel(&LogKeyHandling);
    102     initializeLogChannel(&LogPlugins);
    103     initializeLogChannel(&LogNetwork);
    104     initializeLogChannel(&LogNetworkScheduling);
    105     initializeLogChannel(&LogInspectorServer);
     54    static bool haveInitializedLoggingChannels = false;
     55    if (haveInitializedLoggingChannels)
     56        return;
     57    haveInitializedLoggingChannels = true;
     58   
     59    WTFInitializeLogChannelStatesFromString(logChannels, logChannelCount, logLevelString().utf8().data());
    10660}
     61
     62#if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL)
     63WTFLogChannel* logChannelByName(const String& name)
     64{
     65    return WTFLogChannelByName(logChannels, logChannelCount, name.utf8().data());
     66}
     67#endif
     68
     69#if !PLATFORM(MAC) && !PLATFORM(GTK) && !PLATFORM(QT) && !PLATFORM(EFL)
     70String logLevelString()
     71{
     72    // FIXME: Each platform will need to define their own logLevelString();
     73    return emptyString();
     74}
     75#endif
    10776
    10877} // namespace WebKit
  • trunk/Source/WebKit2/Platform/Logging.h

    r134600 r153736  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2010, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333
    3434#ifndef LOG_CHANNEL_PREFIX
    35 #define LOG_CHANNEL_PREFIX Log
     35#define LOG_CHANNEL_PREFIX WebKit2Log
    3636#endif
    3737
    3838namespace WebKit {
    3939
    40 extern WTFLogChannel LogContextMenu;
    41 extern WTFLogChannel LogIconDatabase;
    42 extern WTFLogChannel LogInspectorServer;
    43 extern WTFLogChannel LogKeyHandling;
    44 extern WTFLogChannel LogPlugins;
    45 extern WTFLogChannel LogSessionState;
    46 extern WTFLogChannel LogTextInput;
    47 extern WTFLogChannel LogView;
    48 extern WTFLogChannel LogNetwork;
    49 extern WTFLogChannel LogNetworkScheduling;
     40#define WEBKIT2_LOG_CHANNELS(M) \
     41    M(ContextMenu) \
     42    M(IconDatabase) \
     43    M(InspectorServer) \
     44    M(KeyHandling) \
     45    M(Network) \
     46    M(NetworkScheduling) \
     47    M(Plugins) \
     48    M(SessionState) \
     49    M(TextInput) \
     50    M(View) \
    5051
    51 void initializeLogChannel(WTFLogChannel*);
     52#define DECLARE_LOG_CHANNEL(name) \
     53    extern WTFLogChannel JOIN_LOG_CHANNEL_WITH_PREFIX(LOG_CHANNEL_PREFIX, name);
     54
     55WEBKIT2_LOG_CHANNELS(DECLARE_LOG_CHANNEL)
     56
     57#undef DECLARE_LOG_CHANNEL
     58
    5259void initializeLogChannelsIfNecessary(void);
     60String logLevelString();
     61
    5362#if PLATFORM(GTK) || PLATFORM(QT) || PLATFORM(EFL)
    54 WTFLogChannel* getChannelFromName(const String& channelName);
     63WTFLogChannel* logChannelByName(const String&);
    5564#endif
    5665
  • trunk/Source/WebKit2/Platform/efl/LoggingEfl.cpp

    r128537 r153736  
    11/*
    22 * Copyright (C) 2012 Samsung Electronics. All rights reserved.
     3 * Copyright (C) 2013 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3132namespace WebKit {
    3233
    33 void initializeLogChannel(WTFLogChannel* channel)
     34String logLevelString()
    3435{
    35     DEFINE_STATIC_LOCAL(Vector<WTFLogChannel*>, activatedChannels, ());
    36 
    37     // Fill activatedChannels vector only once based on names set in logValue.
    38     if (activatedChannels.isEmpty()) {
    39         const String logValue = getenv("WEBKIT_DEBUG");
    40         if (logValue.isEmpty())
    41             return;
    42 
    43         Vector<String> activatedNames;
    44         logValue.split(',', activatedNames);
    45         for (size_t i = 0; i < activatedNames.size(); i++) {
    46             WTFLogChannel* activeChannel = getChannelFromName(activatedNames[i]);
    47             if (activeChannel)
    48                 activatedChannels.append(activeChannel);
    49         }
    50     }
    51 
    52     if (activatedChannels.contains(channel))
    53         channel->state = WTFLogChannelOn;
     36    return getenv("WEBKIT_DEBUG");
    5437}
    5538
  • trunk/Source/WebKit2/Platform/gtk/LoggingGtk.cpp

    r95901 r153736  
    11/*
    22 * Copyright (C) 2011 Samsung Electronics
     3 * Copyright (C) 2013 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3334#if !LOG_DISABLED
    3435
    35 void initializeLogChannel(WTFLogChannel* channel)
     36String logLevelString()
    3637{
    37     static Vector<WTFLogChannel*> activatedChannels;
    38     const static String logValue(g_getenv("WEBKIT_DEBUG"));
    39 
    40     if (logValue.isEmpty())
    41         return;
    42 
    43     // Fill activatedChannels vector only once based on names set in logValue.
    44     if (activatedChannels.isEmpty()) {
    45         static Vector<String> activatedNames;
    46         logValue.split(" ", activatedNames);
    47         for (unsigned int i = 0; i < activatedNames.size(); i++) {
    48             WTFLogChannel* activeChannel = getChannelFromName(activatedNames[i]);
    49             if (activeChannel)
    50                 activatedChannels.append(activeChannel);
    51         }
    52     }
    53 
    54     if (activatedChannels.contains(channel))
    55         channel->state = WTFLogChannelOn;
     38    return g_getenv("WEBKIT_DEBUG");
    5639}
    5740
  • trunk/Source/WebKit2/Platform/mac/Logging.mac.mm

    r148509 r153736  
    11/*
    2  * Copyright (C) 2011 Apple Inc. All rights reserved.
     2 * Copyright (C) 2011, 2013 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3131#if !LOG_DISABLED
    3232
    33 void initializeLogChannel(WTFLogChannel* channel)
     33static NSString * const defaultsDomain = @"WebKit2Logging";
     34
     35String logLevelString()
    3436{
    35     // If there is no log level string from the user defaults then don't change the logging channel at all.
    36     NSString *logLevelString = [[NSUserDefaults standardUserDefaults] objectForKey:[NSString stringWithUTF8String:channel->defaultName]];
    37     if (!logLevelString)
    38         return;
    39 
    40     channel->state = WTFLogChannelOff;
    41 
    42     unsigned logLevel;
    43     if (![[NSScanner scannerWithString:logLevelString] scanHexInt:&logLevel])
    44         NSLog(@"unable to parse hex value for %s (%@), logging is off", channel->defaultName, logLevelString);
    45     if ((logLevel & channel->mask) == channel->mask)
    46         channel->state = WTFLogChannelOn;
     37    return [[NSUserDefaults standardUserDefaults] stringForKey:defaultsDomain];
    4738}
    4839
  • trunk/Source/WebKit2/Platform/qt/LoggingQt.cpp

    r119517 r153736  
    22 * Copyright (C) 2011 Samsung Electronics
    33 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
     4 * Copyright (C) 2013 Apple Inc. All rights reserved.
    45 *
    56 * Redistribution and use in source and binary forms, with or without
     
    2930
    3031#include <QDebug>
    31 #include <QStringList>
    3232
    3333namespace WebKit {
     
    3535#if !LOG_DISABLED
    3636
    37 void initializeLogChannel(WTFLogChannel* channel)
     37String logLevelString()
    3838{
    39     static Vector<WTFLogChannel*> activatedChannels;
    40 
    41     QByteArray loggingEnv = qgetenv("QT_WEBKIT_LOG");
    42     if (loggingEnv.isEmpty())
    43         return;
    44 
    45     // Fill activatedChannels vector only once based on names set in logValue.
    46     if (activatedChannels.isEmpty()) {
    47         QStringList channels = QString::fromLocal8Bit(loggingEnv).split(QLatin1String(","));
    48         for (int i = 0; i < channels.count(); i++) {
    49             if (WTFLogChannel* activeChannel = getChannelFromName(channels.at(i)))
    50                 activatedChannels.append(activeChannel);
    51         }
    52     }
    53 
    54     if (activatedChannels.contains(channel))
    55         channel->state = WTFLogChannelOn;
     39    return QString::fromLocal8Bit(qgetenv("QT_WEBKIT_LOG"));
    5640}
    5741
  • trunk/Source/WebKit2/Shared/WebKit2Initialize.cpp

    r138881 r153736  
    2828
    2929#include "Logging.h"
    30 #include <WebCore/InitializeLogging.h>
     30#include <WebCore/Logging.h>
    3131#include <WebCore/RunLoop.h>
    3232#include <runtime/InitializeThreading.h>
  • trunk/Source/WebKit2/UIProcess/WebContext.cpp

    r153616 r153736  
    5757#include "WebProcessProxy.h"
    5858#include "WebResourceCacheManagerProxy.h"
    59 #include <WebCore/InitializeLogging.h>
    6059#include <WebCore/Language.h>
    6160#include <WebCore/LinkHash.h>
     61#include <WebCore/Logging.h>
    6262#include <WebCore/ResourceRequest.h>
    6363#include <WebCore/RunLoop.h>
Note: See TracChangeset for help on using the changeset viewer.