feat: promisify netLog.stopLogging (#16862)

This commit is contained in:
Milan Burda 2019-02-19 11:48:27 +01:00 committed by Alexey Kuzmin
parent 3b74837020
commit 7e7abc28f5
9 changed files with 78 additions and 35 deletions

View file

@ -7,12 +7,11 @@ Process: [Main](../glossary.md#main-process)
```javascript
const { netLog } = require('electron')
app.on('ready', function () {
app.on('ready', async function () {
netLog.startLogging('/path/to/net-log')
// After some network events
netLog.stopLogging(path => {
console.log('Net-logs written to', path)
})
const path = await netLog.stopLogging()
console.log('Net-logs written to', path)
})
```
@ -36,6 +35,14 @@ Starts recording network events to `path`.
Stops recording network events. If not called, net logging will automatically end when app quits.
**[Deprecated Soon](promisification.md)**
### `netLog.stopLogging()`
Returns `Promise<String>` - resolves with a file path to which network logs were recorded.
Stops recording network events. If not called, net logging will automatically end when app quits.
## Properties
### `netLog.currentlyLogging`