Welcome Tour
Site Checklist
Our Story




The log command/function is another powerful feature in BoltWire, allowing you to append a line of information to another page quickly and easily. It can easily be combined with other systems in BoltWire like lists, groups, info vars and more.

The command works virtually the same as the log function, only it is used in a form. It takes input from a user and only processes after the form is submitted.

The log command looks for a page to write to, and some content for the log entry (usually a single line). Page is defined by the page parameter, or if that is not set, paramter #2. If that is not found, it defaults to a log page for your current page. So if you are on, the log page will be

You must have write authorizations to use the log command (or function).

The content of the log entry is drawn from the content parameter if available, then the value parameter (if a command, and available) and finally from parameter #1.

Here's a simple example of a log form:

[command log '{id} was here at {(time %c)}' page=log.visitors]

<(include log.visitors)>

This displays a simple button. Everytime it is clicked a new line is added to the log and displayed on the current page through the include function. Each log entry shows who clicked the button and the date & time.

If this was set as a function, the log page would be appended every time the page was viewed without the user having to do anything. It would look essentially the same:

[(log '{id} was here at {(time %c)}' page=log.visitors)]
<(include log.visitors)>

Just refresh the page and a line is added each time. Note that the time function uses the variable function format, to ensure that it is processed before the log function is called. Otherwise, the log entries would all have the time function, and show the current time when the log page is viewed.

Log Flags

You can modify how the log command works by adding flags. Available flags include:

lowercase - convert log entry to lowercase
delete - delete entry if found on log page
remove - delete entry if found on log page
top - post to the top of the log, rather than the bottom
sort - sort the lines on the log page
reverse - reverse order of the entries on the log page
unique - only add the log entry if not already there
trim=7 - limit the log to the 7 most recent entries only
line=3 - replace the third line with new entry

To add flags to a log command, set the flags parameter to a csv list of the flags you want to use. For example:

[command log '{id} was here at <(time %x)>' page=log.visitors flags='top,unique,trim=10']

<(include log.visitors)>

This will put a max of 10 items on the log page, starting with the most recent at the top. A user can only submit a log entry once each day (the date has to change for the new entry to be unique. If the time format was %c, you could log something once every second.

Uses of Logs

There are actually a lot of clever things you can do with logs. These forms could be used to allow members to join or drop your chessclub group:

[submit JOIN]
[command log {id} page=group.chessclub flags=unique]

[submit DROP]
[command log {id} page=group.chessclub flags=remove]

<(include group.chessclub)>

Suppose you wanted to create a simple shout box, and then output the log entries back. Consider this markup:

Post a Shout:
[box shout rows=3 cols=30][box]
[command log '[[~{id}]] says: "{=shout}"' page=log.shout flags='top,trim=5']

[(list page=log.shout template='<div class=box>{+p}</div>')]


Parameters from the command/function can be inserted into the log entry using standard template replacements, though it's not particularly useful.

Lines breaks in the content are automatically converted to \n unless you explicitly set lines=false as a parameter.

You can change the delimiter separating log entries from the standard line break to something else. This could cause strange behavior.