fixing up log entries
[nodejs-repoproxy.git] / lib / router.js
index fcf697c..5767d26 100644 (file)
@@ -2,12 +2,13 @@ var url = require("url");
 var fs = require("fs");
 var cache = require("./cache.js");
 var path = require("path");
+var log = require("./log.js");
 
 exports.routeRequest = function(req, res) {
        // first, unify the request
-       console.log("request: ", req.url);
+       log.debug("request: ", req.url);
        var thisQuery = unifyRequest(req, res, function(unified) {
-               console.log("unified request is ", unified);
+               log.debug("unified request is ", unified);
                if(unified.requestFor == "/favicon.ico") {
                        unified.b.writeHead(404, {"Content-Type": "text/plain"});
                        unified.b.write("404 Not Found\n");
@@ -19,12 +20,12 @@ exports.routeRequest = function(req, res) {
                        } else if(unified.isDirectory) {
                                cache.serviceDirectory(unified);
                        } else {
-                               console.log("ERROR: something went majorly wrong with something, ", unified);
+                               log.debug("ERROR: something went majorly wrong with something, ", unified);
                        }
                } else {
                        // it doesnt exist yet, so we send it to the cache service if it matches an upstream service
                        if(typeof global.repoproxy.repo[unified.topPath] != "undefined") {
-                               console.log("file doesnt exist, upstream we go: ", unified);
+                               log.debug("file doesnt exist, upstream we go: ", unified);
                                cache.upstreamRequest(unified);
                        } else {
                                unified.b.writeHead(404, {"Content-Type": "text/plain"});