Replaces console.log with global logger

This commit is contained in:
Raul Ochoa 2015-09-18 17:12:53 +02:00
parent d2df0b7c84
commit 2bdce4baa7
6 changed files with 7 additions and 9 deletions

View File

@ -241,7 +241,7 @@ LayergroupController.prototype.sendResponse = function(req, res, body, status, h
function sendResponse(err, affectedTables) {
req.profiler.done('affectedTables');
if (err) {
console.log('ERROR generating cache channel: ' + err);
global.logger.log('ERROR generating cache channel: ' + err);
}
if (!!affectedTables) {
var tablesCacheEntry = new TablesCacheEntry(dbName, affectedTables);

View File

@ -264,7 +264,7 @@ MapController.prototype.afterLayergroupCreate = function(req, res, mapconfig, la
req.profiler.done('incMapviewCount');
}
if ( err ) {
console.log("ERROR: failed to increment mapview count for user '" + username + "': " + err);
global.logger.log("ERROR: failed to increment mapview count for user '" + username + "': " + err);
}
done();
});

View File

@ -48,7 +48,7 @@ NamedMapsController.prototype.sendResponse = function(req, res, resource, header
function sendResponse(err, result) {
req.profiler.done('affectedTables');
if (err) {
console.log('ERROR generating cache channel: ' + err);
global.logger.log('ERROR generating cache channel: ' + err);
}
if (!result || !!result.affectedTables) {
// we increase cache control as we can invalidate it

View File

@ -14,12 +14,11 @@ CdbRequest.prototype.userByReq = function(req) {
}
var mat = host.match(this.RE_USER_FROM_HOST);
if ( ! mat ) {
console.error("Pattern '" + this.RE_USER_FROM_HOST + "' does not match hostname '" + host + "'");
global.logger.error("Pattern '%s' does not match hostname '%s'", this.RE_USER_FROM_HOST, host);
return;
}
// console.log("Matches: "); console.dir(mat);
if ( mat.length !== 2 ) {
console.error("Pattern '" + this.RE_USER_FROM_HOST + "' gave unexpected matches against '" + host + "': ", mat);
global.logger.error("Pattern '%s' gave unexpected matches against '%s': %s", this.RE_USER_FROM_HOST, host, mat);
return;
}
return mat[1];

View File

@ -78,9 +78,9 @@ module.exports = function(serverOptions) {
error: !!err ? JSON.stringify(err.message) : undefined
});
if (err) {
console.warn(logMessage);
global.logger.warn(logMessage);
} else {
console.info(logMessage);
global.logger.info(logMessage);
}
});
}

View File

@ -40,7 +40,6 @@ module.exports = {
if (count > 1) {
debug("last statsd client socket error repeated " + count + " times");
instance.last_error.count = 1;
//console.log("Clearing interval");
clearInterval(instance.last_error.interval);
instance.last_error.interval = null;
}