op_prg_log_entry_write()
Abstract
Writes a log entry to the specified log handle.
Syntax
op_prg_log_entry_write (handle, entry_text, …)
| Argument | Type | Description |
|---|---|---|
handle |
Log_Handle |
Log handle identifying the simulation log to receive the entry. |
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
void
No return value.
Example
Excerpt from: ams_atm_notif_log_support_v2.ex.c in the models/std/atm directory.
/* Write the message to the notification log */
op_prg_log_entry_write (atm_buff_overflow_cell_loss_log_handle,
"SYMPTOM(S):\n"
" A Cell is being dropped as there is \n"
" no available space at output buffer \n"
" of port [%d] for the QoS %s \n"
"\n"
"CAUSE(S):\n"
" Cells can be dropped at the end nodes\n"
" or switches due to non-availability \n"
" of buffer space at the output ports. \n"
" The buffers need to be sufficient \n"
" to hold cells generated due to a \n"
" burst. \n"
"\n"
"SUGGESTION(S):\n"
" 1. Set the buffer sizes for QoS \n"
" %s to be greater than \n"
" the present value of %d. \n"
"\n",
port_value,
qos_string,
qos_string,
cur_buf_size
);
Details
This KP appends a new log entry to a simulation log. The log entry will have a time stamp based on the simulation time of the event that generated the entry.
Simulation logs can only be referenced by variables of type Log_Handle that have been initialized with op_prg_log_handle_create().
Purpose
Provides a mechanism to write an entry to a specified simulation log.
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_options() to write a log entry with selected column values omitted
- 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