-
Notifications
You must be signed in to change notification settings - Fork 20
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
Adding Logger module to track events #99
base: master
Are you sure you want to change the base?
Conversation
Conflicts: modules/Logger.js modules/Model.js modules/Router.js modules/View.js torso-bundle.js torso-bundle.min.js
Conflicts: modules/Logger.js modules/Model.js modules/Router.js modules/View.js torso-bundle.js torso-bundle.min.js
* @ param {JSON object} contains tracking information (including state: 'start' or 'end', uuid, sessionID) | ||
* @ method track | ||
*/ | ||
track: function(eventInfo){ |
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.
indentation issue
To answer your questions:
This commit brings up the question of how much can we make added functionality (like sending to new relic) pluggable on top of torso. |
/** | ||
* Overridden to send before and after signals to Logger | ||
*/ | ||
fetch: function(options){ |
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.
look into
if (!callback) callback = this[name]; | ||
var callbackCopy = function(){ | ||
var uuid = (new Date()).getTime().toString(16)+Math.floor(1E7*Math.random()).toString(16); | ||
this.trigger('routeTiming', |
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.
See all the comments about these type of event names and payloads.
Note, the convention of triggered events are "-" separated (not camelCased) amd that they describe what has or about to happen.
Great work @cmchin! I think you did a good job reducing the rewriting backbone. There's a few changes are left in order for across-the-board value from your commit. Can you create test cases for this commit? |
removed eventTracker changed payload information added event listeners and triggers in both router/view/model instance and Torso.Events
removed eventTracker changed payload information added event listeners and triggers in both router/view/model instance and Torso.Events
@kentmw @mandragorn @catbieber Made all the changes mentioned above:
|
|
||
constructor: function(){ | ||
Backbone.Router.apply(this, arguments); | ||
this.__applyTimingEventListeners(['pre-route', 'post-route']); |
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.
@kentmw is there a better way to add all event listeners without enumerating each one as strings in the constructor?
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.
@cmchin, I can't think of one short of hijacking the events logic and checking for "pre-" and "post-" callbacks and triggering the Events event there. Although, I could see you passing in pairs of strings to which it can handle Events-specific logic across events (passing information from the start to the stop if needed).
I like being declarative about which events we are binding to timing events, at least for now.
@cmchin super close and really useful 👍 |
@mandragorn , @cmchin I'm excited about this pull request. Any status on the last touches? |
@cmchin do you want to finish this patch? If I don't hear from you in a week, I'll just finish it for you. |
Questions: