LG_File

LG_File — specifies the file to receive a log.

Syntax

#include <cogent.h>
ST_STATUS LG_File(IP_Task*  myself,
 IP_Task*  textlog,
 char*  retbuf,
 int  buflen,
 char*  filename,
 int  nlabels,
 char**  labels);

Arguments

myself

A pointer to this task's IP_Task structure normallly generated by a call to IP_NserveInit.

textlog

A pointer to the Cascade TextLogger's IP_Task structure, normally generated by a call to IP_TaskFindName.

retbuf

A pointer to a character buffer to hold the return from the call.

buflen

The length of retbuf, in bytes.

filename

One of the following:

    The name of the file that will be logged to.

    stdout

    stderr

nlabels

The number of labels (log or group names) referenced in the labels argument.

labels

An array of char*, each of which is a pointer to a string containing a log or group name.

Returns

ST_OK on success. Otherwise ST_ERROR, and the retbuf will contain a more detailed error message (see file in the Cascade TextLogger documentation). If the return value is ST_OK, the retbuf may not contain useful information.

Description

This function lets you specify the filename that a log or group will be written to. If no labels are specified, this command sets a global default value for all logs and groups. Any specific value always overrides the global definition, regardless of the order in the configuration file or when a command is sent.

If this command specifies multiple labels, the logs for all of them will be written to one file. They will not necessarily always be written in exact time-sequential order, however. You may have to post-process the file if you need that kind of record.

[Note]

The Cascade TextLogger writes each log only once. If you apply the LG_File function twice for the same log, writing to a different file each time, for example, only the most recent application of LG_File will produce results. Thus, if you need the same information written in two places, make two identical logs with different labels.

This function corresponds to the Cascade TextLogger file command.