I am writing a huge javascript software
Trace (), both webkit and firebug Logs (), error (), warnings, provide console objects with methods like, I need to detect calls, log events, debug tasks. (), e.t.c. They are great, but what do I do when the browser is IE or Opera?
Imagine making a big application, you definitely want to see all the initialization doing this, etc., so I'm logging in this though, if I just log in to them , Logging will not work in browsers which console is not registered. I can create a cover object:
MyNamespace.Console = {}; MyNamespace.Console.log = function (value) {if (console! == undefined) {console.log (value); } Else {// Should I Do To Log In Event On Other Browser? }}
makes the above so there is no problem on IE / Opera, but how can I log in IE (one really needs to be signed with IE! ).
In addition, if I log in everywhere in my application, does this slow me down on production environment? Before logging in, can I switch the switch switch on / off and make a simple check before logging out that if DEBUG === is correct, then log?
Regarding the systems like the Closer Compiler, can you remove them for logging?
What if there is an error while running on the production environment and no logging is done, how can you debug / debug the problem? And in fact, do you ever send JavaScript error logs (developers) to ensure that your clients do not have problems? how does it work?
I appreciate JavaScript / debugging / logging with comments, this is my first time writing a huge Javascript application, and clearly, I'm not sure about it What to do ... Debugging and logging in JavaScript seems a bit incomplete.
I do not recommend applying the log back to the developer & mdash; At least this without informing users / customers beforehand.
Anurag has suggested that initially it will be a safe practice to log errors / events / debugging data in an array, and then periodically send the log data to the web server where it Can be stored locally and in cycling. Then If the client is having problems , then they can drag themselves to debugging, either, you can send it manually or explicitly for you to transfer logs to the developer Can tell the app. / P>
Logging in the console is generally used anyway during development. And the debug flag should be used for it so that it is not turned on at all times.
Comments
Post a Comment