Less verbose logging on INFO.

See: https://github.com/freifunkhamburg/ffffng/issues/18
This commit is contained in:
baldo 2016-06-26 12:58:40 +02:00
parent 7dbb70db46
commit f720c0e028
2 changed files with 12 additions and 12 deletions

View file

@ -202,7 +202,7 @@ angular.module('ffffng')
}, },
sendPendingMails: function (callback) { sendPendingMails: function (callback) {
Logger.tag('mail', 'queue').info('Start sending pending mails...'); Logger.tag('mail', 'queue').debug('Start sending pending mails...');
var startTime = moment(); var startTime = moment();
@ -211,7 +211,7 @@ angular.module('ffffng')
return callback(err); return callback(err);
} }
Logger.tag('mail', 'queue').info('Sending next batch...'); Logger.tag('mail', 'queue').debug('Sending next batch...');
findPendingMailsBefore(startTime, MAIL_QUEUE_DB_BATCH_SIZE, function (err, pendingMails) { findPendingMailsBefore(startTime, MAIL_QUEUE_DB_BATCH_SIZE, function (err, pendingMails) {
if (err) { if (err) {
@ -219,7 +219,7 @@ angular.module('ffffng')
} }
if (_.isEmpty(pendingMails)) { if (_.isEmpty(pendingMails)) {
Logger.tag('mail', 'queue').info('Done sending pending mails.'); Logger.tag('mail', 'queue').debug('Done sending pending mails.');
return callback(null); return callback(null);
} }

View file

@ -110,7 +110,7 @@ angular.module('ffffng')
var isValidMac = Validator.forConstraint(Constraints.node.mac); var isValidMac = Validator.forConstraint(Constraints.node.mac);
function parseNodesJson(body, callback) { function parseNodesJson(body, callback) {
Logger.tag('monitoring', 'information-retrieval').info('Parsing nodes.json...'); Logger.tag('monitoring', 'information-retrieval').debug('Parsing nodes.json...');
function parseTimestamp(timestamp) { function parseTimestamp(timestamp) {
if (!_.isString(json.timestamp)) { if (!_.isString(json.timestamp)) {
@ -197,14 +197,14 @@ angular.module('ffffng')
} }
function sendMonitoringMailsBatched(name, mailType, findBatchFun, callback) { function sendMonitoringMailsBatched(name, mailType, findBatchFun, callback) {
Logger.tag('monitoring', 'mail-sending').info('Sending "%s" mails...', name); Logger.tag('monitoring', 'mail-sending').debug('Sending "%s" mails...', name);
var sendNextBatch = function (err) { var sendNextBatch = function (err) {
if (err) { if (err) {
return callback(err); return callback(err);
} }
Logger.tag('monitoring', 'mail-sending').info('Sending next batch...'); Logger.tag('monitoring', 'mail-sending').debug('Sending next batch...');
findBatchFun(function (err, nodeStates) { findBatchFun(function (err, nodeStates) {
if (err) { if (err) {
@ -212,7 +212,7 @@ angular.module('ffffng')
} }
if (_.isEmpty(nodeStates)) { if (_.isEmpty(nodeStates)) {
Logger.tag('monitoring', 'mail-sending').info('Done sending "%s" mails.', name); Logger.tag('monitoring', 'mail-sending').debug('Done sending "%s" mails.', name);
return callback(null); return callback(null);
} }
@ -450,7 +450,7 @@ angular.module('ffffng')
retrieveNodeInformation: function (callback) { retrieveNodeInformation: function (callback) {
var url = config.server.map.nodesJsonUrl; var url = config.server.map.nodesJsonUrl;
Logger.tag('monitoring', 'information-retrieval').info('Retrieving nodes.json: %s', url); Logger.tag('monitoring', 'information-retrieval').debug('Retrieving nodes.json: %s', url);
request(url, function (err, response, body) { request(url, function (err, response, body) {
if (err) { if (err) {
return callback(err); return callback(err);
@ -471,7 +471,7 @@ angular.module('ffffng')
if (previousImportTimestamp !== null && !data.importTimestamp.isAfter(previousImportTimestamp)) { if (previousImportTimestamp !== null && !data.importTimestamp.isAfter(previousImportTimestamp)) {
Logger Logger
.tag('monitoring', 'information-retrieval') .tag('monitoring', 'information-retrieval')
.info( .debug(
'No new data, skipping. Current timestamp: %s, previous timestamp: %s', 'No new data, skipping. Current timestamp: %s, previous timestamp: %s',
data.importTimestamp.format(), data.importTimestamp.format(),
previousImportTimestamp.format() previousImportTimestamp.format()
@ -523,7 +523,7 @@ angular.module('ffffng')
}, },
sendMonitoringMails: function (callback) { sendMonitoringMails: function (callback) {
Logger.tag('monitoring', 'mail-sending').info('Sending monitoring mails...'); Logger.tag('monitoring', 'mail-sending').debug('Sending monitoring mails...');
var startTime = moment(); var startTime = moment();
@ -570,7 +570,7 @@ angular.module('ffffng')
var daysBeforeCleanup = 30; var daysBeforeCleanup = 30;
Logger Logger
.tag('monitoring', 'information-cleanup') .tag('monitoring', 'information-cleanup')
.info('Cleaning up node data not updated for %s days...', daysBeforeCleanup); .debug('Cleaning up node data not updated for %s days...', daysBeforeCleanup);
Database.run( Database.run(
'DELETE FROM node_state WHERE modified_at < ?', 'DELETE FROM node_state WHERE modified_at < ?',
[moment().subtract(daysBeforeCleanup, 'days').unix()], [moment().subtract(daysBeforeCleanup, 'days').unix()],
@ -581,7 +581,7 @@ angular.module('ffffng')
Logger Logger
.tag('monitoring', 'information-retrieval') .tag('monitoring', 'information-retrieval')
.info('Node data cleanup done.'); .debug('Node data cleanup done.');
callback(); callback();
} }