Get webdriver logs of the specified type and write them to a log file

        :param log_type: browser, client, driver, performance, server, syslog, crashlog or logcat
        :param test_name: test that has generated these logs
552539
def save_webdriver_logs_by_type(self, log_type, test_name):
        
        try:
            logs = self.driver_wrapper.driver.get_log(log_type)
        except Exception:
            return

        if len(logs) > 0:
            log_file_name = '{}_{}.txt'.format(get_valid_filename(test_name), log_type)
            log_file_name = os.path.join(DriverWrappersPool.logs_directory, log_file_name)
            with open(log_file_name, 'a+', encoding='utf-8') as log_file:
                driver_type = self.driver_wrapper.config.get('Driver', 'type')
                log_file.write(
                    u"\n{} '{}' test logs with driver = {}\n\n".format(datetime.now(), test_name, driver_type))
                for entry in logs:
                    timestamp = datetime.fromtimestamp(float(entry['timestamp']) / 1000.).strftime(
                        '%Y-%m-%d %H:%M:%S.%f')
                    log_file.write(u'{}\t{}\t{}\n'.format(timestamp, entry['level'], entry['message'].rstrip()))
1038215
def log(type, message)
      case type.to_sym
      when :info
        msg = message
      when :error
        msg = message
      end

      @messages << msg
      puts msg if verbose?
    end
165896
@Override
    @Trivial
    protected String getExecutionLogMessage(MessageType msgType) {

        LogHelper lh = new LogHelper();
        StringBuilder buf = lh.getBeginningPart(msgType);

        buf.append("invoking execution for a job");
        buf.append("\n JobInstance id = ");
        buf.append(getTopLevelNameInstanceExecutionInfo().getInstanceId());
        buf.append("\n JobExecution id = ");
        buf.append(getTopLevelNameInstanceExecutionInfo().getExecutionId());
        buf.append("\n Job Name = ");
        buf.append(getTopLevelNameInstanceExecutionInfo().getJobName());

        if (jobParameters != null) {
            buf.append("\n Job Parameters = ");
            buf.append(jobParameters);
        }

        if (!msgType.equals(MessageType.STARTED)) {
            buf.append("\n Job Batch Status = " + getBatchStatus());
            buf.append(", Job Exit Status = " + getExitStatus());
        }
        buf.append("\n" + LogHelper.dashes);
        return buf.toString();
    }
452423
@SuppressWarnings("unchecked")
  public <L, E> EventLog<L, E> getEventLog(Class<?> type, String name) {
    return eventRegistries.computeIfAbsent(type, t -> new ConcurrentHashMap<>()).get(name);
  }
447036
def dump_logs(json_data, project_mapping, tag_name):
    
    pwd_dir_path, dump_file_name = _prepare_dump_info(project_mapping, tag_name)
    dump_json_file(json_data, pwd_dir_path, dump_file_name)
1209887
def _local_browser_class(browser_name):
    

    # Log name of local browser
    LOGGER.info(u"Using local browser: %s [Default is firefox]", browser_name)

    # Get class of local browser based on name
    browser_class = BROWSERS.get(browser_name)
    headless = os.environ.get('BOKCHOY_HEADLESS', 'false').lower() == 'true'
    if browser_class is None:
        raise BrowserConfigError(
            u"Invalid browser name {name}.  Options are: {options}".format(
                name=browser_name, options=", ".join(list(BROWSERS.keys()))))
    else:
        if browser_name == 'firefox':
            # Remove geckodriver log data from previous test cases
            log_path = os.path.join(os.getcwd(), 'geckodriver.log')
            if os.path.exists(log_path):
                os.remove(log_path)

            firefox_options = FirefoxOptions()
            firefox_options.log.level = 'trace'
            if headless:
                firefox_options.headless = True
            browser_args = []
            browser_kwargs = {
                'firefox_profile': _firefox_profile(),
                'options': firefox_options,
            }

            firefox_path = os.environ.get('SELENIUM_FIREFOX_PATH')
            firefox_log = os.environ.get('SELENIUM_FIREFOX_LOG')
            if firefox_path and firefox_log:
                browser_kwargs.update({
                    'firefox_binary': FirefoxBinary(
                        firefox_path=firefox_path, log_file=firefox_log)
                })
            elif firefox_path:
                browser_kwargs.update({
                    'firefox_binary': FirefoxBinary(firefox_path=firefox_path)
                })
            elif firefox_log:
                browser_kwargs.update({
                    'firefox_binary': FirefoxBinary(log_file=firefox_log)
                })

        elif browser_name == 'chrome':
            chrome_options = ChromeOptions()
            if headless:
                chrome_options.headless = True

            # Emulate webcam and microphone for testing purposes
            chrome_options.add_argument('--use-fake-device-for-media-stream')

            # Bypasses the security prompt displayed by the browser when it attempts to
            # access a media device (e.g., a webcam)
            chrome_options.add_argument('--use-fake-ui-for-media-stream')

            browser_args = []
            browser_kwargs = {
                'options': chrome_options,
            }
        else:
            browser_args, browser_kwargs = [], {}

        return browser_class, browser_args, browser_kwargs
385263
def get_record_logger_for(test_uid):
  """"""
  htf_logger = logging.getLogger(RECORD_LOGGER_PREFIX)
  record_logger = HtfTestLogger('.'.join(((RECORD_LOGGER_PREFIX, test_uid))))
  record_logger.parent = htf_logger
  return record_logger
54688
private static LogType findLogType() {

		// see if the log-type was specified as a system property
		String logTypeString = System.getProperty(LOG_TYPE_SYSTEM_PROPERTY);
		if (logTypeString != null) {
			try {
				return LogType.valueOf(logTypeString);
			} catch (IllegalArgumentException e) {
				Log log = new LocalLog(LoggerFactory.class.getName());
				log.log(Level.WARNING, "Could not find valid log-type from system property '" + LOG_TYPE_SYSTEM_PROPERTY
						+ "', value '" + logTypeString + "'");
			}
		}

		for (LogType logType : LogType.values()) {
			if (logType.isAvailable()) {
				return logType;
			}
		}
		// fall back is always LOCAL, never reached
		return LogType.LOCAL;
	}
659107
public synchronized void fetchAndStoreLogsFromDriver(SessionId sessionId, WebDriver driver)
    throws IOException {
    if (!perSessionDriverEntries.containsKey(sessionId)) {
      perSessionDriverEntries.put(sessionId, new HashMap<>());
    }
    Map<String, LogEntries> typeToEntriesMap = perSessionDriverEntries.get(sessionId);
    if (storeLogsOnSessionQuit) {
      typeToEntriesMap.put(LogType.SERVER, getSessionLog(sessionId));
      Set<String> logTypeSet = driver.manage().logs().getAvailableLogTypes();
      for (String logType : logTypeSet) {
        typeToEntriesMap.put(logType, driver.manage().logs().get(logType));
      }
    }
  }
478793
function log (type) {
    return function(){
      var str = Array.prototype.join.call(arguments, ' ');
      debug('[websocketjs %s] %s', type, str);
    };
  }
331486
def get_log(self, request, response):
        
        return {
            'method': request.method,
            'path': request.get_full_path(),
            'code': response.status_code,
            'time': time.time(),
        }
965213
def get_logs(self, stdout=True, stderr=True, timestamps=False, tail='all',
                 since=None):
        
        return self.inner().logs(
            stdout=stdout, stderr=stderr, timestamps=timestamps, tail=tail,
            since=since)
1090915
def get_log_events(awsclient, log_group_name, log_stream_name, start_ts=None):
    
    client_logs = awsclient.get_client('logs')

    request = {
        'logGroupName': log_group_name,
        'logStreamName': log_stream_name
    }
    if start_ts:
        request['startTime'] = start_ts

    # TODO exhaust the events!
    # TODO use all_pages !
    response = client_logs.get_log_events(**request)

    if 'events' in response and response['events']:
        return [{'timestamp': e['timestamp'], 'message': e['message']}
                for e in response['events']]
924044
def log_type(args_kw, ret, func, slf=False, prop_getter=False, clss=None, argspecs=None,
            args_kw_type=None, ret_type = None):
    
    if args_kw_type is None:
        args_kw_type = deep_type(args_kw)
    if ret_type is None:
        ret_type = deep_type(ret)
    if argspecs is None:
        argspecs = getargspecs(func)
    node = _register_logged_func(func, slf, prop_getter, clss, argspecs)
    node.add_observation(args_kw_type, ret_type)
    
    md = util.getmodule_for_member(func, prop_getter)
    if not md.__name__ in _module_file_map:
        _module_file_map[md.__name__] = md.__file__

    if clss is None:
        try:
            clss = util.get_class_that_defined_method(func)
        except ValueError:
            pass
    if not clss is None and not clss in _member_line_map:
        _member_line_map[clss] = findsource(clss)[1]
768500
def build_logger(
    name=os.getenv(
        "LOG_NAME",
        "client"),
    config="logging.json",
    log_level=logging.INFO,
    log_config_path="{}/logging.json".format(
        os.getenv(
            "LOG_CFG",
            os.path.dirname(os.path.realpath(__file__))))):
    
    use_config = ("./log/{}").format(
                    "{}".format(
                        config))
    if not os.path.exists(use_config):
        use_config = log_config_path
        if not os.path.exists(use_config):
            use_config = ("./antinex_client/log/{}").format(
                            "logging.json")
    # find the log processing

    setup_logging(
        default_level=log_level,
        default_path=use_config)

    return logging.getLogger(name)
804421
private void logNodeTypes(final NodeType... nodeTypes) {

        if(LOG.isDebugEnabled()){
            StringBuilder buf = new StringBuilder(32);
            buf.append("[\n");
            for(NodeType nt : nodeTypes){
                buf.append(nt.getName()).append(" > ");
                for(NodeType st : nt.getSupertypes()){
                    buf.append(st.getName()).append(", ");
                }
                buf.append('\n');
                for(PropertyDefinition pd : nt.getPropertyDefinitions()){
                    buf.append("\t").append(pd.getName()).append(" (")
                       .append(PropertyType.nameFromValue(pd.getRequiredType()))
                       .append(")\n");
                }
            }
            buf.append(']');
            LOG.debug("Registered NodeTypes: {}",buf.toString());
        }
    }
758295
def log_report(report)
      if log #&& !dryrun?
        #logfile = File.join('log', apply_naming_policy('testlog', 'txt'))
        FileUtils.mkdir_p('log')
        logfile = File.join('log', 'testlog.txt')
        File.open(logfile, 'a') do |f|
          f << "= #{self.class} Test @ #{Time.now}\n"
          f << report
          f << "\n"
        end
      end
    end