Permalink
Browse files

logging of ip adress

added logging option to record the requesting machine's ip adress
  • Loading branch information...
1 parent 10b4f00 commit 5be8bd16315d6d143fcfe701d7027566f0f95a0e @Jabo Jabo committed Apr 1, 2016
Showing with 6 additions and 0 deletions.
  1. +3 −0 config.js
  2. +3 −0 server.js
View
@@ -4,6 +4,9 @@ var path = require('path'),
module.exports = {
// Logging config
loggingOpts: {
+
+ // show the ip address of the machine requesting the npm package
+ logRequesterIP: true,
// Print to stdout with colors
logToConsole: true,
// Write to file
View
@@ -67,6 +67,9 @@ function start(config) {
var server = http.createServer();
server.on('request', function(req, res) {
+ if (config.loggingOpts.logRequesterIP) {
+ log.info("Request from ip: "+req.connection.remoteAddress+ " for "+req.url);
+ }
if (!api.route(req, res)) {
log.error('No route found', req.url);
Package.proxy(req, res);

0 comments on commit 5be8bd1

Please sign in to comment.