For more information... RTFM!
NAVIGATION
RECENTLY VIEWED
PAGES THAT LINK HERE
ACCOUNT LOGIN

You are not logged in

Powered by Interchange version 5.7.0

log

Write text to a file.

Summary

  • [log file] Text to write [/log]

Parameter Description Default
file the name of file to write to. See LogFile
arg Alias for file. None
create Create the file if not present. No
hide Suppress status otherwise returned by tag to the page. No
process Processing (if any) to apply to the content while logging. None
record_delim Record delimiter. ASCII LF
type Log type (see below). error
interpolate

Parse Interchange tags, included in the body text, before this container tag executes.

No

Examples

Tag usage example

[log file="logs/foo" create=1] Text to write to the file [/log]

Perl example

$Tag->log({
    file => $file,
    body => $body,
});

or similarly with positional parameters:

$Tag->log($file, $attribute_hash_reference, $body);

Description

This tag writes its body text to the specified file, or to the default file specified using the LogFile parameter.  Interchange markup language tags work inside this container, so it is possible to iterate over a list, using [loop] or similar, and create "records".

Parameters

file

The name of file to log to.  If the filename starts with a ">" symbol (i.e. ">filename") then the create parameter will be set true for you.  The leading ">" will not be included in the actual filename, of course.

If not specified, the file named with the LogFile configuration directive, or that directive's default value, will be used.

Note

Note

The given filename must be relative to the website's home directory, as specified using the Catalog global configuration directive.

create

Set this parameter true to create the file if not present in file system.

Warning

Warning

If the named file already exists, and create is set true, then this tag will re-create the file by overwriting its content.

hide

If true then suppress the status code that would otherwise be returned to the page.

process

Processing (if any) to apply to the content while logging.

Currently, the only valid value for the process parameter is "nostrip".  The following will not strip leading/trailing whitespace and will not convert DOS-style CRLF line endings to proper LF characters:

[log file="logs/mylog.log" process="nostrip"] text to write to the file [/log]

record_delim

Record delimiter.  Defaults to an ASCII LF, so each block of logged text, or other data, appears on its own line.

type

The type of log to create/write.  Any of the following three types can be specified.

Type Description
text Ordinary text file.
quot Delimited entries.
error Add Interchange error formatting and time/location stamps (default log type).
Category:  Interchange tags
Last modified by: Kevin Walsh
Modification date: Monday 7 January 2008 at 9:02 AM (EST)
Home  |  Legal nonsense  |  Privacy policy  |  Contact us