Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import { DEFAULT_WS_PATHNAME_PREFIX } from 'appium-base-driver';
import { iosCommands } from 'appium-ios-driver';
import { IOSCrashLog } from '../device-log/ios-crash-log';
import { IOSSimulatorLog } from '../device-log/ios-simulator-log';
import { IOSDeviceLog } from '../device-log/ios-device-log';
import log from '../logger';
import WebSocket from 'ws';
import SafariConsoleLog from '../device-log/safari-console-log';
import SafariNetworkLog from '../device-log/safari-network-log';
let extensions = {};
const WEBSOCKET_ENDPOINT = (sessionId) => `${DEFAULT_WS_PATHNAME_PREFIX}/session/${sessionId}/appium/device/syslog`;
Object.assign(extensions, iosCommands.logging);
extensions.supportedLogTypes.safariConsole = {
description: 'Safari Console Logs - data written to the JS console in Safari',
getter: async (self) => await self.extractLogs('safariConsole', self.logs),
};
extensions.supportedLogTypes.safariNetwork = {
description: 'Safari Network Logs - information about network operations undertaken by Safari',
getter: async (self) => await self.extractLogs('safariNetwork', self.logs),
};
extensions.startLogCapture = async function startLogCapture () {
this.logs = this.logs || {};
if (!_.isUndefined(this.logs.syslog) && this.logs.syslog.isCapturing) {
log.warn('Trying to start iOS log capture but it has already started!');
return true;