ConferenceRoom's web parsing engine has been enhanced to support parsing log files. There are several steps involved in parsing a Scribe log to build a web page.
First, the log file has to be chosen and loaded. There
are several ways to do this. The simplest is to specify
it inside the l_load replacement variable.
Another way is to somehow set the l_file
replacement variable to the file name and then call l_load
with no parameter:
%_set l_file filename%
The last way is a variation on the second way, using the directory traversal to allow the user to select which log he wishes to view.
You can then test for successful loading of the log
file. If the loading fails, the replacement variable l_fail
will be set to the reason the load failed. For example:
<H1>Failed to load logfile</H1> <H2>%l_fail%</H2>
There are a few special replacement variables you can set before you call l_load. l_page will cause the a specified page of the log to be shown. Setting l_page to zero will cause the end of the log to show. An auto-refreshing web page with l_page set to zero will automatically show what the 'recent' portion of the log as it happens.
When using pages, you can set l_perpage to the number of lines per page. When using the tail of the log (page zero), you can set l_tailbytes to the number of bytes to include in the tail.
The special l_perpage value -1 will cause the entire log to be shown in one web page, up to 25,000 lines. Note that l_page, l_tailbytes, and l_perpage must be set before you invoke l_load.
Since the default themes don't lock the page logic,
you can override them in the URL. Suppose
views a log of a chat that's currently in progress. You can create a web link to
to show the 'end' of the log -- the most recent parts of the conversation.
After loading the logfile, you may access any parameters that were set. For example, if the logfile has a parameter called title then %title% will replace to it.
The Scribe logging engine automatically creates the parameters channel, start_time, and stop_time. If you use the log commands (as opposed to raw chan commands), you will also normally get theme, title, and description as well.
It is best to code your web pages to safely handle the case where these parameters do not exist. Look at the included template files to see an easy way to do this with _cset.
After you display the parameters, you need to create a special loop that loops over all the lines in the log file. You begin the loop with %l_begin% and end it with %l_loop%. Again, anything between the %l_begin% and the %l_loop% will be repeated once for each line in the logfile.
Because this loop will run many times, it is best to avoid blank lines inside the loop. A single blank line after l_begin and one before l_loop could result in hundreds of extra blank lines in the final output.
Inside that loop, you may access that line of the log through special replacement variables. First, you can determine the type of command sent by checking for a family of replacement variables named l_command. So, to see if this is a privmsg command, check for l_privmsg.
The loop construct will also set l_user to
the user who issued the command (if any) and l_text
to the text that went along with the command (if any).
For example, the simplest possible Scribe log web page is