Translator's words:
I don’t know if friends who write code in ASP have the same feeling as I do. The most headache in ASP is that it is inconvenient to debug the program. I think many friends may use this method to "response.write", and then output related related Let's see if it is correct. A few days ago I wrote a thousand lines of page, which contains about seven or eight Sub/Function. When debugging, there are more than thirty Response.write. Intersection
I saw a Debug class (VBS) in ASP today, and tried it. Never!
The method of use is simple:
test.asp
<!-#Include file = debuggingConsole.asp->
<%
output = xxxx
set debugstr = New DebuggingConsole
Debugstr.enabled = TRUE
Debugstr.print parameter value of output, output
'...
debugstr.Draw
set debugstr = nothing
%>
=========================================== =
debuggingConsole.asp
<%
Class DebuggingConsole
private dbg_enabled
private dbg_show
Private dbg_requesttime
private dbg_finishTime
Private dbg_data
private dbg_db_data
Private dbg_allvars
private dbg_show_default
Prive DivSets (2)
'Construktor => set the default values
Private sub class_initialize ()
dbg_requesttime = Now ()
dbg_allvars = false
set dbg_data = server.createObject (scripting.dicTionary)
divSets (0) = <tr> <td style = 'cursor: hand;' Onclick = javascript: if (DACUMENT.GETELEMENTBYID ('Data#sectName#'). e ') {document.GetelementByid ( 'Data#sectName#'). STYLE.display = 'Block'; IV ID = Sect# SECTNAME# STYLE = FONT-Weight: Bold; Cursor: Hand; Background:#7EA5D7; Color: White: Padding-Left: 4; Padding-RIGHT: 4; Padding-Bottom: 2;#Title#| <DIV id = data# SectName#style = cursor: text; display: none; background: #ffffff; padding-left: 8; onclick = window.event.cancelbubble;> |#data#| < /div> | </div> | |
divSets (1) = <tr> <td> <div id = sect#select#style = font-weight: bold; cursor: hand; background:#7ea5d7; color: white; padding-section: 4 ; Padding-Right: 4; in 4 4 4 {{documen TBYID ('Data#Sectname#'). STYLE. display = 'block';} else {document.GetelementByid ('Data#sectName#'). Style.display = 'None'; ame# style = cursor: text; display: block; background: #ffffff; padding-left: 8; onClick = window.event.cancelbubble = true;
divSets (2) = <tr> <td> <div ID = sect#sectname#style = background:#7ea5d7; color: lightenteelblue; padding-left: 4; padding-right: 4; padddddddddddddling Ing-Bottom: 2;> | | | ##| <div ID = data#sectName#style = display: none; background: lightSteelblue; padding-left: 8>#data#| </div> </div> |
dbg_show_default = 0,0,0,0,0,0,0,0,0,0,0,0,0
end sub
Public Property Let Enabled (bool] sets enabled to true or false
dbg_enabled = bnewvalue
End Property
Public Property get enabled '' '[BOOL] Gets the Enabled Value
enabled = dbg_enabled
End Property
Public Property Let Show (BNEWVALUE) '' '' [String] sets the debugging Panel. Where Each Digit in the String RepreSEnts A Debug Information Pane in Order (11 of the . 1 = Open, 0 = Closed
dbg_show = bnewvalue
End Property
Public Property get Show '' '[String] gets the debugging panel.
show = dbg_show
End Property
Public Property Let Allvars (BNEWVALUE) '' '
dbg_allvars = bnewvalue
End Property
Public Property get allvars' '' [bool] gets if all variables will be displayed.
allvars = dbg_allvars
End Property
'***********************************************************************************************************************************************************************************************************************************************************************, ************************************************* *******************
'' @sdescription: adds a variable to the debug-informations.
'' @param: -Label [String]: Description of the variable
'' @param: -Output [variable]: The variable itset
'********************************************** ************************************************* *******************
Public Sub Print (label, output)
if dbg_enabled then
if err.number> 0 then
Call DBG_Data.ADD (ValidLabel (Label), !!! error: & err.number & & err.Description)
err.clear
else
uniqueid = ValidLabel (label)
response.write uniqueid
call dbg_data.add (unique