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

system.verbs.builtins.radio.utilities.getRecentEventLogStats

on getRecentEventLogStats (flIncludeHeader=true) {
	<<Changes:
		<<12/12/01; 2:12:57 AM by JES
			<<Commented out some debugging code.
		<<11/25/01; 4:02:14 AM by JES
			<<Created. This script generates a human-readable report from the current day's events log.
			<<flIncludeHeader, an optional parameter, specifies whether or not to include general info about this copy of Radio. Set it to false when you're concatenating multiple reports into one.
	
	local (text, indentlevel = 0);
	local (fldebug = false); //set this to false when not debugging
	on add (s) {
		text = text + string.filledString ("    ", indentlevel) + s + "\r\n"};
	on getName (id, adrName) {
		local (adr);
		for adr in @system.compiler.threads {
			if adr^ == id {
				adrName^ = nameOf (adr^);
				return (true)}};
		return (false)};
	bundle { //header
		add ("Radio UserLand recent events for " + user.prefs.name + " run at " + clock.now () + ".");
		add ("");
		if flIncludeHeader {
			add ("About This Installation:");
			indentlevel++;
			add ("Radio version: " + Frontier.version ());
			local (os = "Windows");
			if system.environment.isMac {
				if system.environment.isCarbon {
					os = "Mac OS X"}
				else {
					os = "Mac OS"}};
			add ("Operating System: " + os);
			local (osVersion = system.environment.osVersionString);
			if system.environment.isCarbon {
				osVersion = string.replace (osVersion, "16", "10")};
			add ("OS Version: " + osVersion);
			add ("IP address: " + tcp.dns.getMyDottedId ());
			add ("Email: " + user.prefs.mailAddress);
			add ("");
			indentlevel--}};
	
	indentlevel++;
	local (adrevents = log.getGuestSubTable (radio.data.strings.radioLogName));
	local (cthours = sizeOf (adrevents^), ixhour);
	for ixhour = cthours downTo 1 {
		local (adrhour = @adrevents^[ixhour]);
		local (ctevents = sizeOf (adrhour^), ixevent);
		for ixevent = ctevents downTo 1 {
			local (adrevent = @adrhour^[ixevent]);
			add (adrevent^.eventType + ": " + adrevent^.htmltext + " " + adrevent^.secs + " sec")}};
	indentlevel--;
	text = string.htmlToEmail (text);
	
	if fldebug {
		wp.newTextObject (text, @temp.recentEventStatsText);
		edit (@temp.threadStatsText)};
	
	return (text)}
<<bundle //testing
	<<getRecentEventLogStats ()
	<<getRecentEventLogStats (false)



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.