op_prg_log_entry_write_options()
Abstract
Writes a log entry to the specified log handle, with control over which columns are included.
Syntax
op_prg_log_entry_write_options (handle, options, entry_text, …)
| Argument | Type | Description |
|---|---|---|
handle |
Log_Handle |
Log handle identifying the simulation log to receive the entry. |
options |
int |
Options for suppressing columns in the log entry (see options in Details). |
entry_text |
const char * |
String containing the text of the log entry. The string can contain conversion specifiers like those used by the C printf command (%d, %s, and so on). |
… |
various |
Zero or more arguments representing values to be substituted into entry_text. |
Return Type
Compcode
OPC_COMPCODE_SUCCESS if the entry was added successfully; OPC_COMPCODE_FAILURE otherwise.
Example
/* Failed to load the requested model */
/* Most likely cause is missing model from mod_dirs. */
sprintf (line0_buf, "TMM: unable to load propagation model (%s). ",
DraS_Closure_Tmm_Prop_Model_Name);
strcpy (line1_buf, "Using default closure instead.");
/* log message, omitting node and event */
op_prg_log_entry_write_options (tmm_problem_log_handle,
OPC_LOG_ENTRY_OPTION_NO_NODE | OPC_LOG_ENTRY_OPTION_NO_EVENT,
"Pipeline stage 'closure' during initialization for\n"
"%s\n"
"%s\n"
"\n"
"Check that your mod_dirs contains all 3 of the needed\n"
"propagation model files (.prop.d, .prop.p and .prop.so).\n",
line0_buf,
line1_buf);
Details
This KP appends a new log entry to a simulation log. Simulation logs can only be referenced by variables of type Log_Handle that have been initialized with op_prg_log_handle_create().
options
You can omit certain column values from the log entry by using the options argument. options must be either a 0 (to include all columns) or an OR’ed combination of one or more of the following constants:
OPC_LOG_ENTRY_OPTION_NO_EVENTOPC_LOG_ENTRY_OPTION_NO_NODEOPC_LOG_ENTRY_OPTION_NO_SEVERITYOPC_LOG_ENTRY_OPTION_NO_TIME
Purpose
Provides a mechanism to write an entry to a specified simulation log. This KP is identical to op_prg_log_entry_write(), except that it also lets you omit selected columns from the log entry.
Errors
- Recoverable Error: Invalid log handle.
- Recoverable Error: Nil handle format.
- Program Abort: Segmentation violation/Bus error. (due to an invalid argument following a string with conversion specifiers)
Reference
- Use the KP op_prg_log_handle_create() to create a log handle
- Use the KP op_prg_log_entry_write() to write a log entry with an automatically generated time stamp
- Use the KP op_prg_log_entry_write_t() to write a log entry with a user-specified time stamp
- Use the KP op_prg_log_handle_severity_set() to change the severity level before writing a log entry