Console reporter.

@api public
482447
function(results, options) {
        console.log('')
        console.log('Passes: ' + results.stats.passes + ' Failures: ' + results.stats.failures)
        each(results.allSuites, function(suite) {
          if (suite.ran) {
            console.group(suite.description)
            each(suite.specs, function(spec){
              var assertionCount = spec.assertions.length + ':'
              if (spec.requiresImplementation())
                console.warn(spec.description)
              else if (spec.passed())
                console.log(assertionCount + ' ' + spec.description)
              else 
                console.error(assertionCount + ' ' + spec.description + ', ' + spec.failure().message)
            })
            console.groupEnd()
          }
        })
      }
857207
def enable_console_debug_logging():  # pragma no cover (Function useful only outside test environment)
    

    logger = logging.getLogger("github")
    logger.setLevel(logging.DEBUG)
    logger.addHandler(logging.StreamHandler())
547763
def do_console(self) -> None:
        """"""
        if not self._console_enabled:
            self._sout.write('Python console disabled for this sessiong\n')
            self._sout.flush()
            return

        h, p = self._host, self._console_port
        log.info('Starting console at %s:%d', h, p)
        fut = init_console_server(
            self._host, self._console_port, self._locals, self._loop)
        server = fut.result(timeout=3)
        try:
            console_proxy(
                self._sin, self._sout, self._host, self._console_port)
        finally:
            coro = close_server(server)
            close_fut = asyncio.run_coroutine_threadsafe(coro, loop=self._loop)
            close_fut.result(timeout=15)
1083382
public function consoleAction()
	{
	    $request   = $this->getRequest();
	    $service   = $this->fetchService();
	    $operation = $this->fetchOperation();
	    $query     = $this->fetchConsoleQuery();
	    
	    if (!$request instanceof ConsoleRequest) {
	        throw new \RuntimeException('You can only use this action from a console!');
	    }
	    
	    // Check flags
	    $verbose = $request->getParam('verbose') || $request->getParam('v');
	    $silent = $request->getParam('silent') || $request->getParam('s');
	    
	    $params = Json::decode(
            $query,
            Json::TYPE_ARRAY
        );
	    
	    try {
	        $data = $this->exec($service, $operation, $params, Command::CONTEXT_CLI);
	        return $this->prepareConsoleResponse($data, null, $verbose, $silent);
	    } catch (\Exception $exception) {
	        error_log($exception->getMessage() . ' (' . $exception->getFile().':'.$exception->getLine().')');
	        
	        return $this->prepareConsoleResponse(null, $exception, $verbose, $silent);
	    }
	}
602753
def start_console(local_vars={}):
    ''''''
    transforms.CONSOLE_ACTIVE = True
    transforms.remove_not_allowed_in_console()
    sys.ps1 = prompt
    console = ExperimentalInteractiveConsole(locals=local_vars)
    console.interact(banner=banner)
1071437
function reporter(error, file) {

    // _JS Hint_ can sometimes call the reporter function with no error. This is
    // simply ignored.

    if (!error) {
        return;
    }

    if (!(error.code in errors)) {
        errors[error.code] = { reason: error.raw, count: 0 };
    }

    errors[error.code].count++;
    totalErrors++;

    console.log(getChalk(error.code)('%s: line %d, col %d, %s'),
        file, error.line, error.character, error.reason);

    if (error.evidence !== undefined) {
        var evidence = error.evidence.trim();
        console.log(chalk.grey('    %s'), evidence);
    }
}
969182
function() {
      if (dest) {
        // Restore console.log to original and write the output
        console.log = consoleLog;

        if (!grunt.file.exists(dest)) {
            // Write only if our reporter ignored our `output` option
            grunt.file.write(dest, output.join('\n'));
        }
      }
      var stats = helpers.reduceStats(testStats);

      if (stats.failures === 0) {
        var okMsg = stats.tests + ' passed!' + ' (' + stats.duration + 's)';

        if (options.growlOnSuccess) {
          growl(okMsg, {
            image: asset('growl/ok.png'),
            title: okMsg,
            priority: 3
          });
        }

        grunt.log.ok(okMsg);

        // Async test pass
        done(true);

      } else {
        var failMsg = stats.failures + '/' + stats.tests + ' tests failed (' +
          stats.duration + 's)';

        // Show Growl notice, if avail
        growl(failMsg, {
          image: asset('growl/error.png'),
          title: failMsg,
          priority: 3
        });

        // Bail tests if bail option is true
        if (options.bail) {
          grunt.warn(failMsg);
        } else {
          grunt.log.error(failMsg);
        }

        // Async test fail
        done(false);
      }
    }
1288202
def console_main():
    
    setproctitle('image-scraper')
    scraper = ImageScraper()
    scraper.get_arguments()
    print("\nImageScraper\n============\nRequesting page....\n")
    try:
        scraper.get_html()
    except PageLoadError as err:
        if err.status_code is None:
            print("ImageScraper is unable to acces the internet.")
        else:
            print("Page failed to load. Status code: {0}".format(err.status_code))
        sys.exit()

    scraper.get_img_list()

    if len(scraper.images) == 0:
        sys.exit("Sorry, no images found.")
    if scraper.no_to_download is None:
        scraper.no_to_download = len(scraper.images)

    print("Found {0} images: ".format(len(scraper.images)))

    try:
        scraper.process_download_path()
    except DirectoryAccessError:
        print("Sorry, the directory can't be accessed.")
        sys.exit()
    except DirectoryCreateError:
        print("Sorry, the directory can't be created.")
        sys.exit()

    if scraper.dump_urls:
        for img_url in scraper.images:
            print(img_url)

    status_flags = {'count': 0, 'percent': 0.0, 'failed': 0, 'under_min_or_over_max_filesize': 0}
    widgets = ['Progress: ', Percentage(), ' ', Bar(marker=RotatingMarker()),
               ' ', ETA(), ' ', FileTransferSpeed()]
    pbar = ProgressBar(widgets=widgets, maxval=100).start()
    pool = ThreadPoolExecutor(max_workers=scraper.nthreads)
    status_lock = threading.Lock()
    for img_url in scraper.images:
        if status_flags['count'] == scraper.no_to_download:
            break
        pool.submit(download_worker_fn, scraper, img_url, pbar, status_flags, status_lock)
        status_flags['count'] += 1
    pool.shutdown(wait=True)
    pbar.finish()
    print("\nDone!\nDownloaded {0} images\nFailed: {1}\n".format(
        status_flags['count']-status_flags['failed']-status_flags['under_min_or_over_max_filesize'],
        status_flags['failed']))
    return
816083
public function afterRun()
    {
        if (count($this->failures)) {
            $this->console->writeLn("\nFailures:");
        }

        foreach ($this->failures as $spec) {
            $failedText = $this->formatter->red("\n\"$spec\" FAILED");
            $this->console->writeLn($failedText);
            $this->console->writeLn($spec->getException());
        }

        if ($this->startTime) {
            $endTime = microtime(true);
            $runningTime = round($endTime - $this->startTime, 5);
            $this->console->writeLn("\nFinished in $runningTime seconds");
        }

        $failedCount = count($this->failures);
        $incompleteCount = count($this->incompleteSpecs);
        $pendingCount = count($this->pendingSpecs);
        $specs = ($this->specCount == 1) ? 'spec' : 'specs';
        $failures = ($failedCount == 1) ? 'failure' : 'failures';
        $incomplete = ($incompleteCount) ? ", $incompleteCount incomplete" : '';
        $pending = ($pendingCount) ? ", $pendingCount pending" : '';

        // Print ASCII art if enabled
        if ($this->console->options['ascii']) {
            $this->console->writeLn('');
            $this->drawAscii();
        }

        $summaryText = "\n{$this->specCount} $specs, $failedCount $failures" .
                       $incomplete . $pending;

        // Generate the summary based on whether or not it passed
        if ($failedCount) {
            $summary = $this->formatter->red($summaryText);
        } else {
            $summary = $this->formatter->green($summaryText);
        }

        $summary = $this->formatter->bold($summary);
        $this->console->writeLn($summary);
    }
1354740
function ConsoleLogger() {

    this.error = function () {
        if (loggingLevel(ERROR)) {
            console.error.apply(this, arguments);
        }
    };

    this.warn = function () {
        if (loggingLevel(WARN)) {
            console.warn.apply(this, arguments);
        }
    };

    this.info = function () {
        if (loggingLevel(INFO)) {
            console.info.apply(this, arguments);
        }
    };

    this.log = function () {
        if (loggingLevel(INFO)) {
            console.log.apply(this, arguments);
        }
    };

    this.debug = function () {
        if (loggingLevel(DEBUG)) {
            console.log.apply(this, arguments);
        }
    };

    this.setLevelToInfo = function () {
        setLevel(INFO);
    };

    this.setLevelToDebug = function() {
        setLevel(DEBUG);
    };

    this.setLevelToWarning = function() {
        setLevel(WARN);
    };

    this.setLevelToError = function() {
        setLevel(ERROR);
    };
}
18577
function rlog()
    {
      process.stdout.clearLine();
      process.stdout.cursorTo(0);
      console.log.apply(console, arguments);
      rl.prompt();
    }
407721
function() {
        this._timeout = null;

        if(this._elConsole !== null) {
            var thresholdMax = this.thresholdMax;
            thresholdMax = (thresholdMax && !isNaN(thresholdMax)) ? thresholdMax : 500;
            if(this._consoleMsgCount < thresholdMax) {
                var entries = [];
                for (var i=0; i<this._buffer.length; i++) {
                    entries[i] = this._buffer[i];
                }
                this._buffer = [];
                this._printToConsole(entries);
            }
            else {
                this._filterLogs();
            }
            
            if(!this.newestOnTop) {
                this._elConsole.scrollTop = this._elConsole.scrollHeight;
            }
        }
    }
1036322
function report(type, state, params)
{
  var reporter = defaultReporter;

  // get rest of arguments
  params  = Array.prototype.slice.call(arguments, 1);

  // `init` and `done` types don't have command associated with them
  if (['init', 'done'].indexOf(type) == -1)
  {
    // second (1) position is for command
    // if command present get string representation of it
    params[1] = stringifyCommand(state, params[1]);
  }

  if (state && state.options && state.options.reporter)
  {
    reporter = state.options.reporter;
  }

  reporter[type].apply(null, params);
}
989028
function EvergreenReporter(runner) {
  mocha.reporters.Base.call(this, runner);

  var logDir = 'test_logs';
  var self = this;
  var indents = 0;
  var stats = (this.stats = {
    tests: 0,
    passes: 0,
    failures: 0,
    pending: 0
  });

  var tests = [];

  this.runner = runner;
  runner.stats = stats;

  debug('setting up handlers...');

  function indent() {
    return Array(indents).join('  ');
  }

  /*
   * Runs on the start of all of the tests
   */
  runner.on('start', function() {
    stats.start = Date.now();
    debug('starting!');
  });

  runner.on('suite', function(suite) {
    debug('suite start %s', suite.title, suite.file);
    console.log(suite.title);
    if (suite.file) {
      console.log(suite.file);
    }
    indents++;
  });

  runner.on('suite end', function(suite) {
    debug('suite end %s', suite.title, suite.file);
    console.log();
    indents--;
  });

  /**
   * Runs before every test begins
   */
  runner.on('test', function(test) {
    debug('test', test.title);
    test.start = Date.now() / 1000;
  });

  /**
   * Runs after every test ends
   */
  runner.on('test end', function(test) {
    stats.tests++;
    tests.push(test);
  });

  runner.on('pass', function(test) {
    console.log(indent() + test.title + ': Passed!');
    console.log();
    stats.passes++;
    test.exit_code = 0;
    test.state = 'pass';
    test.end = Date.now() / 1000;
  });

  runner.on('fail', function(test, err) {
    test.err = err;
    test.exit_code = 1;
    test.state = 'fail';
    test.end = Date.now() / 1000;
    console.log(indent() + test.title + ': Failed :(');
    console.log(test.err.message);
    console.log(test.err.stack);
    console.log();
    stats.failures++;
  });

  runner.on('pending', function(test) {
    console.log(indent() + test.title + ': Skip');
    console.log();
    stats.pending++;
    test.state = 'skip';
    test.duration = 0;
    test.exit_code = 0;
    test.start = Date.now() / 1000;
    test.end = test.start;
  });

  /**
   * Runs after all tests have completed
   */
  runner.on('end', function() {
    debug('end!', arguments);
    stats.end = Date.now() / 1000;
    stats.duration = stats.end - stats.start;

    var obj = {
      end: stats.end,
      start: stats.start,
      elapsed: stats.duration,
      failures: stats.failures,
      results: tests.map(report)
    };

    runner.testResults = obj;
    debug('test results', runner.testResults);

    var output = JSON.stringify(obj, null, 2);

    var reportPath = path.join(process.cwd(), 'report.json');
    fs.writeFileSync(reportPath, output);
    debug('report json written to', reportPath);

    console.log('-----------------------------------');
    console.log('# mocha-evergreen-reporter: Results');
    console.log('Passed: %s', stats.passes);
    console.log('Failed: %s', stats.failures);
    console.log('Skipped: %s', stats.pending);
    console.log('Report Path: %s', reportPath);
    console.log('-----------------------------------');

    process.exit(stats.failures);
  });
}
713997
function () {
    this.events.on('report:run:browser', this.runBrowser.bind(this));
    this.events.on('report:assertion', this.assertion.bind(this));
    this.events.on('report:action', this.action.bind(this));
    this.events.on('report:test:started', this.testStarted.bind(this));
    this.events.on('report:test:finished', this.testFinished.bind(this));
    this.events.on('report:runner:finished', this.runnerFinished.bind(this));
    this.events.on('report:log:user',this.messageLog.bind(this));
    this.events.on('report:screenshot',this.screenshot.bind(this));
    return this;
  }
304299
function(report) {
		if (edbml.debug) {
			if (gui.KeyMaster.isKey(this.id)) {
				report = report.replace(this.id, "(anonymous)");
			}
			console.debug(report);
		}
	}
7767
def update_reporting(self, global_options, is_quiet, run_tracker):
    """"""

    # Get any output silently buffered in the old console reporter, and remove it.
    removed_reporter = run_tracker.report.remove_reporter('capturing')
    buffered_out = self._consume_stringio(removed_reporter.settings.outfile)
    buffered_err = self._consume_stringio(removed_reporter.settings.errfile)

    log_level = Report.log_level_from_string(global_options.level or 'info')
    # Ideally, we'd use terminfo or somesuch to discover whether a
    # terminal truly supports color, but most that don't set TERM=dumb.
    color = global_options.colors and (os.getenv('TERM') != 'dumb')
    timing = global_options.time
    cache_stats = global_options.time  # TODO: Separate flag for this?

    if is_quiet:
      console_reporter = QuietReporter(run_tracker,
                                       QuietReporter.Settings(log_level=log_level, color=color,
                                                              timing=timing, cache_stats=cache_stats))
    else:
      # Set up the new console reporter.
      stdout = sys.stdout.buffer if PY3 else sys.stdout
      stderr = sys.stderr.buffer if PY3 else sys.stderr
      settings = PlainTextReporter.Settings(log_level=log_level, outfile=stdout, errfile=stderr,
                                            color=color, indent=True, timing=timing, cache_stats=cache_stats,
                                            label_format=self.get_options().console_label_format,
                                            tool_output_format=self.get_options().console_tool_output_format)
      console_reporter = PlainTextReporter(run_tracker, settings)
      console_reporter.emit(buffered_out, dest=ReporterDestination.OUT)
      console_reporter.emit(buffered_err, dest=ReporterDestination.ERR)
      console_reporter.flush()
    run_tracker.report.add_reporter('console', console_reporter)

    if global_options.logdir:
      # Also write plaintext logs to a file. This is completely separate from the html reports.
      safe_mkdir(global_options.logdir)
      run_id = run_tracker.run_info.get_info('id')
      outfile = open(os.path.join(global_options.logdir, '{}.log'.format(run_id)), 'wb')
      errfile = open(os.path.join(global_options.logdir, '{}.err.log'.format(run_id)), 'wb')
      settings = PlainTextReporter.Settings(log_level=log_level, outfile=outfile, errfile=errfile,
                                            color=False, indent=True, timing=True, cache_stats=True,
                                            label_format=self.get_options().console_label_format,
                                            tool_output_format=self.get_options().console_tool_output_format)
      logfile_reporter = PlainTextReporter(run_tracker, settings)
      logfile_reporter.emit(buffered_out, dest=ReporterDestination.OUT)
      logfile_reporter.emit(buffered_err, dest=ReporterDestination.ERR)
      logfile_reporter.flush()
      run_tracker.report.add_reporter('logfile', logfile_reporter)

    invalidation_report = self._get_invalidation_report()
    if invalidation_report:
      run_id = run_tracker.run_info.get_info('id')
      outfile = os.path.join(self.get_options().reports_dir, run_id, 'invalidation-report.csv')
      invalidation_report.set_filename(outfile)

    return invalidation_report