refactor: netLog directly uses network service (#18289)

This commit is contained in:
Jeremy Apthorp 2019-05-23 15:31:38 -07:00 committed by GitHub
parent d57df5a4a1
commit 646f572b77
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 220 additions and 141 deletions

View file

@ -7,8 +7,8 @@ Process: [Main](../glossary.md#main-process)
```javascript
const { netLog } = require('electron')
app.on('ready', async function () {
netLog.startLogging('/path/to/net-log')
app.on('ready', async () => {
await netLog.startLogging('/path/to/net-log')
// After some network events
const path = await netLog.stopLogging()
console.log('Net-logs written to', path)
@ -26,6 +26,8 @@ of the `app` module gets emitted.
* `path` String - File path to record network logs.
Returns `Promise<void>` - resolves when the net log has begun recording.
Starts recording network events to `path`.
### `netLog.stopLogging()`
@ -40,6 +42,6 @@ Stops recording network events. If not called, net logging will automatically en
A `Boolean` property that indicates whether network logs are recorded.
### `netLog.currentlyLoggingPath`
### `netLog.currentlyLoggingPath` **Deprecated**
A `String` property that returns the path to the current log file.