How to use the appium-support.logger.getLogger function in appium-support

To help you get started, we’ve selected a few appium-support examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github appium / appium-xcuitest-driver / lib / device-connections-factory.js View on Github external
}

    // TODO: Wait until the connection is actually closed
    // after the corresponding fixes are done in appium-ios-device
    // module. Without the fixes the close event might be delayed for up to
    // 30 seconds (see https://github.com/appium/appium-xcuitest-driver/pull/1094#issuecomment-546578765)
    this.serverSocket.once('close', () => {
      this.log.info('The connection has been closed');
      this.serverSocket = null;
    });
    this.serverSocket.close();
  }
}


const log = logger.getLogger('DevCon Factory');
const SPLITTER = ':';

class DeviceConnectionsFactory {
  constructor () {
    this._connectionsMapping = {};
  }

  _udidAsToken (udid) {
    return `${util.hasValue(udid) ? udid : ''}${SPLITTER}`;
  }

  _portAsToken (port) {
    return `${SPLITTER}${util.hasValue(port) ? port : ''}`;
  }

  _toKey (udid = null, port = null) {
github appium / appium-remote-debugger / test / helpers / webkit-remote-debugger-server.js View on Github external
// transpile:main

import http from 'http';
import B from 'bluebird';
import ws from 'ws';
import { logger } from 'appium-support';

const log = logger.getLogger('RemoteDebugger');
let WebSocketServer = ws.Server;


// fake server for allowing both http requests and
// websocket requests, as needed to test Appium's
// version of webkit remote debugging support
class WebKitRemoteDebuggerServer {
  constructor () {
    this.server = null;
    this.websocketServer = null;
    this.nextResponse = null;
  }

  // start the server
  // if a websocket server is needed, pass in `true`
  async start (ws = false) {
github appium / appium-ios-driver / lib / cookies.js View on Github external
/*
 * derived from jQuery Cookie Plugin v1.4.1
 * https://github.com/carhartl/jquery-cookie
 */

// needed to communicate/translate between JSONWire cookies and regular JavaScript cookies

import _ from 'lodash';
import { logger } from 'appium-support';


const log = logger.getLogger('Cookie');

// parses the value if needed and converts the value if a converter is provided
// internal function, not exported
function convertCookie (value, converter) {
  if (value.indexOf('"') === 0) {
    // this is a quoted cookied according to RFC2068
    // remove enclosing quotes and internal quotes and backslashes
    value = value.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
  }

  let parsedValue;
  try {
    parsedValue = decodeURIComponent(value.replace(/\+/g, ' '));
  } catch (e) {
    // no need to fail if we can't decode
    log.warn(e);
github appium / appium-android-driver / lib / commands / streamscreen.js View on Github external
screenRecordCmd += ` --bit-rate=${adjustedBitrate}`;
  }
  const adbArgs = [
    ...adb.executable.defaultArgs,
    'exec-out',
    // The loop is required, because by default the maximum record duration
    // for screenrecord is always limited
    `while true; do ${screenRecordCmd} -; done`,
  ];
  const deviceStreaming = spawn(adb.executable.path, adbArgs);
  deviceStreaming.on('exit', (code, signal) => {
    log.debug(`Device streaming process exited with code ${code}, signal ${signal}`);
  });

  let isStarted = false;
  const deviceStreamingLogger = logger.getLogger(`${SCREENRECORD_BINARY}@${this.opts.udid}`);
  const errorsListener = (chunk) => {
    const stderr = chunk.toString();
    if (_.trim(stderr)) {
      deviceStreamingLogger.debug(stderr);
    }
  };
  deviceStreaming.stderr.on('data', errorsListener);

  const startupListener = (chunk) => {
    if (!isStarted) {
      isStarted = !_.isEmpty(chunk);
    }
  };
  deviceStreaming.stdout.on('data', startupListener);

  try {
github NetrisTV / ws-scrcpy / src / server / ServerDeviceConnection.ts View on Github external
public static async getInstance(): Promise {
        if (!this.instance) {
            this.instance = new ServerDeviceConnection(logger.getLogger('ServerDeviceConnection'));
        }
        return this.instance;
    }
    constructor(private readonly log: logger) {
github appium / appium-uiautomator2-driver / lib / uiautomator2.js View on Github external
import log from './logger';
import { SERVER_APK_PATH as apkPath, TEST_APK_PATH as testApkPath, version as serverVersion } from 'appium-uiautomator2-server';
import { util, logger, tempDir, fs, timing } from 'appium-support';
import B from 'bluebird';
import helpers from './helpers';
import request from 'request-promise';
import path from 'path';

const REQD_PARAMS = ['adb', 'tmpDir', 'host', 'systemPort', 'devicePort', 'disableWindowAnimation'];
const SERVER_LAUNCH_TIMEOUT = 30000;
const SERVER_INSTALL_RETRIES = 20;
const SERVICES_LAUNCH_TIMEOUT = 30000;
const SERVER_PACKAGE_ID = 'io.appium.uiautomator2.server';
const SERVER_TEST_PACKAGE_ID = `${SERVER_PACKAGE_ID}.test`;
const INSTRUMENTATION_TARGET = `${SERVER_TEST_PACKAGE_ID}/androidx.test.runner.AndroidJUnitRunner`;
const instrumentationLogger = logger.getLogger('Instrumentation');

class UiAutomator2Server {
  constructor (opts = {}) {
    for (let req of REQD_PARAMS) {
      if (!opts || !util.hasValue(opts[req])) {
        throw new Error(`Option '${req}' is required!`);
      }
      this[req] = opts[req];
    }
    this.jwproxy = new JWProxy({
      server: this.host,
      port: this.systemPort,
      keepAlive: true,
    });
    this.proxyReqRes = this.jwproxy.proxyReqRes.bind(this.jwproxy);
  }
github appium / appium-adb / lib / logger.js View on Github external
import { logger } from 'appium-support';

const log = logger.getLogger('ADB');

export default log;
github appium-boneyard / appium-instruments / lib / logger.js View on Github external
import { logger } from 'appium-support';


const log = logger.getLogger('Instruments');

export default log;
github appium / appium-ios-driver / lib / logger.js View on Github external
import { logger } from 'appium-support';

let log = logger.getLogger('iOS');

export default log;