Creates function(err,value) that prints out the result to console
970489
function asyncLog(prefix) {
    return function(err,value) {
        if (err) {
            console.warn("Error getting "+prefix+': '+err, err.stack)
        } else {
            console.log(prefix+':',value)
        }
    }
}
426449
def _fill_out_err(result, testcase):
        """"""
        if result.get("stdout"):
            system_out = etree.SubElement(testcase, "system-out")
            system_out.text = utils.get_unicode_str(result["stdout"])

        if result.get("stderr"):
            system_err = etree.SubElement(testcase, "system-err")
            system_err.text = utils.get_unicode_str(result["stderr"])
145696
function _handleResult(callback, err, res) {
    return callback(null, {
        error:  err,
        result: res
    });
}
576996
function (err, result) {

		// if login is successful, we record the user's account in cache
		if (err) {
			LOG.warn(err.toString());
			result = {code: err.code, msg: err.message};
		}
		else {
			if (result.code === 0) {
				LOG.warn('login success, result: ');
				LOG.warn(result);

				var data = {
					account: user_data.account,
					groups: result.data.groups,
					lastStatus: result.data.lastStatus,
					permissions: []
				}
				
				l_initSession(event.data.login_id, event.session, data);

				/*
				// todo: read permssion from DB
				//event.session['_permissions'] = result.data.permissions;
				var xx = [];
				var onSuccess = function(dat){
					//console.log(dat.permission);
					if (dat === null) {
						console.log("no permission");
					}
					else {
						for (var i in dat.permission) {
							//console.log("pushing: " + dat.permission[i]);
							xx.push(dat.permission[i]);
						}
					}
					//event.done("get group", {"status": "success", "data": data});
				};
				var onFail = function(dat){
					//event.done("get group", {"status": "failure", "data": data});
				};
				for (var i in event.session['_groups']) {
					//console.log("getting: " + event.session['_groups'][i]);
					SR.DB.getData(groupPermissionDB, {"group": event.session['_groups'][i], part: "group"}, onSuccess, onFail);
				}
				*/
				
				// TODO: login at once to all local accounts
				// NOTE: need to query all local login account name & password, then perform individual logins
				l_login_local_accounts(user_data.account);			
			}
		}

		//LOG.warn('event before sending login response:');
		//LOG.warn(event);
		
		//if (result.data) delete result.data;
		// return response regardless success or fail
		event.done('SR_LOGIN_RESPONSE', result);
	}
795899
function writeError () {
  if (mocking) {
    cli.stderr += stripAnsi(concatArguments(arguments))
  } else {
    process.stderr.write.apply(process.stderr, arguments)
  }
}
1242966
def _errcheck(result, func, arguments):
    

    if result != 0:
        raise XdoException(
            'Function {0} returned error code {1}'
            .format(func.__name__, result))
    return None
796799
def puts_err(s='', newline=True, stream=STDERR):
    """"""
    puts(s, newline, stream)
721970
function (callback) {
    return function (err, stdout, stderr) {
        if (err) {
            throw err;
        } else if (stderr) {
            log('sync error', 'failed with the following output:');
            console.log('\n', stderr, '\n');
        } else {
            log('sync', 'completed successfully');
            log();
            if (callback) callback();
        }
    };
}
1193618
def print_err(self, *lst):
      
      self.print2file(self.stderr, False, True, *lst)
170263
def err(*output, **kwargs):
    
    output = 'Error: ' + ' '.join([str(o) for o in output])
    if kwargs.get('wrap') is not False:
        output = '\n'.join(wrap(output, kwargs.get('indent', '')))
    elif kwargs.get('indent'):
        indent = kwargs['indent']
        output = indent + ('\n' + indent).join(output.splitlines())
    sys.stderr.write(output + '\n')
864904
function outputToStdout(prettyPrint) {
  if (prettyPrint && !_.isNumber(prettyPrint)) {
    prettyPrint = 4;
  }
  return function(err, value, callback) {
    if (err) {
      console.error(err);
    } else {
      var str = JSON.stringify(value, null, prettyPrint);
      console.log(str);
    }
    callback(err, value);
  };
}
982849
def print_error(input, err, scanner):
    """"""
    p = err.pos
    # Figure out the line number
    line = input[:p].count('\n')
    print err.msg + " on line " + repr(line + 1) + ":"
    # Now try printing part of the line
    text = input[max(p - 80, 0):
        p + 80]
    p = p - max(p - 80, 0)

    # Strip to the left
    i = text[:p].rfind('\n')
    j = text[:p].rfind('\r')
    if i < 0 or (0 <= j < i):
        i = j
    if 0 <= i < p:
        p = p - i - 1
        text = text[i + 1:]

    # Strip to the right
    i = text.find('\n', p)
    j = text.find('\r', p)
    if i < 0 or (0 <= j < i):
        i = j
    if i >= 0:
        text = text[:i]

    # Now shorten the text
    while len(text) > 70 and p > 60:
        # Cut off 10 chars
        text = "..." + text[10:]
        p = p - 7

    # Now print the string, along with an indicator
    print '> ', text
    print '> ', ' ' * p + '^'
    print 'List of nearby tokens:', scanner
645606
function error () {
  if (mocking) {
    cli.stderr += stripAnsi(concatArguments(arguments) + '\n')
  } else {
    console.error.apply(null, arguments)
  }
}
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);
    };
}
446098
function result (type, error) {
  if (count % 40 === 0) {
    log('\n  ')
  }

  count++
  stats[type]++
  log(SYMBOLS[type] + ' ')

  if (type === 'failure') {
    failures.push(error)
  }
}
520338
function(results, options) {
         failuresOnly = option('failuresOnly')
         print(color("\n Passes: ", 'bold') + color(results.stats.passes, 'green') + 
               color(" Failures: ", 'bold') + color(results.stats.failures, 'red') +
               color(" Duration: ", 'bold') + color(results.duration, 'green') + " ms \n")
              
         function indent(string) {
           return string.replace(/^(.)/gm, '  $1')
         }
         
         each(results.allSuites, function(suite) {
           var displaySuite = failuresOnly ? suite.ran && !suite.passed() : suite.ran
            if (displaySuite && suite.hasSpecs()) {
              print(color(' ' + suite.description, 'bold'))
              each(suite.specs, function(spec){
                var assertionsGraph = inject(spec.assertions, '', function(graph, assertion){
                  return graph + color('.', assertion.passed ? 'green' : 'red')
                })
                if (spec.requiresImplementation())
                  print(color('  ' + spec.description, 'blue') + assertionsGraph)
                else if (spec.passed() && !failuresOnly)
                  print(color('  ' + spec.description, 'green') + assertionsGraph)
                else if (!spec.passed())
                  print(color('  ' + spec.description, 'red') + assertionsGraph + 
                        "\n" + indent(map(spec.failures(), function(a){ return a.message }).join("\n")) + "\n")
              })
              print("")
            }
         })
         
         quit(results.stats.failures)
       }
454518
function ReturnResult(result) {
  if (errors.length) {
    result.errors = errors;
  }
  var state = data.state;
  if (state) {
    var AMS = MathJax.Extension["TeX/AMSmath"];
    var GLYPH = (MathJax.OutputJax.SVG||{}).BBOX.GLYPH;
    state.AMS.startNumber = AMS.startNumber;
    state.AMS.labels = AMS.labels;
    state.AMS.IDs = AMS.IDs;
    state.mmlID = MathJax.ElementJax.mml.SUPER.ID;
    state.glyphs = GLYPH.glyphs;
    state.defs = GLYPH.defs;
    state.n = GLYPH.n;
    state.ID = ID;
  }
  serverState = STATE.READY;
  callback(result, originalData);
  if (serverState === STATE.READY) StartQueue();
}