• Anonymous
  • Login
  • Register
OpenLog - Feature Request: OpenLogJavaScript comments should be moved to it's own library

Created on Jun 4, 2009
Created by John Smart
Status Submitted

The bottom of OpenLogJavaScript library's comments give an example beforeLogError function.

I wrapped the code within an if statement to not prompt for an ExtraMessage value if one was already set. This allowed me to, when I wanted to simply log something without prompting the user, create my openLogObject, then call
myOpenLogObject.postParamList["ExtraMessage"] = 'submitted automatically'
before calling myOpenLogObject.logError()

Also, I think the code should be moved to it's own JavaScript library, just like the MailLogSubclass, called OpenLogJavaScript.SampleExtension. Example:

/******************************************
This library shows how you can extend the OpenLogJavaScript library.

When logging an error, if a beforeLogError method exists on the openLogObject, that method will be called before the error is sent to the server.

By including this script AFTER the OpenLogJavaScript, every new openLogObject will have a beforeLogError method on it.
******************************************/
if (openLogObject) openLogObject.prototype.beforeLogError = function() {
if (!this.postParamList["ExtraMessage"]) {
// this adds some user-supplied text to the error message we got
var answer = prompt("The error \"" + this.msg + "\" just occurred.\nWhat were you doing?", "");
this.msg += "\n\nAt the time of the error, the user was doing this:\n" + answer;
// and this adds a new POST parameter to the packet that is sent to the
// server, which will in turn create a new field called "ExtraMessage" on
// the OpenLog document that is created
this.postParamList["ExtraMessage"] = answer;
}
}



Taken Actions by Owners

No actions have been taken yet.


In this field you can enter the actual request.

You can use the rich text editor for rich text formating. You can also enter HTML to embed objects, e.g. to embed a YouTube video or a screenshot of the project. In this case use '[' and ']' to mark the passthrough HTML as such.

Please note that the first time you use the new UI your description is converted from rich text to MIME. You might want to copy and paste the raw plain text from the old UI in the new UI so that you don't loose information.
In this field owners can describe what they have done or want to do.

You can use the rich text editor for rich text formating. You can also enter HTML to embed objects, e.g. to embed a YouTube video or a screenshot of the project. In this case use '[' and ']' to mark the passthrough HTML as such.

Please note that the first time you use the new UI your description is converted from rich text to MIME. You might want to copy and paste the raw plain text from the old UI in the new UI so that you don't loose information.