Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/**
* Module dependencies.
*/
var sys = require('sys');
var fs = require('fs');
var express = require('express');
var socketio = require('socket.io');
var Log = require('log');
var config = require('./config');
var log = new Log(Log.DEBUG, fs.createWriteStream('./logs/transferrings.log'));
var app = module.exports = express.createServer();
// Configuration
app.configure(function() {
app.redirect('send', '/send');
app.set('views', __dirname + '/views');
app.set('view engine', 'ejs');
//app.use(express.logger());
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(express.cookieParser());
app.use(express.session({ secret: config.server.secret }));
app.use(app.router);
app.use(express.static(__dirname + '/public'));
});
this.totalRequests = 0;
this.totalTime = 0;
this.totalErrors = 0;
this.maxLatencyMs = 0;
this.minLatencyMs = 999999;
this.histogramMs = {};
this.errorCodes = {};
this.running = true;
this.totalsShown = false;
this.requestIndex = 0;
this.requestIdToIndex = {};
if (options.quiet) {
log.level = Log.NOTICE;
}
if (options.debug) {
log.level = Log.DEBUG;
}
}
}
log.timeEnd = function (label) {
if (this.level >= Log.DEBUG) {
console.timeEnd(label)
}
}
log.EMERGENCY = Log.EMERGENCY
log.ALERT = Log.ALERT
log.CRITICAL = Log.CRITICAL
log.ERROR = Log.ERROR
log.WARNING = Log.WARNING
log.NOTICE = Log.NOTICE
log.INFO = Log.INFO
log.DEBUG = Log.DEBUG
module.exports = log
it('should use time and timeEnd when the level is DEBUG', () => {
log.level = Log.DEBUG
log.time('test')
log.timeEnd('test')
expect(consoleSpy.time).toHaveBeenCalledWith('test')
expect(consoleSpy.timeEnd).toHaveBeenCalledWith('test')
})
})
log.timeEnd = function (label) {
if (this.level >= Log.DEBUG) {
console.timeEnd(label)
}
}
#!/usr/bin/env node
let Log = require('log'),
log = new Log(Log.DEBUG),
worldClient = require('../../server/data/map/world_client'),
worldServer = require('../../server/data/map/world_server');
class Helper {
constructor() {
let self = this;
self.width = worldServer.width;
self.height = worldServer.height;
self.getTileData(964, 129);
self.getTileData(965, 129);
self.getTileData(964, 130);
self.getTileData(965, 130);
#!/usr/bin/env node
let Log = require('log'),
fs = require("fs"),
file = require('../file'),
processMap = require('./processmap'),
log = new Log(Log.DEBUG),
source = process.argv[2];
function getMap() {
if (!source)
source = 'data/world.json';
file.exists(source, function(exists) {
if (!exists) {
log.error('The file: ' + source + ' could not be found.');
return;
}
fs.readFile(source, function(error, file) {
onMap(JSON.parse(file.toString()));
});
});