How to use the util.log function in util

To help you get started, we’ve selected a few util 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 megamsys / varai / varai / nodes / flows.js View on Github external
var i;
	var nt;
	missingTypes = [];

	for ( i = 0; i < activeConfig.length; i++) {
		var type = activeConfig[i].type;
		// TODO: remove workspace in next release+1
		if (type != "workspace" && type != "tab") {
			nt = typeRegistry.get(type);
			if (!nt && missingTypes.indexOf(type) == -1) {
				missingTypes.push(type);
			}
		}
	}
	if (missingTypes.length > 0) {
		util.log("[varai] Waiting for missing types to be registered:");
		for ( i = 0; i < missingTypes.length; i++) {
			util.log("[varai]  - " + missingTypes[i]);
		}
		return;
	}

	util.log("[varai] Starting flows");
	events.emit("nodes-starting");
	for ( i = 0; i < activeConfig.length; i++) {
		var nn = null;
		// TODO: remove workspace in next release+1
		if (activeConfig[i].type != "workspace" && activeConfig[i].type != "tab") {
			nt = typeRegistry.get(activeConfig[i].type);
			if (nt) {
				try {
					nn = new nt(activeConfig[i]);
github ironbane / IronbaneServerLegacy / main.js View on Github external
global.ItemTemplate = require('./src/server/entity/itemTemplate');
    global.Item = require('./src/server/entity/item');

    // Load DataHandler global for now (holds memory DB of item and unit templates)
    global.dataHandler = require('./src/server/game/dataHandler');

    // load AI as a module
    var AI = require('./src/server/game/ai');
    // temp pass them on to global for access below
    global.StateMachine = AI.StateMachine;
    global.State = AI.State;
    _.extend(global, AI.States);

    // READ REST OF OLD GLOBAL APP HERE
    for (var f = 0; f < includes.length; f++) {
        log("Loading: " + includes[f]);
        eval(fs.readFileSync(includes[f]) + '');
    }

    // temp hack
    global.worldHandler = worldHandler;

    global.actorScripts = {};
    LoadActorScripts()
        .then(function(scripts) {

            _.extend(global.actorScripts, scripts);

            // Load Chat module - after worldHandler, there is a dep
            global.chatHandler = require('./src/server/game/chat')(io, global.dataHandler.units, global.worldHandler);

            // All set! Tell WorldHandler to load
github ahung89 / bomb-arena / server / game.js View on Github external
function onClientDisconnect() {
	util.log("Player has disconnected: " + this.id);

	delete players[this.id];

	this.broadcast.emit("remove player", {id: this.id});
};
github megamsys / varai / varai.js View on Github external
process.on('uncaughtException',function(err) {
    util.log('[varai] Uncaught Exception:');
    util.log(err.stack);
    process.exit(1);
});
github hassanshaikley / arena-of-the-bits / web.js View on Github external
function onMeteorCast(data){
  //util.log("A Meteor has been cast " + JSON.stringify(data.meteor_x));
  util.log(data.meteor_x);
  this.emit('meteor cast', {meteor_x: data.meteor_x });
  this.broadcast.emit('meteor cast', {meteor_x: data.meteor_x });
};
github voithos / swiftcode / src / routes.js View on Github external
models.Project.create(projects, function(err) {
            if (err) {
                util.log(err);
                util.log('addLang error');
                return done(err);
            }

            var projects = Array.prototype.slice.call(arguments, 1);
            _.each(_.map(exerciseProject, function(p) { return parseInt(p, 10); }), function(project, i) {
                exercises[i].project = projects[project]._id;
                exercises[i].projectName = projects[project].name;
            });

            models.Exercise.create(exercises, function(err) {
                if (err) {
                    util.log(err);
                    util.log('addLang error');
                    return done(err);
                }
                _.each(Array.prototype.slice.call(arguments, 1), function(exercise) {
github maelvls / vscode-dune / src / extension.ts View on Github external
.catch((err) => {
            log(err);
            vscode.window.showWarningMessage(
                "dune error: "+err,
            );
            return "";
        });
github marcusbaer / node-sms / smsd.js View on Github external
function getAllMessagesFromGateway () {
    if (verboseMode) {
        sys.log("fetch all messages from gateway...");
    }
    fetchMessages(function(newMessages){
        saveAllMessagesToFile(newMessages, notifyListeners);
        writeMessagesToLog(newMessages);
        removeAllMessagesFromGateway();
    });
    if (watchMode) {
        setTimeout(getAllMessagesFromGateway, config.timeout || 30000);
    }
}
github nihgwu / iZhihu / lib / crawler.js View on Github external
request.get(url, function (err, res, data) {
    if (err || res.statusCode != 200) return;
    log("====== fetchLatest ======");
    var json = JSON.parse(data);
    if (latest.news && (json.news.length + 1) == latest.news.length)  return;
    uploader.updateUptoken();
    json.news.forEach(function (item) {
      fetchStory(item.id, json.date, true);
      uploader.uploadLink(item.image, 'image/' + getKey(item.image));
      uploader.uploadLink(item.thumbnail, 'thumbnail/' + getKey(item.thumbnail));
      item.date = json.date;
      delete item.ga_prefix;
      item.url = '/story/' + item.id;
      item.image = '/image/' + getKey(item.image);
      item.thumbnail = '/thumbnail/' + getKey(item.thumbnail);
    });
    var before = moment(json.date, 'YYYYMMDD').subtract(1, 'days').format('YYYYMMDD');
    db.get('daily-' + before).then(function (data) {
      json.news.push({
github pagameba / node-mapserver / examples / mapserv.js View on Github external
response.end("MapServer Error: " + err.code + " ("+err.codeStr+"): " + err.message + ' in ' + err.routine);
        } else {
          cache.set(key, {mimetype: map.mimetype, buffer: buffer});
          response.writeHead(200, {
            'Content-Type': map.mimetype
          });
          response.end(buffer);
        }
      });
    }
  } else {
    response.writeHead(404, {});
    response.end('File not found.');
  }
}).listen(port);
util.log("mapserv.js running on port " + port );