Monday, November 08, 2010 at 12:04 AM.
system.verbs.builtins.log.addToGuestDatabase
on addToGuestDatabase (logname, subTableName=nil, flHourlyRoll=false) {
<<12/14/98; 1:57:30 PM by DW
<<This is the new modern equivalent of log.add.
<<log.add calls this if user.log.prefs.flLogToGuestDatabase is true.
<<As its name implies, this verb only adds to the guest database log.
<<It has a richer 6ish parameter list.
<<logname says which branch of the day's log gets the item
<<subTableName, if specified, says what the table for this log entry will be called
<<flHourlyRoll, is a boolean, if true, we start a new sub-table every hour
<<we return the address of the newly created table, the caller should any any information that is to be saved in the log database
<<2/22/99; 5:15:47 PM by DW
<<the body of this whole script is enclosed in a semaphore
<<3/7/99; 3:20:43 PM by PBS
<<Removed the semaphore, it was unneeded.
local (now = clock.now ());
local (adrlog = log.getGuestSubTable (logname));
if system.temp.log.addsSinceSave++ > user.log.prefs.addsBetweenSaves {
fileMenu.saveMyRoot (adrlog);
system.temp.log.addsSinceSave = 0};
if flHourlyRoll {
local (day, month, year, hour, minute, second);
date.get (now, @day, @month, @year, @hour, @minute, @second);
adrlog = @adrlog^.[string.padwithzeros (hour, 2)];
if not defined (adrlog^) {
new (tabletype, adrlog);
try {delete (@[f].["item #1"])}}};
if subTableName == nil {
subTableName = string (now)};
local (adrsubtable = xml.addTable (adrlog, subTableName));
return (adrsubtable)}
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.