netLog
Logging network events for a session.
Prozess: Haupt
const { app, netLog } = require('electron')
app.whenReady().then(async () => {
await netLog.startLogging('/path/to/net-log')
// After some network events
const path = await netLog.stopLogging()
console.log('Net-logs written to', path)
})
See --log-net-log
to log network events throughout the app's lifecycle.
Note: All methods unless specified can only be used after the ready
event of the app
module gets emitted.
Methoden
netLog.startLogging(path[, options])
path
string - Dateipfad zu den Netzwerk Logfiles.
Returns Promise<void>
- resolves when the net log has begun recording.
Beginnt die Aufzeichnung von Netzwerk Events in path
.
netLog.stopLogging()
Returns Promise<void>
- resolves when the net log has been flushed to disk.
Beendet die Aufzeichnung der Netzwerk Events. Wenn nicht aufgerufen, dann beendet net die Aufzeichnung automatisch wenn die App beendet wird.
Eigenschaften
netLog.currentlyLogging
Readonly
A boolean
property that indicates whether network logs are currently being recorded.