Monday, November 08, 2010 at 12:05 AM.

on add (eventType, htmltext, startticks, adrdata=nil) {
		<<1/22/02; 7:42:47 AM by DW
			<<Clear the cache for the Events page.
		<<1/11/01; 5:26:20 PM by DW
			<<Do hourly rollover, we think this may make a substantial performance difference in Radio as a server. Certainly can't hurt.
		<<12/30/00; 8:05:15 PM by DW
			<<Added startticks parameter.
		<<12/30/00; 7:30:47 PM by DW
			<<Added support for callbacks. Each callback gets the address of the log table. It can copy it, flow it to a different log format, or whatever you like.
		<<Saturday, December 30, 2000 at 9:02:05 AM by DW
			<<Created. Add a table to today's log database. The caller provides an event type, HTML text to be displayed when the user is browsing the log, and optional data to be stored in the log record. My UserLand on the Desktop has a command that displays today's log. 
			<<Example of caller: radio.upstream.uploadMultipleFiles.
	if {
		local (secs);
		bundle { //set secs
			local (s = string (double (clock.ticks () - startticks) / 60));
			local (lod = string.nthfield (s, ".", 1));
			local (rod = string.nthfield (s, ".", 2));
			if sizeof (rod) > 3 {
				rod = string.mid (rod, 1, 3)}
			else {
				if sizeof (rod) < 3 {
					rod = string.padwithzeros (rod, 3)}};
			secs = lod + "." + rod};
		local (adrtable = log.addToGuestDatabase (, flHourlyRoll:true));
		adrtable^.eventType = eventType;
		adrtable^.htmltext = htmltext;
		adrtable^.secs = secs;
		if adrdata != nil {
			adrtable^.data = adrdata^};
		bundle { //call the callbacks, if present
			local (adr, adrcallbacks =;
			if defined (adrcallbacks^) {
				for adr in adrcallbacks {
					while typeof (adr^) == addresstype {
						adr = adr^};
					try {adr^ (adrtable)}}}}};
	if defined ( {
		delete (}}
<<bundle //test code
	<<edit (add ("Testing", "oh the buzzing of the bees", @scratchpad.params))

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.