initial import
[vuplus_webkit] / Source / WebKit / win / WebKitLogging.cpp
1 /*
2  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
3  * Copyright (C) 2007 Apple Inc.  All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1.  Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer. 
11  * 2.  Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution. 
14  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
15  *     its contributors may be used to endorse or promote products derived
16  *     from this software without specific prior written permission. 
17  *
18  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 #include "config.h"
30 #include "WebKitLogging.h"
31
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 };
56
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 }
73
74 void WebKitInitializeLoggingChannelsIfNecessary()
75 {
76     static bool haveInitializedLoggingChannels = false;
77     if (haveInitializedLoggingChannels)
78         return;
79     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);
105 }
106