Skip to content

Commit

Permalink
1. Fixed all logger.warning() invocations to logger.warn()
Browse files Browse the repository at this point in the history
2. Fix to handle monkey patch status, properly.
  • Loading branch information
Prabhakhar K committed Nov 28, 2011
1 parent b7a7dc0 commit 939dccf
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,9 +1,11 @@
*.iml
.DS_Store
.idea
*.log
temp
node_modules
pids
reports
target
docs
logs
2 changes: 1 addition & 1 deletion modules/console/app.js
Expand Up @@ -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);
}
});

Expand Down
4 changes: 2 additions & 2 deletions modules/engine/lib/engine/brew.js
Expand Up @@ -77,7 +77,7 @@ exports.go = function(options) {

break;
default:
logger.warning("Unsupported statement in " + root + name);
logger.warn("Unsupported statement in " + root + name);
}
});
}
Expand Down Expand Up @@ -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);
}
}
Expand Down
14 changes: 7 additions & 7 deletions modules/engine/lib/engine/http.request.js
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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;

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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 {
Expand Down Expand Up @@ -507,7 +507,7 @@ function prepareParams() {
params[p] = v;
}
});
})
});
return params;
}

Expand Down
4 changes: 2 additions & 2 deletions modules/engine/lib/engine/load-routes.js
Expand Up @@ -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 &&
Expand Down
2 changes: 1 addition & 1 deletion modules/engine/test/proxy-test.js
Expand Up @@ -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'),
Expand Down

0 comments on commit 939dccf

Please sign in to comment.