mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
refactor: netLog directly uses network service (#18289)
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user