Skip to content

Commit

Permalink
Added JSDuck comments and units tests for Deft.Logger. Fixed bugs unc…
Browse files Browse the repository at this point in the history
…overed in new Deft.Logger unit tests.

The Ext JS log adapter implementation incorrectly attempted to use `is` instead of `=` for assignments, when adapting 'verbose' to 'info' and 'deprecate' to 'warn'.
Ext.Logger has transient availability in Sencha Touch - with a production build it will not be available unless explicitly included.  Revised the Sencha Touch log adapter implementation to accommodate this.
Added the Deft.Logger tests to the Karma configurations and manual test runner.

See #102
See #106
  • Loading branch information
John Yanarella committed Jun 28, 2013
1 parent cd8757a commit 5bbf111
Show file tree
Hide file tree
Showing 23 changed files with 801 additions and 89 deletions.
68 changes: 56 additions & 12 deletions packages/deft/build/deft-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,81 @@ Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
*/

/**
* Logger used by DeftJS. Output is displayed in the console when using ext-dev/ext-all-dev.
* Logger used by DeftJS.
*
* Output is displayed in the console when using `ext-dev`/`ext-all-dev` or `sencha-debug`/`sencha-all-debug`.
*
* @private
*/

Ext.define('Deft.log.Logger', {
alternateClassName: ['Deft.Logger'],
singleton: true,
/**
* Logs a message with the specified priority.
*
* @param {String} message The message to log.
* @param {String} priority The priority of the log message. Valid values are: `verbose`, `info`, `deprecate`, `warn` and `error`.
*/

log: function(message, priority) {
if (priority == null) {
priority = 'info';
}
},
error: function(message) {
this.log(message, 'error');
/**
* Logs a message with 'verbose' priority.
*
* @param {String} message The message to log.
*/

verbose: function(message) {
this.log(message, 'verbose');
},
/**
* Logs a message with 'info' priority.
*
* @param {String} message The message to log.
*/

info: function(message) {
this.log(message, 'info');
},
verbose: function(message) {
this.log(message, 'verbose');
/**
* Logs a message with 'deprecate' priority.
*
* @param {String} message The message to log.
*/

deprecate: function(message) {
this.log(message, 'deprecate');
},
/**
* Logs a message with 'warn' priority.
*
* @param {String} message The message to log.
*/

warn: function(message) {
this.log(message, 'warn');
},
deprecate: function(message) {
this.log(message, 'deprecate');
/**
* Logs a message with 'error' priority.
*
* @param {String} message The message to log.
*/

error: function(message) {
this.log(message, 'error');
}
}, function() {
var _ref;
if (Ext.getVersion('extjs') != null) {
this.log = function(message, priority) {
if (priority == null) {
priority = 'info';
}
if (priority === 'verbose') {
priority === 'info';
priority = 'info';
}
if (priority === 'deprecate') {
priority = 'warn';
Expand All @@ -58,9 +97,14 @@ Ext.define('Deft.log.Logger', {
});
};
} else {
if (Ext.isFunction((_ref = Ext.Logger) != null ? _ref.log : void 0)) {
this.log = Ext.bind(Ext.Logger.log, Ext.Logger);
}
this.log = function(message, priority) {
if (priority == null) {
priority = 'info';
}
if ((Ext.Logger != null) && Ext.isFunction(Ext.Logger.log)) {
Ext.Logger.log(message, Ext.Array.indexOf(['verbose', 'info', 'deprecate', 'warn', 'error'], priority));
}
};
}
});

Expand Down
68 changes: 56 additions & 12 deletions packages/deft/build/deft-dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,42 +12,81 @@ Open source under the [MIT License](http://en.wikipedia.org/wiki/MIT_License).
*/

/**
* Logger used by DeftJS. Output is displayed in the console when using ext-dev/ext-all-dev.
* Logger used by DeftJS.
*
* Output is displayed in the console when using `ext-dev`/`ext-all-dev` or `sencha-debug`/`sencha-all-debug`.
*
* @private
*/

Ext.define('Deft.log.Logger', {
alternateClassName: ['Deft.Logger'],
singleton: true,
/**
* Logs a message with the specified priority.
*
* @param {String} message The message to log.
* @param {String} priority The priority of the log message. Valid values are: `verbose`, `info`, `deprecate`, `warn` and `error`.
*/

log: function(message, priority) {
if (priority == null) {
priority = 'info';
}
},
error: function(message) {
this.log(message, 'error');
/**
* Logs a message with 'verbose' priority.
*
* @param {String} message The message to log.
*/

verbose: function(message) {
this.log(message, 'verbose');
},
/**
* Logs a message with 'info' priority.
*
* @param {String} message The message to log.
*/

info: function(message) {
this.log(message, 'info');
},
verbose: function(message) {
this.log(message, 'verbose');
/**
* Logs a message with 'deprecate' priority.
*
* @param {String} message The message to log.
*/

deprecate: function(message) {
this.log(message, 'deprecate');
},
/**
* Logs a message with 'warn' priority.
*
* @param {String} message The message to log.
*/

warn: function(message) {
this.log(message, 'warn');
},
deprecate: function(message) {
this.log(message, 'deprecate');
/**
* Logs a message with 'error' priority.
*
* @param {String} message The message to log.
*/

error: function(message) {
this.log(message, 'error');
}
}, function() {
var _ref;
if (Ext.getVersion('extjs') != null) {
this.log = function(message, priority) {
if (priority == null) {
priority = 'info';
}
if (priority === 'verbose') {
priority === 'info';
priority = 'info';
}
if (priority === 'deprecate') {
priority = 'warn';
Expand All @@ -58,9 +97,14 @@ Ext.define('Deft.log.Logger', {
});
};
} else {
if (Ext.isFunction((_ref = Ext.Logger) != null ? _ref.log : void 0)) {
this.log = Ext.bind(Ext.Logger.log, Ext.Logger);
}
this.log = function(message, priority) {
if (priority == null) {
priority = 'info';
}
if ((Ext.Logger != null) && Ext.isFunction(Ext.Logger.log)) {
Ext.Logger.log(message, Ext.Array.indexOf(['verbose', 'info', 'deprecate', 'warn', 'error'], priority));
}
};
}
});

Expand Down
2 changes: 1 addition & 1 deletion packages/deft/build/deft.js

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/deft/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<link rel="stylesheet" href="resources/css/app-0b2d94a756da271cc9ed4a65f4837560.css" type="text/css" />

<script type="text/javascript" src="extjs/ext-all.js"></script>
<script type="text/javascript" src="data-841a326d34a1517a6b9cc72787be3da8.js"></script>
<script type="text/javascript" src="data-df021bb86bf50e21a719f32149a4d807.js"></script>

<script type="text/javascript" src="app-2a09dc1c9acadab58e390b770a9565d0.js"></script>

Expand Down Expand Up @@ -61,7 +61,7 @@ <h3>Others...</h3>



<div id='footer-content' style='display: none'>Generated on Mon 24 Jun 2013 18:35:52 by <a href='https://github.com/senchalabs/jsduck'>JSDuck</a> 4.10.4.</div>
<div id='footer-content' style='display: none'>Generated on Fri 28 Jun 2013 05:22:03 by <a href='https://github.com/senchalabs/jsduck'>JSDuck</a> 4.10.4.</div>



Expand Down
2 changes: 1 addition & 1 deletion packages/deft/docs/output/Deft.log.Logger.js

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

Loading

0 comments on commit 5bbf111

Please sign in to comment.