Skip to content

Commit a9126ba

Browse files
twilcowebkit-commit-queue
authored andcommitted
Document how to use logging in WebKit
https://bugs.webkit.org/show_bug.cgi?id=224152 Patch by Tyler Wilcock <twilco.o@protonmail.com> on 2021-04-05 Reviewed by Simon Fraser. Add documentation about how to use logging in WebKit. * Introduction.md: Canonical link: https://commits.webkit.org/236140@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275482 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 43cfbd2 commit a9126ba

2 files changed

Lines changed: 56 additions & 1 deletion

File tree

ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
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+
112
2021-03-28 David Kilzer <ddkilzer@apple.com>
213

314
Compile WebKit with UBSan

Introduction.md

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff 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.

0 commit comments

Comments
 (0)