File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ 2021-04-05 Tyler Wilcock <twilco.o@protonmail.com>
2+
3+ Document how to use logging in WebKit
4+ https://bugs.webkit.org/show_bug.cgi?id=224152
5+
6+ Reviewed by Simon Fraser.
7+
8+ Add documentation about how to use logging in WebKit.
9+
10+ * Introduction.md:
11+
1122021-03-28 David Kilzer <ddkilzer@apple.com>
213
314 Compile WebKit with UBSan
Original file line number Diff line number Diff line change @@ -1344,5 +1344,49 @@ FIXME: Talk about how to debug API tests.
13441344
13451345# Logging in WebKit
13461346
1347- FIXME: Write this.
1347+ Some places in WebKit use a macro called ` LOG_WITH_STREAM ` . Here's an example invocation:
1348+
1349+ ```
1350+ LOG_WITH_STREAM(Scrolling, stream << "ScrollingTree::commitTreeState - removing unvisited node " << nodeID);
1351+ ```
1352+
1353+ The first argument is the _ log channel_ and the second is the _ log content_ . By default, this logging is enabled in
1354+ debug builds and disabled in release builds (see definition of ` LOG_DISABLED ` ).
1355+
1356+ The only logs that will be printed are those whose channels you have enabled. You can specify the channels you want to
1357+ enable by constructing a comma-separated list with the following syntax:
1358+
1359+ * ` ChannelName ` to enable logging for this channel
1360+ * ` all ` to enable logging for all channels
1361+ * ` -ChannelName ` to disable logging for this channel
1362+
1363+ Where you specify this list depends on the platform you are running WebKit on.
1364+
1365+ ### Linux
1366+
1367+ Set the ` WEBKIT_DEBUG ` environment variable.
1368+
1369+ ```
1370+ WEBKIT_DEBUG=Scrolling Tools/Scripts/run-minibrowser --gtk --debug
1371+ ```
1372+
1373+ ### Mac
1374+
1375+ Set a value for the ` WebCoreLogging ` key in [ standardUserDefaults] ( https://developer.apple.com/documentation/foundation/nsuserdefaults/1416603-standarduserdefaults ) .
1376+
1377+ You may also pass this key and value as an argument:
1378+
1379+ ```
1380+ Tools/Scripts/run-minibrowser --debug -WebCoreLogging Scrolling
1381+ ```
1382+
1383+ or set the key and value on the [ NSGlobalDomain] ( https://developer.apple.com/documentation/foundation/nsglobaldomain ) .
1384+
1385+ ```
1386+ defaults write NSGlobalDomain WebCoreLogging -string Scrolling
1387+ Tools/Scripts/run-minibrowser --debug
1388+ ```
1389+
1390+ ### Windows
13481391
1392+ Set the ` WebCoreLogging ` environment variable.
You can’t perform that action at this time.
0 commit comments