Skip to content

Commit

Permalink
logging of ip adress
Browse files Browse the repository at this point in the history
added logging option to record the requesting machine's ip adress
  • Loading branch information
Jabo committed Apr 1, 2016
1 parent 10b4f00 commit 5be8bd1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 5be8bd1

Please sign in to comment.