X-Git-Url: http://git.pjr.cc/?p=nodejs-repoproxy.git;a=blobdiff_plain;f=lib%2Flog.js;h=49e189f33b1d6371ef2f5f13260a4d586921dc4c;hp=24f31d23e13bccef69f68818e7958657a22585ae;hb=9ce3e2a4e56f91fdc7d6295d3d064f2739955404;hpb=d7478970127408f056b157f18df74fef7db3f892 diff --git a/lib/log.js b/lib/log.js index 24f31d2..49e189f 100644 --- a/lib/log.js +++ b/lib/log.js @@ -20,7 +20,7 @@ function info() { //var ts = ts_t.format("%Y-%m-%d %H:%M:%S"); arguments["0"] = "[??INFO??] ("+ts+"): "+orig; - if(global.repoproxy.loglevel >= 3) { + if(typeof global.repoproxy == "undefined" || global.repoproxy.loglevel >= 3) { sendLog.apply(this, arguments); } } @@ -31,8 +31,10 @@ function debug() { //var ts = ts_t.format("%Y-%m-%d %H:%M:%S"); arguments["0"] = "[^^DEBUG^^] ("+ts+"): "+orig; - if(global.repoproxy.loglevel >= 4) { - sendLog.apply(this, arguments); + if(typeof global.repoproxy != "undefined") { + if(global.repoproxy.loglevel >= 4) { + sendLog.apply(this, arguments); + } } } @@ -42,7 +44,7 @@ function warning() { //var ts = ts_t.format("%Y-%m-%d %H:%M:%S"); arguments["0"] = "[!!WARNING!!] ("+ts+"): "+orig; - if(global.repoproxy.loglevel >= 2) { + if(typeof global.repoproxy == "undefined" || global.repoproxy.loglevel >= 2) { sendLog.apply(this, arguments); } } @@ -53,7 +55,7 @@ function error() { //var ts = ts_t.format("%Y-%m-%d %H:%M:%S"); arguments["0"] = "[**ERROR**] ("+ts+"): "+orig; - if(global.repoproxy.loglevel >= 1) { + if(typeof global.repoproxy == "undefined" || global.repoproxy.loglevel >= 1) { sendLog.apply(this, arguments); } }