--- /dev/null
+
+
+/*
+ * # level for logging (1 = error, 2 = warning, 3=info, 4=debug);
+loggerlevel:4
+
+ */
+function testLogSettings() {
+ var curtime = new Date().getTime();
+ debug("This is a DEBUG TeST (%d)", curtime);
+ info("This is an Info TEST (%d)", curtime);
+ warning("This is a WARN test (%d)", curtime);
+ error("This is an ERROR test (%d)", curtime);
+}
+
+
+function info() {
+ var orig = arguments["0"];
+ var ts = new Date().toISOString();
+ //var ts = ts_t.format("%Y-%m-%d %H:%M:%S");
+ arguments["0"] = "[??INFO??] ("+ts+"): "+orig;
+
+ if(global.repoproxy.loglevel >= 3) {
+ sendLog.apply(this, arguments);
+ }
+}
+
+function debug() {
+ var orig = arguments["0"];
+ var ts = new Date().toISOString();
+ //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);
+ }
+}
+
+function warning() {
+ var orig = arguments["0"];
+ var ts = new Date().toISOString();
+ //var ts = ts_t.format("%Y-%m-%d %H:%M:%S");
+ arguments["0"] = "[!!WARNING!!] ("+ts+"): "+orig;
+
+ if(global.repoproxy.loglevel >= 2) {
+ sendLog.apply(this, arguments);
+ }
+}
+
+function error() {
+ var orig = arguments["0"];
+ var ts = new Date().toISOString();
+ //var ts = ts_t.format("%Y-%m-%d %H:%M:%S");
+ arguments["0"] = "[**ERROR**] ("+ts+"): "+orig;
+
+ if(global.repoproxy.loglevel >= 1) {
+ sendLog.apply(this, arguments);
+ }
+}
+
+function sendLog() {
+ console.log.apply(this, arguments);
+}
+
+
+exports.info = info;
+exports.debug = debug;
+exports.warning = warning;
+exports.error = error;
+exports.testLogSettings = testLogSettings;