Electron Documentation

Docs / API / netLog v3.0.5

netLog

Logging network events.

Process: Main

const {netLog} = require('electron')
  console.log('Start recording net-logs')
  netLog.startLogging('/path/to/net-log')
  // After some network events
  netLog.stopLogging(path => {
    console.log('Net-logs written to', path)
  })

See --log-net-log to log network events throughout the app's lifecycle.

netLog.startLogging(path)

  • path String - File path to record network logs.

Starts recording network events to path.

netLog.stopLogging([callback])

  • callback Function (optional)

    • path String - File path to which network logs were recorded.

Stops recording network events. If not called, net logging will automatically end when app quits.

netLog.currentlyLogging

A Boolean property that indicates whether network logs are recorded.

netLog.currentlyLoggingPath

A String property that returns the path to the current log file.