> pictools > doc > debuglog
> pictools > doc > debuglog
Pictools: How Things Work
V3.3 (342)
debuglog.php
/pictools/debuglog.php
Debugging tool for JavaScript; displays messages from dbgnsg()
usage, URL: site-host/pictools/debuglog.php
The debug log window
The debuglog window

When this page is visited by the site administrator, calls to dgbmsg() in javascript code display their arguments in the window. Each line of the window has the time the message arrived, the file name of the sender, and the message string. (The time is expressed in mniutes and seconds since debuglog was started.) The CLEAR button removes all entries from the window.

Tools for sending object contents are available in /pictools/debugMore.js.

The dbgmsg function is defined in /scripts/beginpage.php. If there is no admin cookie, dbgmsg is defined to do nothing. Otherwise, the definition is

var loc = "<"+window.location.pathname.split('/').pop()+">  ";
var count = 0;  // make every message unique
function dbgmsg(msg){
   localStorage.setItem('debug-message', 
            "" + (count++)+" "+loc + msg);
}

The first line saves the last segment of the URL; this is usually the file name. The next line establishes a counter which is incremented for each message sent. This is mostly useless; however, localStoreage will not send a message if it is identical to the previous message. The count value makes every message unique. When debuglog receives the message it immediately strips off the copunt and replaces it with the arrival time. (Since times are millisecond times, the time is not useful for accurately discerning the order messages were sent.)

To turn on dbgmsg even without the administrator cookie, you can include a JavaScript file with the above definition

For an older version of this tool that does not require PHP, see the source file /debugWindow.js.

 
Copyright © 2018 ZweiBieren, All rights reserved. Dec 20, 2018 12:18 GMT Page maintained by ZweiBieren