Permalink
Browse files

1. Fixed all logger.warning() invocations to logger.warn()

2. Fix to handle monkey patch status, properly.
  • Loading branch information...
1 parent b7a7dc0 commit 939dccf620a8e8e63b8f85caecb312e83fe6a6f0 Prabhakhar K committed Nov 28, 2011
View
@@ -1,9 +1,11 @@
*.iml
.DS_Store
.idea
+*.log
temp
node_modules
pids
reports
target
docs
+logs
View
@@ -75,7 +75,7 @@ var Console = module.exports = function(config) {
});
procEmitter.on(Engine.Events.WARNING, function(event, message) {
if(message) {
- logger.warning(new Date() + ' - ' + message.stack || message);
+ logger.warn(new Date() + ' - ' + message.stack || message);
}
});
@@ -77,7 +77,7 @@ exports.go = function(options) {
break;
default:
- logger.warning("Unsupported statement in " + root + name);
+ logger.warn("Unsupported statement in " + root + name);
}
});
}
@@ -123,7 +123,7 @@ function _process(verb, type, bag, root, name, meta, cb) {
});
}
catch(e) {
- logger.warning(e.message || e);
+ logger.warn(e.message || e);
return cb(e);
}
}
@@ -80,7 +80,7 @@ exports.exec = function(args) {
template = uriTemplate.parse(resourceUri);
}
catch(err) {
- global.opts.logger.warning(err);
+ global.opts.logger.warn(err);
return cb(err, null);
}
@@ -185,7 +185,7 @@ exports.exec = function(args) {
}
function sendOneRequest(args, resourceUri, params, holder, cb) {
- var h, requestBody, mediaType = 'application/json', override, client, isTls, options, auth,
+ var h, requestBody, mediaType = 'application/json', overrideStatus, client, isTls, options, auth,
clientRequest, template, start = Date.now();
var respData, respJson, uri, heirpart, authority, host, port, path, useProxy = false, proxyHost, proxyPort;
@@ -256,7 +256,7 @@ function sendOneRequest(args, resourceUri, params, holder, cb) {
template = uriTemplate.parse(body.content || resource.body.content);
}
catch(err) {
- global.opts.logger.warning(err);
+ global.opts.logger.warn(err);
return cb(err, null);
}
requestBody = formatUri(template, params, resource.defaults);
@@ -429,10 +429,10 @@ function sendOneRequest(args, resourceUri, params, holder, cb) {
return httpReqTx.cb(e);
}
- override = res.statusCode;
+ overrideStatus = res.statusCode;
if(resource.monkeyPatch && resource.monkeyPatch['patch status']) {
try {
- override = resource.monkeyPatch['patch status']({
+ overrideStatus = resource.monkeyPatch['patch status']({
status: res.statusCode,
headers: res.headers,
body: respJson || respData
@@ -442,7 +442,7 @@ function sendOneRequest(args, resourceUri, params, holder, cb) {
return httpReqTx.cb(e);
}
}
- if(res.statusCode >= 200 && res.statusCode <= 300) {
+ if(overrideStatus >= 200 && overrideStatus <= 300) {
if(respJson) {
if(resource.monkeyPatch && resource.monkeyPatch['patch response']) {
try {
@@ -507,7 +507,7 @@ function prepareParams() {
params[p] = v;
}
});
- })
+ });
return params;
}
@@ -75,8 +75,8 @@ function loadInternal(path, prefix, routes) {
cooked = compiler.compile(script);
}
catch(e) {
- global.opts.logger.warning('Error loading route ' + (path + filename));
- global.opts.logger.warning(e.stack || e);
+ global.opts.logger.warn('Error loading route ' + (path + filename));
+ global.opts.logger.warn(e.stack || e);
cooked = undefined;
}
if (cooked &&
@@ -16,7 +16,7 @@
*/
"use strict"
-var Engine = require('lib/engine'),
+var Engine = require('../lib/engine'),
http = require('http'),
fs = require('fs'),
util = require('util'),

0 comments on commit 939dccf

Please sign in to comment.