Skip to content

Commit

Permalink
Fix log comments
Browse files Browse the repository at this point in the history
Use emit

Fix namespace

Fix namespace

Remove empty line

Check if logger exists

Fix comment

Redo

More

Fix yet another log

Fix statements

More fixes

Move emitter
  • Loading branch information
guerler committed Nov 7, 2015
1 parent f69c06b commit 76bcfaa
Show file tree
Hide file tree
Showing 30 changed files with 46 additions and 48 deletions.
4 changes: 4 additions & 0 deletions client/galaxy/scripts/galaxy-app-base.js
Expand Up @@ -140,6 +140,10 @@ GalaxyApp.prototype._initLogger = function _initLogger( loggerOptions ){
}
self.debug( '_initLogger:', loggerOptions );
self.logger = new metricsLogger.MetricsLogger( loggerOptions );
self.emit = {};
[ 'log', 'debug', 'info', 'warn', 'error', 'metric' ].map(function( i ) {
self.emit[ i ] = function( data ) { self.logger.emit( i, arguments[ 0 ], Array.prototype.slice.call( arguments, 1 ) ) };
});

if( self.config.debug ){
// add this logger to mvc's loggable mixin so that all models can use the logger
Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/form/form-parameters.js
Expand Up @@ -71,7 +71,7 @@ define(['utils/utils',
}

// log
console.debug('tools-form::_addRow() : Auto matched field type (' + input_def.type + ').');
Galaxy.emit.debug('form-parameters::_addRow()', 'Auto matched field type (' + input_def.type + ').');
}

// set field value
Expand Down
4 changes: 2 additions & 2 deletions client/galaxy/scripts/mvc/form/form-repeat.js
Expand Up @@ -67,7 +67,7 @@ var View = Backbone.View.extend({
add: function(options) {
// repeat block already exists
if (!options.id || this.list[options.id]) {
console.debug('form-repeat::add - Duplicate repeat block id.');
Galaxy.emit.debug('form-repeat::add()', 'Duplicate repeat block id.');
return;
}

Expand Down Expand Up @@ -123,7 +123,7 @@ var View = Backbone.View.extend({
del: function(id) {
// could not find element
if (!this.list[id]) {
console.debug('form-repeat::del - Invalid repeat block id.');
Galaxy.emit.debug('form-repeat::del()', 'Invalid repeat block id.');
return;
}

Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/form/form-select-content.js
Expand Up @@ -237,7 +237,7 @@ var View = Backbone.View.extend({
}
}
} catch (err) {
console.debug('tools-select-content::value() - Skipped.');
Galaxy.emit.debug('tools-select-content::value()', 'Skipped.');
}
} else {
for (var i in this.list) {
Expand Down
6 changes: 3 additions & 3 deletions client/galaxy/scripts/mvc/form/form-view.js
Expand Up @@ -23,7 +23,7 @@ define(['utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc',
this.options = Utils.merge(options, this.optionsDefault);

// log options
console.debug(this.options);
Galaxy.emit.debug('form-view::initialize()', 'Ready to build form.', this.options);

// link galaxy modal or create one
var galaxy = parent.Galaxy;
Expand Down Expand Up @@ -69,7 +69,7 @@ define(['utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc',
}
field.update(new_options);
field.trigger('change');
console.debug('Updating options for ' + input_id);
Galaxy.emit.debug('form-view::update()', 'Updating options for ' + input_id);
}
}
}
Expand Down Expand Up @@ -231,7 +231,7 @@ define(['utils/utils', 'mvc/ui/ui-portlet', 'mvc/ui/ui-misc',
}

// log
console.debug('tools-form-base::initialize() - Completed.');
Galaxy.emit.debug('form-view::initialize()', 'Completed');
}
});
});
17 changes: 6 additions & 11 deletions client/galaxy/scripts/mvc/tools/tools-form-base.js
Expand Up @@ -33,7 +33,7 @@ define(['utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view',
this.$el.hide();
this.deferred.execute(function(){
Backbone.View.prototype.remove.call(self);
console.debug('tools-form-base::remove() - Destroy view.');
Galaxy.emit.debug('tools-form-base::remove()', 'Destroy view.');
});
},

Expand Down Expand Up @@ -102,8 +102,7 @@ define(['utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view',
message : 'Now you are using \'' + self.options.name + '\' version ' + self.options.version + '.',
persistent : false
});
console.debug('tools-form::initialize() - Initial tool model ready.');
console.debug(new_model);
Galaxy.emit.debug('tools-form-base::initialize()', 'Initial tool model ready.', new_model);
process.resolve();

},
Expand All @@ -127,8 +126,7 @@ define(['utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view',
}
});
}
console.debug('tools-form::initialize() - Initial tool model request failed.');
console.debug(response);
Galaxy.emit.debug('tools-form::initialize()', 'Initial tool model request failed.', response);
process.reject();
}
});
Expand Down Expand Up @@ -157,8 +155,7 @@ define(['utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view',
form.wait(true);

// log tool state
console.debug('tools-form-base::_updateModel() - Sending current state (see below).');
console.debug(current_state);
Galaxy.emit.debug('tools-form-base::_updateModel()', 'Sending current state.', current_state);

// post job
Utils.request({
Expand All @@ -169,13 +166,11 @@ define(['utils/utils', 'utils/deferred', 'mvc/ui/ui-misc', 'mvc/form/form-view',
self.form.update(new_model['tool_model'] || new_model);
self.options.update && self.options.update(new_model);
form.wait(false);
console.debug('tools-form-base::_updateModel() - Received new model (see below).');
console.debug(new_model);
Galaxy.emit.debug('tools-form-base::_updateModel()', 'Received new model.', new_model);
process.resolve();
},
error : function(response) {
console.debug('tools-form-base::_updateModel() - Refresh request failed.');
console.debug(response);
Galaxy.emit.debug('tools-form-base::_updateModel()', 'Refresh request failed.', response);
process.reject();
}
});
Expand Down
2 changes: 1 addition & 1 deletion client/galaxy/scripts/mvc/tools/tools-form-workflow.js
Expand Up @@ -13,7 +13,7 @@ define(['utils/utils', 'mvc/tools/tools-form-base'],
// link with node representation in workflow module
this.node = options.node;
if (!this.node) {
console.debug('FAILED - tools-form-workflow:initialize() - Node not found in workflow.');
Galaxy.emit.debug('tools-form-workflow::initialize()', 'Node not found in workflow.');
return;
}

Expand Down
8 changes: 4 additions & 4 deletions client/galaxy/scripts/mvc/tools/tools-jobs.js
Expand Up @@ -19,13 +19,13 @@ return {

// validate job definition
if (!this._validation(form, job_def)) {
console.debug('tools-jobs::submit - Submission canceled. Validation failed.');
Galaxy.emit.debug('tools-jobs::submit()', 'Submission canceled. Validation failed.');
callback && callback();
return;
}

// debug
console.debug(job_def);
Galaxy.emit.debug('tools-jobs::submit()', 'Validation complete.', job_def);

// post job
Utils.request({
Expand All @@ -40,7 +40,7 @@ return {
},
error : function(response) {
callback && callback();
console.debug(response);
Galaxy.emit.debug('tools-jobs::submit', 'Submission failed.', response);
if (response && response.err_data) {
var error_messages = form.data.matchResponse(response.err_data);
for (var input_id in error_messages) {
Expand Down Expand Up @@ -84,7 +84,7 @@ return {

// check if objects where properly identified
if (!input_id || !input_def || !input_field) {
console.debug('tools-jobs::_validation - Retrieving input objects failed.');
Galaxy.emit.debug('tools-jobs::_validation()', 'Retrieving input objects failed.');
continue;
}

Expand Down
6 changes: 3 additions & 3 deletions client/galaxy/scripts/utils/deferred.js
Expand Up @@ -23,13 +23,13 @@ return Backbone.Model.extend({
var process = $.Deferred();
process.promise().always(function() {
delete self.active[ id ];
has_deferred && console.debug( 'Deferred::execute() - ' + this.state() + ' ' + id );
has_deferred && Galaxy.emit.debug( 'deferred::execute()', this.state().charAt(0).toUpperCase() + this.state().slice(1) + ' ' + id );
});

// deferred queue
$.when( this.last ).always(function() {
if ( self.active[ id ] ) {
has_deferred && console.debug( 'Deferred::execute() - running ' + id );
has_deferred && Galaxy.emit.debug( 'deferred::execute()', 'Running ' + id );
callback( process );
!has_deferred && process.resolve();
} else {
Expand All @@ -42,7 +42,7 @@ return Backbone.Model.extend({
/** Resets the promise queue. All currently queued but unexecuted callbacks/promises will be rejected.
*/
reset: function() {
console.debug('Deferred::execute() - reset');
Galaxy.emit.debug('deferred::execute()', 'Reset');
for ( var i in this.active ) {
this.active[ i ] = false;
}
Expand Down
3 changes: 1 addition & 2 deletions client/galaxy/scripts/utils/uploadbox.js
Expand Up @@ -97,8 +97,7 @@
}, false);

// send request
console.debug('uploadbox::uploadpost() - Posting following data:');
console.debug(cnf);
Galaxy.emit.debug('uploadbox::uploadpost()', 'Posting following data.', cnf);
xhr.send(form);
}

Expand Down
2 changes: 1 addition & 1 deletion static/maps/galaxy-app-base.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 76bcfaa

Please sign in to comment.