op_prg_log_handle_create()
Abstract
Returns a handle that can be used to reference a DES log.
Syntax
op_prg_log_handle_create (category, class_name, subclass, incident_limit)
| Argument | Type | Description |
|---|---|---|
category |
Log_Category |
Type of log entry to be associated with the new log handle (see Details). |
class_name |
const char* |
string describing class of log entries for this handle You define the meaning and content of this string. |
subclass |
const char* |
string describing subclass of entries for this handle You define the meaning and content of this string. |
incident_limit |
unsigned int |
maximum number of individual log entries allowed for this handle (see Details). |
Return Type
Log_Handle
Log handle that can be used when calling other op_prg_log… KPs.
Example
Excerpt from: ams_atm_notif_log_support_v2.ex.c in the models/std/atm directory.
if (atm_notif_log_initialized == OPC_FALSE)
{
/* Set flag to prevent re-initialization. */
atm_notif_log_initialized = OPC_TRUE;
...
/* Configuration related notification handles. */
atm_conf_log_handle = op_prg_log_handle_create
(OpC_Log_Category_Configuration, "ATM", "Setup", atm_conf_log_limit);
atm_invalid_dest_conf_log_handle = op_prg_log_handle_create
(OpC_Log_Category_Configuration, "ATM", "Setup", atm_conf_log_limit);
...
}
Details
When creating discrete event simulation (DES) logs, a log handle is needed for each category of log entry to be used. The data type and defined values for category are:
Log_Category
OpC_Log_Category_ConfigurationOpC_Log_Category_ProtocolOpC_Log_Category_LowlevelOpC_Log_Category_ResultsOpC_Log_Category_Unknown
Note: The Unknown category produces a blank entry in the DES log.
You should use the class_name and subclass arguments to further refine the meaning of the categories as they pertain to specific modeling projects. If the log handle receives a number of identical log entries, it reports each one separately until incident_limit entries have been reported. After that, it tracks the number of times that entry is logged and reports the number of occurrences in a single log entry at the end of the simulation.
Newly created handles have a severity of PrgC_Log_Severity_Notice. You can use op_prg_log_handle_severity_set() to change the severity level before writing to the log.
Purpose
Provides a mechanism to create a log handle to use when writing DES log entries.
Errors
- No errors are trapped.
Reference
- Use the KPs op_prg_log_entry_write(), op_prg_log_entry_write_options(), and op_prg_log_entry_write_t() to write a single log entry