New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TIMOB-10108] MobileWeb: Ti.API.log INFO level messages do not display as correct type #4057
Conversation
@@ -8,13 +8,13 @@ define(["Ti/_/Evented", "Ti/_/lang"], function(Evented, lang) { | |||
|
|||
// the order of these DOES matter... it uses the last known function | |||
// (i.e. if trace() does not exist, it'll use debug() for trace) | |||
fns = ["debug", "trace", "error", "fatal", "critical", "info", "notice", "log", "warn"]; | |||
|
|||
fns = ["debug", "trace", "error", "fatal", "critical", "info", "notice", "log", "warn"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing a comma at the end of the line.
@@ -38,6 +38,12 @@ define(["Ti/_/Evented", "Ti/_/lang"], function(Evented, lang) { | |||
})(fns[i]); | |||
} | |||
|
|||
api.log = function () { | |||
var a = Array.prototype.slice.call(arguments); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can also do
[].slice.call(arguments);
which is shorter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So actually, we have a method in lang called toArray that does this for you
MW crashes with the fix. Test Code: Ti.API.debug('debug');
Ti.API.error('error');
Ti.API.info('info');
Ti.API.timestamp('timestamp');
Ti.API.trace('trace');
Ti.API.warn('warn');
Ti.API.log('log');
Ti.API.log('debug', 'debug');
Ti.API.log('error', 'error');
Ti.API.log('info', 'info');
Ti.API.log('timestamp', 'timestamp');
Ti.API.log('trace', 'trace');
Ti.API.log('warn', 'warn'); Exception:
|
Also, it turns out we have the wrong list of APIs in Ti.API. We need to be at parity with the docs: http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.API |
After doing some digging, we should leave in notice, critical, and fatal. They aren't documented, but the other platforms are basically doing the same thing we are. We do need to add support for timestamp though. |
Closing because this PR is being superseded by a different one. |
MobileWeb: Ti.API.log INFO level messages do not display as correct type