//---------------------------------------------------- // This javascript class is for creating a log window that can // be used on the client for displaying log information. A variety // of functions exist for inserting log lines and taking timings // of processes from the client side. This was developed initially // to help with benchmarking, as dialog interactions in some cases // artificially slow down the process a great deal. // Generally speaking, one instantiates an instance of the log // window, which creates a new window or returns an existing // instance if the specified window already exists. Then the various // logging methods can be called to add information to the log file. // in addition to simply logging events, this log can be used to time // processes. Here is an example: // LogWin = new LogWindow(); - gets instance of object // LogWin.InitializeTimingLog(); - sets timer to the current time // LogWin.AddBlankLogLine(); - add a blank line to the log // LogWin.AddBlankLogLine(); // LogWin.AddTimingLogLine( 'Start my process'); - adds a line and the current time // ... // LogWin.AddTimingLogLine( 'Called process'); // LogWin.WriteTotalTime( 'All done'); - notes total time elapsed from last call to IntializeTimingLog //---------------------------------------------------- //---------------------------------------------------- // Constructor for the LogWindow class to be used from the // the client side to log progress. This was initially written // for doing benchmarking type logging. // Input: Both parameters are optional // LogName - name of the log. This is used as the window so when new // references are created, the same window can be used to // log information multiple times. This parameter should be // all alphanumeric. No whitespace, no funny characters. // WindowTitle - Title that will show up in the browser. This can be // any string that would normally show up in a broswer window // title //---------------------------------------------------- function LogWindow(LogName, WindowTitle) { //fill in default parameters if necessary (no parameters passed in) if (arguments.length < 1) { LogName = "GenericLog" WindowTitle = "Generic Log" } else if (arguments.length < 2) { WindowTitle = "Generic Log" } //check for blanks. Can be passed in to take default names if (LogName == "") { LogName = "GenericLog" } if (WindowTitle == "") { WindowTitle = "Generic Log" } //set properties based on parameters passed in and get reference to window for logging this.LogName = LogName; this.Title = WindowTitle; this.NewLogWindow = window.open("",this.LogName,"height=400,width=500,menubar,resizable,scrollbars,status,toolbar"); //if there is no title to this window, it is new and we need to create it. //One thing we add is a hidden input field used for doing timings if (this.NewLogWindow.document.title == "") { StartTime = new Date(); //intialize content of window and write out start time this.NewLogWindow.document.write('