Log HTTP requests

This commit is contained in:
Cryptkeeper 2015-11-02 01:08:54 -06:00
parent 1c1f49aa43
commit a21ed3f6fb

@ -23,6 +23,8 @@ exports.start = function(callback) {
var server = http.createServer(function(req, res) { var server = http.createServer(function(req, res) {
var requestUrl = url.parse(req.url).pathname; var requestUrl = url.parse(req.url).pathname;
logger.log('info', '%s requested: %s', req.connection.remoteAddress, requestUrl);
if (requestUrl in urlMapping) { if (requestUrl in urlMapping) {
var file = urlMapping[requestUrl]; var file = urlMapping[requestUrl];
@ -40,7 +42,8 @@ exports.start = function(callback) {
server.listen(config.site.port, config.site.ip); server.listen(config.site.port, config.site.ip);
// I don't like this. But it works, I think. // I don't like this. But it works, I think.
exports.io = (io = io.listen(server)); io = io.listen(server);
exports.io = io;
// Since everything is loaded, do some final prep work. // Since everything is loaded, do some final prep work.
logger.log('info', 'Started on %s:%d', config.site.ip, config.site.port); logger.log('info', 'Started on %s:%d', config.site.ip, config.site.port);