log

log — writes point data in formatted lines.

Syntax

(log label format [point ...])
    

Arguments

label

A name that uniquely identifies this log.

format

A string that includes formatting directives, similar to the kind used in the C language printf statement, as follows:

%[di]Integer.
%[xX]Hexadecimal integer.
%oOctal integer.
%uUnsigned integer.
%cSingle character ASCII representation from integer.
%fFloating point, decimal.
%[eE]Floating point, engineering representation.
%[gG]Floating point, shortest representation of f or e.
%sString.

The above format directives may optionally include the following modifiers between the % sign and the format character:

-Left justify within a field.
nA number that specifies field width and decimal accuracy.
0Zero-pad the number to a fixed width.
+Always include a sign, even if positive.

The following formats produce output, but are not associated with a point in the argument list:

%tA time string as defined by the command time.
%AThe global default time spec, as set by the command time.
%FThe default file name for this line, or the global prefix. If the Cascade TextLogger is started with the -p option, this command is overridden by the global prefix name.
point

The name of the data point that is to be logged.

Returns

On success, t, otherwise one of the following error messages:

(error "textlog: Log line label already exists")
(error "textlog: Could not register points for log label")
(error "textlog: Group or log label does not exist")
(error "textlog: Too few arguments to log: # < #")
(error "textlog: Invalid command: log")

or, if none of the above errors apply, nil.

Description

The log command specifies which points to log, and the format of each line of the written output.

This command corresponds to the Cogent C API function LG_Log.

See Also

time

Example

These logs:

(log temp "%t Temperatures 31-34: %+04g %+04g %+04g %+04g" tmp31 tmp32 tmp33 tmp34)
(log press "%t Pressures 31-33: %g %g %g" pr31 pr32 pr39)
(log max_ht "%t Top: %f" max_ht)
(log min_ht "%t Bottom: %f" min_ht)
(log smm32 "%t Summary 32: %+g %02g %f %f" tmp32 pr32 max_ht min_ht)
(collect any)
(collect all smm32)

would produce this kind of output:

...

12:03:0973 Bottom: 12.954260
12:03:0973 Summary 32: +63 5044 24.345670 12.954260
12:03:0955 Pressures 31-33:  *  5044  * 
12:03:0970 Temperatures 31-34:  *   *  +059  * 
12:03:0976 Pressures 31-33:  *  5046  * 
12:03:0979 Temperatures 31-34:  *  +064  *   * 
12:03:0987 Top: 24.345620
12:03:0984 Temperatures 31-34: +054  *   *   * 
12:03:0993 Bottom: 12.954210
12:03:0993 Summary 32: +64 5046 24.345620 12.954210
12:03:0990 Temperatures 31-34:  *   *  +058  * 
12:03:0981 Pressures 31-33: 5127  *   * 
...