net-log.ts 720 B

12345678910111213141516171819202122
  1. // TODO(deepak1556): Deprecate and remove standalone netLog module,
  2. // it is now a property of session module.
  3. import { app, session } from 'electron/main';
  4. const startLogging: typeof session.defaultSession.netLog.startLogging = async (path, options) => {
  5. if (!app.isReady()) return;
  6. return session.defaultSession.netLog.startLogging(path, options);
  7. };
  8. const stopLogging: typeof session.defaultSession.netLog.stopLogging = async () => {
  9. if (!app.isReady()) return;
  10. return session.defaultSession.netLog.stopLogging();
  11. };
  12. export default {
  13. startLogging,
  14. stopLogging,
  15. get currentlyLogging (): boolean {
  16. if (!app.isReady()) return false;
  17. return session.defaultSession.netLog.currentlyLogging;
  18. }
  19. };