| OLD | NEW |
| 1 # Debugging with ScopedLogger | 1 # Debugging with ScopedLogger |
| 2 | 2 |
| 3 ## Overview | 3 ## Overview |
| 4 | 4 |
| 5 ScopedLogger is a logger that shows nested calls by indenting. | 5 ScopedLogger is a logger that shows nested calls by indenting. |
| 6 | 6 |
| 7 For example, if you were debugging a layout issue you could add a ScopedLogger | 7 For example, if you were debugging a layout issue you could add a ScopedLogger |
| 8 to the top of the `LayoutBlock::layout` function: | 8 to the top of the `LayoutBlock::layout` function: |
| 9 | 9 |
| 10 ```c++ | 10 ```c++ |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 ## Requirements | 82 ## Requirements |
| 83 | 83 |
| 84 The ScopedLogger class and associated macros are defined in | 84 The ScopedLogger class and associated macros are defined in |
| 85 [Assertions.h](Assertions.h), which most Blink source files already include | 85 [Assertions.h](Assertions.h), which most Blink source files already include |
| 86 indirectly. ScopedLogger can't be used outside of Blink code yet. | 86 indirectly. ScopedLogger can't be used outside of Blink code yet. |
| 87 | 87 |
| 88 The ScopedLogger macros work in debug builds by default. They are compiled out | 88 The ScopedLogger macros work in debug builds by default. They are compiled out |
| 89 of release builds, unless your `GYP_DEFINES` or GN args file includes one of the | 89 of release builds, unless your `GYP_DEFINES` or GN args file includes one of the |
| 90 following: | 90 following: |
| 91 | 91 |
| 92 * `dcheck_always_on`: enables assertions and logging | 92 * `dcheck_always_on`: enables assertions and ScopedLogger |
| 93 * `blink_logging_always_on`: enables logging, but not assertions | 93 * `blink_logging_always_on`: enables ScopedLogger, but not assertions |
| 94 | |
| 95 (These are the same rules that govern `WTF_LOG` and other WTF logging macros.) | |
| 96 | 94 |
| 97 The macro names are cumbersome to type, but most editors can be configured to | 95 The macro names are cumbersome to type, but most editors can be configured to |
| 98 make this easier. For example, you can add the following to a Sublime Text key | 96 make this easier. For example, you can add the following to a Sublime Text key |
| 99 binding file to make Ctrl+Alt+L insert a ScopedLogger: | 97 binding file to make Ctrl+Alt+L insert a ScopedLogger: |
| 100 | 98 |
| 101 ``` | 99 ``` |
| 102 { "keys": ["ctrl+alt+l"], "command": "insert", | 100 { "keys": ["ctrl+alt+l"], "command": "insert", |
| 103 "args": {"characters": "WTF_CREATE_SCOPED_LOGGER(logger, \"msg\");"} | 101 "args": {"characters": "WTF_CREATE_SCOPED_LOGGER(logger, \"msg\");"} |
| 104 } | 102 } |
| 105 ``` | 103 ``` |
| OLD | NEW |