Display the names and values of all variables in the local variable environment, including private variables.
- Uses an argumentless
zwrite
under the hood.- Process-private globals are not displayed.
- Variables are listed by name in ASCII order.
- Subscripted variables are listed in subscript tree order.
- The debug output's
HTML
has been escaped. - Debug output labels (optional).
- User-defined URI query string (optional).
- Unlimited
<pre>
tagHTML
attributes.
Output debug info into the document right before the <!doctype html>
tag:
<custom:rg:debug:write prehtml />
Output debug info into the <head>
right before the closing </head>
tag:
<custom:rg:debug:write head />
Output debug info into the <body>
right before the closing </body>
tag:
<custom:rg:debug:write body />
Output debug info into the document right after the closing </html>
tag:
<custom:rg:debug:write posthtml />
Output debug info into the current location:
<custom:rg:debug:write />
… and/or this
:
<custom:rg:debug:write this />
Output debug info into all of the above sections:
<custom:rg:debug:write this prehtml head body posthtml />
Output debug info without querystring
and label
arguments (the empty strings can be omitted - keep the commas though):
do ##class(custom.rg.debug.Write).all("", "", "class|pretty")
prehtml
:PREHTML
section (before<!doctype html>
).head
:HEAD
section (in<head>
).body
:BODY
section (in<body>
).posthtml
:POSTHTML
section (after</html>
).this
: Called in place (immediately invoked).attributes
: Delimited attributes to include in the<pre>
tag. Format:attribute|value, attribute|value, …
.querystring
: Query string parameter to use. Default isdebug
.
The prehtml
, head
, body
and posthtml
attributes accept a numeric value which is used to relatively position the content within the section; a negative number is the beginning of a section and a positive number is the end of a section. The default value is 1
.
Note: The this
attribute doesn't (currently) take any arguments.
Before:
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testing Debug Write</title>
<meta name="description" content="">
<meta name="keywords" content="">
</head>
<body>
<custom:rg:debug:write this prehtml head body="2" posthtml attributes="class|pretty" />
<p>Nam ut aliquet diam. Suspendisse et mauris tempus urna ullamcorper placerat at non eros. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pharetra pellentesque sem eu dictum. Nunc accumsan sagittis velit, quis condimentum diam hendrerit a. Fusce sollicitudin, nibh eu bibendum aliquet, magna nulla lacinia nisl, vitae imperdiet diam leo quis massa. Pellentesque sodales rutrum tempus. Vivamus nunc nisi, auctor bibendum condimentum quis, tincidunt sed magna. Nunc a quam dolor. Donec eu mi in diam placerat luctus in in massa. Etiam commodo, odio et lobortis condimentum, sapien sapien iaculis tellus, et rhoncus leo massa ut diam. Ut molestie aliquet lectus, nec condimentum sem mollis id.</p>
#[ do ##class(custom.rg.debug.Write).all("", "right here!", "class|pretty") ]#
<p>Praesent sit amet nulla tortor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin elementum tincidunt arcu at congue. Sed rhoncus suscipit augue, in placerat eros vestibulum nec. Donec ac diam turpis, sed lobortis ipsum. Ut eros est, laoreet ac hendrerit id, ullamcorper id lorem. Aenean fermentum lectus eu purus gravida facilisis eu at elit. Donec sapien justo, sollicitudin eget commodo in, blandit non massa. Nulla quis sagittis velit. Phasellus nibh diam, viverra consequat tincidunt et, luctus eget nunc. Cras aliquet lacinia dolor vel condimentum.</p>
</body>
</html>
After:
<pre class="pretty">
---------- PREHTML ----------
%CSPsc=1
%request=<OBJECT REFERENCE>[1@%CSP.Request]
%response=<OBJECT REFERENCE>[2@%CSP.Response]
%session=<OBJECT REFERENCE>[3@%CSP.Session]
<Private variables>
qs="debug"
label="prehtml"
attr="class|pretty"
currIO="UTF8"
---------- PREHTML ----------
</pre>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Testing Debug Write</title>
<meta name="description" content="">
<meta name="keywords" content="">
<pre class="pretty">
---------- HEAD ----------
%CSPsc=1
%request=<OBJECT REFERENCE>[1@%CSP.Request]
%response=<OBJECT REFERENCE>[2@%CSP.Response]
%session=<OBJECT REFERENCE>[3@%CSP.Session]
<Private variables>
qs="debug"
label="head"
attr="class|pretty"
currIO="UTF8"
---------- HEAD ----------
</pre>
</head>
<body>
<a class="drs" href="#"> <span><b><custom:rg:debug:write this="" prehtml="" head="" body="2" posthtml="" attributes="class|pretty"></b></span></a>
<pre class="pretty">
---------- THIS ----------
%CSPsc=1
%request=<OBJECT REFERENCE>[1@%CSP.Request]
%response=<OBJECT REFERENCE>[2@%CSP.Response]
%session=<OBJECT REFERENCE>[3@%CSP.Session]
Timers=1
Timers(1)=" �����9U����c&����"
Timers(1,"Attributes")="this="" prehtml="" head="" body="2" posthtml="" attributes="class|pretty""
<Private variables>
qs="debug"
label="this"
attr="class|pretty"
currIO="UTF8"
---------- THIS ----------
</pre>
<a class="dre" href="#"> <span><b></custom:rg:debug:write this="" prehtml="" head="" body="2" posthtml="" attributes="class|pretty"></b><br>Elapsed: .000475<br>Globals: 3<br>Lines: 51</span></a>
<p>Nam ut aliquet diam. Suspendisse et mauris tempus urna ullamcorper placerat at non eros. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pharetra pellentesque sem eu dictum. Nunc accumsan sagittis velit, quis condimentum diam hendrerit a. Fusce sollicitudin, nibh eu bibendum aliquet, magna nulla lacinia nisl, vitae imperdiet diam leo quis massa. Pellentesque sodales rutrum tempus. Vivamus nunc nisi, auctor bibendum condimentum quis, tincidunt sed magna. Nunc a quam dolor. Donec eu mi in diam placerat luctus in in massa. Etiam commodo, odio et lobortis condimentum, sapien sapien iaculis tellus, et rhoncus leo massa ut diam. Ut molestie aliquet lectus, nec condimentum sem mollis id.</p>
<pre class="pretty">
---------- RIGHT HERE! ----------
%CSPsc=1
%mmmu1=""
%mmmu2=""
%request=<OBJECT REFERENCE>[1@%CSP.Request]
%response=<OBJECT REFERENCE>[2@%CSP.Response]
%session=<OBJECT REFERENCE>[3@%CSP.Session]
Timers=0
gRequestId=82529275
ruleError=""
<Private variables>
qs=""
label="right here!"
attr="class|pretty"
currIO="UTF8"
---------- RIGHT HERE! ----------
</pre>
<p>Praesent sit amet nulla tortor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin elementum tincidunt arcu at congue. Sed rhoncus suscipit augue, in placerat eros vestibulum nec. Donec ac diam turpis, sed lobortis ipsum. Ut eros est, laoreet ac hendrerit id, ullamcorper id lorem. Aenean fermentum lectus eu purus gravida facilisis eu at elit. Donec sapien justo, sollicitudin eget commodo in, blandit non massa. Nulla quis sagittis velit. Phasellus nibh diam, viverra consequat tincidunt et, luctus eget nunc. Cras aliquet lacinia dolor vel condimentum.</p>
<pre class="pretty">
---------- BODY ----------
%CSPsc=1
%mmmu1=""
%mmmu2=""
%request=<OBJECT REFERENCE>[1@%CSP.Request]
%response=<OBJECT REFERENCE>[2@%CSP.Response]
%session=<OBJECT REFERENCE>[3@%CSP.Session]
Timers=0
gRequestId=82529275
ruleError=""
<Private variables>
qs="debug"
label="body"
attr="class|pretty"
currIO="UTF8"
---------- BODY ----------
</pre>
</body>
</html>
<pre class="pretty">
---------- POSTHTML ----------
%CSPsc=1
%mmmu1=""
%mmmu2=""
%request=<OBJECT REFERENCE>[1@%CSP.Request]
%response=<OBJECT REFERENCE>[2@%CSP.Response]
%session=<OBJECT REFERENCE>[3@%CSP.Session]
Timers=0
gRequestId=82529275
ruleError=""
<Private variables>
qs="debug"
label="posthtml"
attr="class|pretty"
currIO="UTF8"
---------- POSTHTML ----------
</pre>
… and, here's the HTML output:
---------- PREHTML ---------- %CSPsc=1 %request=<OBJECT REFERENCE>[1@%CSP.Request] %response=<OBJECT REFERENCE>[2@%CSP.Response] %session=<OBJECT REFERENCE>[3@%CSP.Session] <Private variables> qs="debug" label="prehtml" attr="class|pretty" currIO="UTF8" ---------- PREHTML -------------------- HEAD ---------- %CSPsc=1 %request=<OBJECT REFERENCE>[1@%CSP.Request] %response=<OBJECT REFERENCE>[2@%CSP.Response] %session=<OBJECT REFERENCE>[3@%CSP.Session] <Private variables> qs="debug" label="head" attr="class|pretty" currIO="UTF8" ---------- HEAD -------------------- THIS ---------- %CSPsc=1 %request=<OBJECT REFERENCE>[1@%CSP.Request] %response=<OBJECT REFERENCE>[2@%CSP.Response] %session=<OBJECT REFERENCE>[3@%CSP.Session] Timers=1 Timers(1)=" �����9U����c&����" Timers(1,"Attributes")="this="" prehtml="" head="" body="2" posthtml="" attributes="class|pretty"" <Private variables> qs="debug" label="this" attr="class|pretty" currIO="UTF8" ---------- THIS ----------Nam ut aliquet diam. Suspendisse et mauris tempus urna ullamcorper placerat at non eros. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus pharetra pellentesque sem eu dictum. Nunc accumsan sagittis velit, quis condimentum diam hendrerit a. Fusce sollicitudin, nibh eu bibendum aliquet, magna nulla lacinia nisl, vitae imperdiet diam leo quis massa. Pellentesque sodales rutrum tempus. Vivamus nunc nisi, auctor bibendum condimentum quis, tincidunt sed magna. Nunc a quam dolor. Donec eu mi in diam placerat luctus in in massa. Etiam commodo, odio et lobortis condimentum, sapien sapien iaculis tellus, et rhoncus leo massa ut diam. Ut molestie aliquet lectus, nec condimentum sem mollis id.
---------- RIGHT HERE! ---------- %CSPsc=1 %mmmu1="" %mmmu2="" %request=<OBJECT REFERENCE>[1@%CSP.Request] %response=<OBJECT REFERENCE>[2@%CSP.Response] %session=<OBJECT REFERENCE>[3@%CSP.Session] Timers=0 gRequestId=82529275 ruleError="" <Private variables> qs="" label="right here!" attr="class|pretty" currIO="UTF8" ---------- RIGHT HERE! ----------Praesent sit amet nulla tortor. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Proin elementum tincidunt arcu at congue. Sed rhoncus suscipit augue, in placerat eros vestibulum nec. Donec ac diam turpis, sed lobortis ipsum. Ut eros est, laoreet ac hendrerit id, ullamcorper id lorem. Aenean fermentum lectus eu purus gravida facilisis eu at elit. Donec sapien justo, sollicitudin eget commodo in, blandit non massa. Nulla quis sagittis velit. Phasellus nibh diam, viverra consequat tincidunt et, luctus eget nunc. Cras aliquet lacinia dolor vel condimentum.
---------- BODY ---------- %CSPsc=1 %mmmu1="" %mmmu2="" %request=<OBJECT REFERENCE>[1@%CSP.Request] %response=<OBJECT REFERENCE>[2@%CSP.Response] %session=<OBJECT REFERENCE>[3@%CSP.Session] Timers=0 gRequestId=82529275 ruleError="" <Private variables> qs="debug" label="body" attr="class|pretty" currIO="UTF8" ---------- BODY -------------------- POSTHTML ---------- %CSPsc=1 %mmmu1="" %mmmu2="" %request=<OBJECT REFERENCE>[1@%CSP.Request] %response=<OBJECT REFERENCE>[2@%CSP.Response] %session=<OBJECT REFERENCE>[3@%CSP.Session] Timers=0 gRequestId=82529275 ruleError="" <Private variables> qs="debug" label="posthtml" attr="class|pretty" currIO="UTF8" ---------- POSTHTML ----------
See also: test.csp
.
There's a couple ways (that I can think of) to install this code:
- Open Studio.
- Change to the
CMS
namespace. - "File" >> "New..." and choose "Caché Class Definition" from "General" tab.
- Copy/paste the RAW contents
custom.rg.debug.Write.cls
into this new file. - Save this file as
custom.rg.debug.Write.cls
tocustom/rg/debug
package. - Compile.
- "File" >> "New..." and choose "Caché Server Page" from "CSP File" tab.
- Copy/paste the RAW contents of
custom.rg.debug.WriteRule.csr
into this new file. - Save this file as
custom.rg.debug.WriteRule.csr
to the "CSP Files" >>/csp/cms/customrules
package/folder/location. - Compile.
- Download and unzip this repo to your local machine.
- Open Studio.
- Change to the
CMS
namespace. - "Tools" >> "Import Local...".
- Import
custom.rg.debug.Write.xml
,custom.rg.debug.WriteRule.csr
and check the compile box.
Non-DTI customers should emove these lines from custom.rg.debug.WriteRule.csr
:
<csr:class super="dt.common.page.Rule" />
<script language="cache" runat="compiler">
do ##this.RenderDTStartTag()
</script>
<script language="cache" runat="compiler">
do ##this.RenderDTEndTag()
</script>
Copyright © 2012 Micky Hulse
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this work except in compliance with the License. You may obtain a copy of the License in the LICENSE file, or at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.