How to use @wdio/logger - 3 common examples

To help you get started, we’ve selected a few @wdio/logger 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 oxygenhq / oxygen / ox_modules / module-web.js View on Github external
deasync.loopWhile(() => !isInitialized && !initError);

        if (initError) {
            throw _this.errHelper.getSeleniumInitError(initError);
        }

        _this.driver.setTimeout({ 'implicit': _this.waitForTimeout });

        // initialize DevTools service. this is used to collect network requests
        var devTools = new DevToolsService();
        devTools.beforeSession(null, _this.driver.capabilities);
        if (devTools.isSupported) {
            // prevent devtools-service from generating logs
            // this should be done in a different, more proper, way, but for now just init the logger used by devtools-service:CommandHandler
            // so it cannot be inited by the service itself.
            WDIOLogger('@wdio/devtools-service:CommandHandler');
            global.browser = _this.driver;
            devTools.before();
            _this.driver.on('Network.responseReceived', (params) => {
                if (_this.networkCollect) {
                    _this.networkRequests.push(params.response);
                }
            });
        }

        // reset browser logs if auto collect logs option is enabled
        if (opts.collectBrowserLogs && _this.caps.browserName === 'chrome') {
            try {
                // simply call this to clear the previous logs and start the test with the clean logs
                module.getBrowserLogs();
            } catch (e) {
                console.error('Cannot retrieve browser logs.', e);
github projectxyzio / web2driver / src / session.js View on Github external
import { sum, includes } from 'lodash';
import logger from '@wdio/logger';
import UIElement, { ELEMENT_CMDS, getElementFromResponse } from './element';
import { keys, toPairs } from 'lodash';
import WebDriverProtocol from '@wdio/protocols/protocols/webdriver.json';
import JsonWProtocol from '@wdio/protocols/protocols/jsonwp.json';
import MJsonWProtocol from '@wdio/protocols/protocols/mjsonwp.json';
import AppiumProtocol from '@wdio/protocols/protocols/appium.json';

const log = logger('web2driver');

const DIRECT_CONNECT_PREFIX = 'directConnect';
let DIRECT_CONNECT_CAPS = ['Protocol', 'Host', 'Port', 'Path'];
DIRECT_CONNECT_CAPS = DIRECT_CONNECT_CAPS.map(c => `${DIRECT_CONNECT_PREFIX}${c}`);
const PREFIXED_DIRECT_CAPS = DIRECT_CONNECT_CAPS.map(c => `appium:${c}`);

export default class Session {

  constructor (wdSessionClient) {
    this.client = wdSessionClient;
    this.updateConnectionDetails();
  }

  updateConnectionDetails () {
    // if the remote end has given us a direct url to use different than the
    // one we used to instantiate the session, make sure we use that instead
github webdriverio / gulp-webdriver / gulpfile.babel.js View on Github external
import logger from '@wdio/logger'
const log = logger('gulp-webdriver')
const colors = require('ansi-colors')
const { series } = require('gulp')

const options = {
    src: 'src',
    dist: 'lib',
    test: 'test',
    errorHandler: (title) => {
        return (err) => {
            if (err) {
                log.error(`${colors.red([title]) + err.toString()}`)
            } else {
                log.info(`${colors.redBright([title])}`)
            }
        }
    }

@wdio/logger

A helper utility for logging of WebdriverIO packages

MIT
Latest version published 1 month ago

Package Health Score

100 / 100
Full package analysis

Popular @wdio/logger functions