prg_log_column_add()
Abstract
Adds a new column to a log.
Syntax
prg_log_column_add (log_store_hndl, title, format_string, value_type)
| Argument | Type | Description |
|---|---|---|
log_store_hndl |
PrgT_Log_Store_Handle |
Log store of interest (must be open for writing and contain no data). |
title |
const char * |
Name of the column to be added (must be unique). |
format_string |
const char * |
Optional printf-like string used to format the column value for display (see Details). PRGC_NIL if not used. |
value_type |
PrgT_Log_Value_Type |
Data type for column values; one of the constants listed in Table 2. |
Return Type
PrgT_Compcode
PrgC_Compcode_Success if the column is added successfully; PrgC_Compcode_Failure otherwise.
Header
prg_log.h
Details
Use this function to define a log template. When a log is opened, it initially contains a date column (index 0) and, if the PRGC_LOG_OPEN_OPT_INCLUDE_SEVERITY option was set in the call to prg_log_open(), a severity column (index 1). This function adds the specified column to the end (right side) of the template, at the next available index. During writes, column values must be passed in the same order that they were defined.
The syntax for format_string is
%['][<flag>]*[<int_width>][.<precision>]df
where
'specifies that thousands separators be added to the number (Linux only)<flag>is any combination of the following:'+': display number with + or - sign' ': pad decimal part with spaces'0': pad decimal part with zeros<int_width>is the minimum width of the integer part<precision>is the number of decimal places
This format can be preceded and followed by additional text. If format_string begins with ^<, ^>, or ^|, column values will be justified left, right, or center, respectively.
For example, the format string %'+03.4d will display the numbers 1.3 and -1300.123345 as ' +1.3000' and '-1,300.1233' (on Linux, in international English locale).